Using Eigen 3.2.1
, I am trying to save an Eigen::DiagonalMatrix
in MarketIO
format as below:
#include <Eigen/Sparse>
#include <Unsupported/Eigen/SparseExtra>
using namespace Eigen;
...
size_t n = XX;
DiagonalMatrix<num_t, Dynamic> W(n);
...
saveMarket(W, "W.txt"); // error propagates from here
However, I am getting the following error:
MarketIO.h|236|error: 'const class Eigen::DiagonalMatrix<double, -1>' has no
member named 'nonZeros'
What is the problem here? Is this implemented at all for Diagonal Matrices
?
Thanks in advance for any help.
Okay! The only solution for now with minimal effort is to use the following:
saveMarketVector(W.diagonal(), "W.txt");