Registered Member
|
I need to save a number of sizable sparse matrices to disk and read them in later. To do this, I am currently generating a CCS representation of the matrix and serializing these three arrays. To reload the matrix, I load these three arrays, dump them into a sparse matrix, and call finalize.
Not that this is hard, but is there an easier way to save out the internal state of the sparse matrix so I don't have to 're-finalize'? |
Moderator
|
you could use the outerIndexPtr(), innerIndexPtr() and valuePtr() methods to directly save/store the values. For a store don't forget to allocate the buffer by calling resize(r,c) and resizeNonZeros(s)...
|
Registered Member
|
Thanks for the response! Which version of the library are the *Ptr() methods available in? I am using the 3.0.0 release and the *Ptr() methods are not available from a sparse matrix. Do I have to do something extra to access the methods?
Tschüss! |
Moderator
|
they are available in the 3.0.0 release:
inline const Scalar* _valuePtr() const { return &m_data.value(0); } inline Scalar* _valuePtr() { return &m_data.value(0); } inline const Index* _innerIndexPtr() const { return &m_data.index(0); } inline Index* _innerIndexPtr() { return &m_data.index(0); } inline const Index* _outerIndexPtr() const { return m_outerIndex; } inline Index* _outerIndexPtr() { return m_outerIndex; } however they are prefixed by a "_" because they were initially supposed to be used internally. |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora