DelayedArray icon indicating copy to clipboard operation
DelayedArray copied to clipboard

DelayedArray crossprod with first vector argument doesn't work properly

Open LTLA opened this issue 4 years ago • 0 comments

library(DelayedArray)
x <- DelayedArray(matrix(rnorm(100), ncol=5))
crossprod(1:20, x)
## Error in base::crossprod(x, y) : non-conformable arguments

crossprod(1:20, as.matrix(x))
##           [,1]      [,2]     [,3]     [,4]     [,5]
## [1,] -61.31712 -15.53516 27.05484 5.563496 -38.6093

Oops. It seems like

https://github.com/Bioconductor/DelayedArray/blob/f98fafea313f1a21f3447ce15f7b20f9ff07c639/R/DelayedMatrix-utils.R#L350

should have probably been a cbind, as that works:

crossprod(cbind(1:20), x)
## <1 x 5> matrix of class DelayedMatrix and type "double":
##            [,1]       [,2]       [,3]       [,4]       [,5]
## [1,] -61.317119 -15.535165  27.054841   5.563496 -38.609304

LTLA avatar May 03 '21 07:05 LTLA