Bioconductor / DelayedArray

A unified framework for working transparently with on-disk and in-memory array-like datasets
https://bioconductor.org/packages/DelayedArray
24 stars 9 forks source link

DelayedArray crossprod with first vector argument doesn't work properly #95

Closed LTLA closed 1 month ago

LTLA commented 3 years ago
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
hpages commented 1 month ago

Sorry for missing this. This issue seems to have disappeared in recent versions of DelayedArray, probably after some significant refactoring of the base code that I did in last February. Also unit tests of these operations were improved.