finished trimattrix assignment