[Rd] wrong matrix dimension in sparseQR
Serguei Sokol
sokol at insa-toulouse.fr
Thu Jan 18 16:13:43 CET 2018
Hi,
I came across a case when the dimensions of matrices returned by qr()
operated on a sparse matrix does not coincide with the initial matrix.
Here is a spinet code that should produce an example (one of many that I could provide):
m=205
n=199
set.seed(7);
a=matrix(rnorm(m*n), m, n)
a[sample(seq(m*n), m*(n-4))]=0
a=as(a, "Matrix")
qa=qr(a);
stopifnot(nrow(qa at R) == m)
# On my box I have nrow(qa at R):=207 while should be 205 as m is)
Note that for m=203 and n=197, the same code produce right (i.e. coinciding) dimensions.
Have I missed something?
Serguei.
> R.version
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 4.3
year 2017
month 11
day 30
svn rev 73796
language R
version.string R version 3.4.3 (2017-11-30)
nickname Kite-Eating Tree
More information about the R-devel
mailing list