Skip to content

Matrix package: writeMM

2 messages · Jose Quesada, Douglas Bates

#
Hi,

I'm finding that readMM() cannot read a file written with writeMM().  
Example:

library(Matrix)
a = Matrix(c(1,0,3,0,0,5), 10, 10)
a = as(a, "CsparseMatrix")
writeMM(a, "kk.mm")
b = readMM("kk.mm")

Error in validObject(.Object) : invalid class "dgTMatrix" object: all row  
indices must be between 0 and nrow-1

Thoughts?

Thanks,
-Jose
2 days later
#
On 5/15/07, Jose Quesada <quesada at gmail.com> wrote:
You're right (and thanks for including a reproducible example).  The
writeMM function is writing 0-based indices when they should be
1-based.  Thanks for bringing this to our attention.  It's rather
embarrassing that we didn't create such a test and discover it for
ourselves.

This will be fixed in the next release.