Skip to content
Prev 78397 / 398502 Next

eliminate t() and %*% using crossprod() and solve(A,b)

On Wed, 5 Oct 2005, Robin Hankin wrote:

            
That is not the same thing: it gives t(H) %*% Ainv %*% t(Ainv) %*% H .
Have you some data to support your claims?  Here I find (for random 
matrices of the dimensions given on a machine with a fast BLAS)
[1] 2.19 0.01 2.21 0.00 0.00
[1] 1.33 0.00 1.33 0.00 0.00

so each is quite fast and the difference is not great.  However, that is 
not comparing %*% with crossprod, but t & %*% with crossprod.

I get
[1] 0.05 0.01 0.06 0.00 0.00

which is hardly 'slow' (60 us for %*%), especially compared to forming X 
in
[1] 0.04 0.00 0.04 0.00 0.00

I would probably have written
1] 0.03 0.00 0.03 0.00 0.00

which is faster and does give the same answer.

[BTW, I used 2.2.0-beta which defaults to gcFirst=TRUE.]