vkostyukov / la4j

Linear Algebra for Java
http://la4j.org
Apache License 2.0
371 stars 109 forks source link

CCSMatrix not serializable #264

Closed astanway closed 8 years ago

astanway commented 8 years ago
CCSMatrix sparseColumnMatrix = new CCSMatrix(5, 5);
File file = new File("matrix.bin");
FileOutputStream fop = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fop);
oos.writeObject(sparseColumnMatrix);

gets

java.io.NotSerializableException: org.la4j.matrix.sparse.CRSMatrix
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)

Also fails on CRSMatrix. Any ideas? Is serialization not supported for sparse matrices?

vkostyukov commented 8 years ago

It should definetelly work. Mind opening a PR with a fix? Sorry I not involved in la4j any rather than merging PRs and releasing new versions.

vkostyukov commented 8 years ago

Oh, I'm now thinking it shoundn't be serializible: it's been a while I was looking at the source code. You could do:

CCSMatrix m = new CCSMatrix(5, 5);
byte[] array = m.toBinary();
astanway commented 8 years ago

Thanks - although, that won't tell me how much space the sparse matrix itself takes up, which is what I'm trying to measure :/

On Fri, Dec 18, 2015 at 3:04 PM, Vladimir Kostyukov < notifications@github.com> wrote:

Oh, I'm now thinking it shoundn't be serializible: it's been a while I was looking at the source code. You could do:

CCSMatrix m = new CCSMatrix(5, 5);byte[] array = m.toBinary();

— Reply to this email directly or view it on GitHub https://github.com/vkostyukov/la4j/issues/264#issuecomment-165886066.

Abe Stanway abe.is