Calculus of Matrix and Tensor Structure