[R] Trace of product of matrices

Wagner Bonat wbonat at gmail.com
Sun Oct 19 16:43:52 CEST 2014


Dear,

I have to compute the trace of a product between four matrices. For
example, I know the matrices Wi, Wj and C, I need to compute this

-trace(Wi%*%C^-1%*%Wj%*%C^-1)


I would like to avoid compute the complete matrix and after take the
diagonal, something like

sum(diag( solve(Wi,C)%*% solve(Wj,C)))

Any idea is welcome.

Thanks

-- 
Wagner Hugo Bonat
LEG - Laboratório de Estatística e Geoinformação
UFPR - Universidade Federal do Paraná

	[[alternative HTML version deleted]]



More information about the R-help mailing list