How to calculate the sum product of two matrices?

For example, X and Y are both matrices, how do I get Σ(X-Y)'(X-Y) in R?

Matrix multiplication can be done with `%*%`

operator, i.e. `X %*% Y`

.

"Sumproduct" is a term I'm familiar with from Excel, but in that case applies to vectors, not matricies. This can be done in R as `sum(x * y)`

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.