I want to compare two Eigen::SparseMatrix
There are exists res.isApprox(ans)
method but unfortunately it fail with assertion in case of different sparsity pattern, as far as i know
AffineInvariantDeformerTest01: Eigen/src/SparseCore/SparseMatrix.h:934: void Eigen::internal::set_from_triplets(const InputIterator&, const InputIterator&, SparseMatrixType&, DupFunctor) [with InputIterator = __gnu_cxx::__normal_iterator<Eigen::Triplet<double, int>*, std::vector<Eigen::Triplet<double, int>, std::allocator<Eigen::Triplet<double, int> > > >; SparseMatrixType = Eigen::SparseMatrix<double, 0, int>; DupFunctor = Eigen::internal::scalar_sum_op<double, double>]: Assertion `it->row()>=0 && it->row()<mat.rows() && it->col()>=0 && it->col()<mat.cols()' failed.
I want it for unit tests so it's ok if it will be not so fast. Probably i can transform my sparse matrices to dense, but i hope that there are exist more elegant solution
EDIT: Just a method which can compare sparsity patterns of two matrices is ok for me too