Closed pablo-rodr-bio2 closed 3 years ago
This is not a problem; the sign of the singular vectors is not identifiable. If we were to reconstruct the matrix from the decomposition, you would see that you get the same result as the negatives cancel out:
library(BiocSingular)
set.seed(123)
m <- matrix(sample.int(10, 25, T), 10, 10)
x2 <- runSVD(m[1:2, ], k=2)
x3 <- runSVD(m[1:2, ], k=2, BSPARAM=RandomParam())
# Both these things give me the same result:
x2$u %*% diag(x2$d) %*% t(x2$v)
x3$u %*% diag(x3$d) %*% t(x3$v)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
## [1,] 3 5 9 5 3 3 5 9 5 3
## [2,] 3 3 3 4 8 3 3 3 4 8
Oh, I see, sorry for the issue then, closing it
I was trying to use
runSVD()
withRandomParam()
on a very large dataset in a HDF5Array. Before that, I did some tests to see how could values change between this andbase::svd()
, but it turns out everytime I useRandomParam()
I get results on the first column of $u and $v with its values inverted, don't know if this is intended.This are the results I get:
The values of
x3$u[,1]
andx3$v[1,]
are inverted.