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 -- Jose Quesada, PhD. http://www.andrew.cmu.edu/~jquesada
On 5/15/07, Jose Quesada <quesada at gmail.com> wrote:> 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-1You'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.
Maybe Matching Threads
- Matrix library error: "should never happen; please report"
- %*% in Matrix objects
- Matrix: How create a _row-oriented_ sparse Matrix (=dgRMatrix)?
- [fixed] vectorized nested loop: apply a function that takes two rows
- [fixed] vectorized nested loop: apply a function that takes two rows