I am trying to multiply the transpose of a matrix by the original matrix.
B<-matrix(rep(c(10, -10,10), 15), ncol=3, byrow=TRUE)
I then transposed the matrix using t(B)
function, giving me a 15 x 3 and 3 x 15 matrix, which I should be able to multiply as B*t(B)
or t(B)*B
. However, I get an error of 'Error in t(B) * B : non-conformable arrays'
Is this something I'm missing for this? I should be able to multiple either B*t(B) or t(B)*B since you would have a 3x3 matrix or 15 x 15 matrix for the answer.
B %*% t(B)
is the matrix multiplication.tcrossprod(B)
is faster – jogo