matrix assembly simplified