Registered Member
|
Hi all,
I've been working with large sparse non-symmetric matrices (see code below). I've tried both the 3.1.0-alpha2 release and the current development version and I get an assertion error in the SparseMatrix class. To give you an idea of the size of my problem domain. I have a 1.7M by 15k matrix W with 31129603 non-zero entries and would like to do: A = W * W^T and keep the upper triangle. Any help is greatly appreciated. Thanks, Dominik ------------- #include <string> #include <vector> #include <Eigen/SparseCore> typedef Eigen::SparseMatrix<int32_t, Eigen::RowMajor> SparseMatrixType; typedef Eigen::Triplet<int32_t> T; int main(int argc, char* argv[]) { SparseMatrixType mat(1700000, 15000); std::vector<T> tripletList; tripletList.reserve(100000); // read from file and push into tripletList mat.setFromTriplets(tripletList.begin(), tripletList.end()); SparseMatrixType result = (mat*mat.transpose()).pruned().triangularView<Eigen::StrictlyUpper>(); return 0; } I get this assertion error: assertion failed: size_t(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)" in function typename Eigen::internal::traits<Eigen::SparseMatrix<_Scalar, _Options, _Index> >::Scalar& Eigen::SparseMatrix<_Scalar, _Flags, _Index>::insertBackByOuterInner(typename Eigen::internal::traits<Eigen::SparseMatrix<_Scalar, _Options, _Index> >::Index, typename Eigen::internal::traits<Eigen::SparseMatrix<_Scalar, _Options, _Index> >::Index) [with _Scalar = int, int _Options = 6, _Index = int] at /home/dahlemd/software/Eigen-devel/Eigen/src/SparseCore/SparseMatrix.h:386 |
Moderator
|
As a workaround, does the following work:
SparseMatrixType result = (mat*mat.transpose()).pruned().eval().triangularView<Eigen::StrictlyUpper>(); |
Registered Member
|
Hi ggael,
thanks for your response. I'm afraid though that this did not solve it either. I'm wondering whether this line mat.setFromTriplets(tripletList.begin(), tripletList.end()); requires the tripletList to be sorted according to row and column indeces? Could that be the underlying problem? Thanks, Dominik |
Registered Member
|
Hi,
to answer the question on whether the triplet list needs to be sorted, it turns out that sorting it results in the same assertion error. Any other pointers are greatly appreciated. Thanks, Dominik |
Moderator
|
Could you post the backtrace? Also make sure you are using the devel branch (this issue might have been solved since alpha2).
|
Registered Member
|
I downloaded the devel branch off the website on May the 19th: http://bitbucket.org/eigen/eigen/get/default.tar.bz2
The backtrace is as follows: #0 0x0000003d9a230265 in raise () from /lib64/libc.so.6 #1 0x0000003d9a231d10 in abort () from /lib64/libc.so.6 #2 0x0000000000405403 in Eigen::internal::assert_fail ( condition=0x40f3b0 "size_t(m_outerIndex[outer+1]) == m_data.size() && \"Invalid ordered insertion (invalid outer index)\"", function=0x4120c0 "typename Eigen::internal::traits<Eigen::SparseMatrix<_Scalar, _Options, _Index> >::Scalar& Eigen::SparseMatrix<_Scalar, _Flags, _Index>::insertBackByOuterInner(typename Eigen::internal::traits<Eigen::"..., file=0x40f040 "/home/dahlemd/software/Eigen-devel/Eigen/src/SparseCore/SparseMatrix.h", line=386) at /home/dahlemd/software/Eigen-devel/Eigen/src/Core/util/Macros.h:208 #3 0x0000000000402509 in Eigen::internal::sparse_sparse_product_with_pruning_impl<Eigen::SparseMatrix<int, 0, int>, Eigen::Transpose<Eigen::SparseMatrix<int, 1, int> >, Eigen::SparseMatrix<int, 6, int> > (lhs=..., rhs=..., res=..., tolerance=0) at /home/dahlemd/software/Eigen-devel/Eigen/src/SparseCore/SparseMatrix.h:386 #4 0x0000000000404291 in evalTo<Eigen::SparseMatrix<int, 6, int> > ( argc=<value optimized out>, argv=<value optimized out>) at /home/dahlemd/software/Eigen-devel/Eigen/src/SparseCore/SparseSparseProductWithPruning.h:106 #5 operator=<Eigen::SparseMatrix<int, 0, int>, Eigen::Transpose<Eigen::SparseMatrix<int, 1, int> > const> (argc=<value optimized out>, argv=<value optimized out>) at /home/dahlemd/software/Eigen-devel/Eigen/src/SparseCore/SparseProduct.h:176 #6 operator=<Eigen::SparseMatrix<int, 0, int>, Eigen::Transpose<Eigen::SparseMatrix<int, 1, int> > const> (argc=<value optimized out>, argv=<value optimized out>) at /home/dahlemd/software/Eigen-devel/Eigen/src/SparseCore/SparseMatrix.h:623 #7 SparseMatrix<Eigen::SparseSparseProduct<Eigen::SparseMatrix<int, 0, int>, Eigen::Transpose<Eigen::SparseMatrix<int, 1, int> > const> > ( argc=<value optimized out>, argv=<value optimized out>) at /home/dahlemd/software/Eigen-devel/Eigen/src/SparseCore/SparseMatrix.h:575 #8 eval (argc=<value optimized out>, argv=<value optimized out>) at /home/dahlemd/software/Eigen-devel/Eigen/src/SparseCore/SparseMatrixBase.h:462 #9 main (argc=<value optimized out>, argv=<value optimized out>) at project.cc:53 where project.cc:53 is: SparseMatrixType result = (mat*mat.transpose()).pruned().eval().triangularView<Eigen::StrictlyUpper>(); |
Moderator
|
I cannot reproduce:
Could you save your matrix in market format: #include <unsupported/Eigen/SparseExtra> ... Eigen::saveMarket(mat,"test.mtx"); and find a way to send me a zip? |
Registered Member
|
Thanks to Gael for pointing out that the result of this computation yields a dense matrix, which is prohibitive to compute.
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell