[R] Problem with kronecker and Matrix

Jarrod Hadfield J.Hadfield at ed.ac.uk
Mon Feb 12 12:28:10 CET 2007


Hi,

I'm trying to speed up some code by using the Matrix package.  For  
most matrix manipulations I get a good increase in speed, however  
applying the kronecker function is orders of magnitude slower than  
with simple martix classes.  In addition if I loop through kronecker  
products for profiling (taking the example from Diagonal):

M1<-Matrix(0+0:5, 2, 3)
system.time(for(i in 1:1000){
M<-kronecker(Diagonal(3), M1)})

  I (occasionaly) get the warning:

Warning message:
Ambiguous method selection for "kronecker", target  
"ddiMatrix#dgeMatrix" (the first of the signatures shown will be used)
     Matrix#ANY
     ANY#Matrix
in: .findInheritedMethods(classes, fdef, mtable)

I'm using R.2.4.1 Matrix 0.9975-8 and -9 (Mac) and 2.4.0 Matrix  
0.9975-8 (Linux)

Thanks in advance,

Jarrod.



More information about the R-help mailing list