Let's say I have a matrix that is sparse, except for blocks along the diagonal (of a fixed size).
Eigen::SparseMatrix<float> lhs;
lhs is approximately 2% non-sparse, but may be very large. Then, let's say I have a vector:
Eigen::MatrixXf rhs = Eigen::MatrixXf::Random(SomeSz, 1);
For the moment, let's assume it's dense.
I want to efficiently compute:
result.noalias() = lhs * rhs;
If I was to compile with -O3 -march=native -mtune=native (with Clang), would this produce an optimal result?
Also, what if rhs was sparse:
Eigen::SparseMatrix<float> rhs; rhs.resize(SomeSz, 1); rhs.reserve(SomeSz/SomeFactor);
Is:
result = lhs * rhs;
still optimal/suboptimal?
I guess what I'm asking is whether or not Eigen will take advantage of the block-sparse structure and only perform the necessary computations.