[eigen] Wasteful int type for indices in sparse matrices? |

[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]

Hi,
Sorry for the bad subject in my last mail. I was lost in thought.
Storing sparse matrices efficiently is important. Eigen2 supports the
often used compressed sparse row/column format. What I find annoying is
that the type of the indices can't be specified. For dense matrices this
is perfectly valid. But let's say I have a sparse matrix with n
coefficients. With Eigen it boils down to having a value array of size n
with Scalar type and an int array of size n. Let's assume my index
would fit in a short that consumes 2 bytes compared to an 4 byte int.
Then this wastes 2n bytes. I'm working with large sparse matrices. From
my perspective I need to be very carefully using main memory. Further
storing the indices more compact should result in better cache
behaviour. Since I can fit more into the cache, i.e. reducing cache
misses. But I'm not very sure about this, since aligned memory is also
an issue.
The most obvious solution is to introduce template arguments to set the
types of the indices.
But I'm very unsure whether this is worse the trouble. Have you thought
about this issue yet? Any ideas? Or no problem at all?
Regards,
Jens
PS:
Thanks, Gael. I have seen the MappedSparseMatrix. I will try this out in
the near future.