This forum has been archived. All content is frozen. Please use KDE Discuss instead.

STD bad_alloc when permuting matrix columns

Tags: None
(comma "," separated)
satyap
Registered Member
Posts
2
Karma
0
Hi,
I am trying to permute large sparse matrix, program aborts with std::bad_alloc, it works for smaller dimensions, unable to figure out the problem

Code: Select all
   typedef Eigen::SparseMatrix<double, Eigen::ColMajor, std::ptrdiff_t>
    SparseMatrix;
   
    SparseMatrix G; // Very large matrix 760000 X 560000
    qrSolver.compute(G); // Using SuiteSparse QR


     SparseMatrix permutedMatrix = G *  qrSolver.colsPermutation(); // Runtime failure std::bad_alloc

Edit:
It is failing at SparseMatrix.h --> reserveInnerVectors --> m_data.reserve(totalReserveSize);
Trying to reserve 426,182,269,500 bytes! (totalReserveSize = 426182269500)!

How can I overcome this?
I am basically trying to convert rank deficient matrix to full column rank matrix

Thanks
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
What about G.nonZeros() ?
satyap
Registered Member
Posts
2
Karma
0
G.nonZeros() = 2352081.

I have debugged further and this line at

SparsePermutation.h -->
sizes[((Side==OnTheLeft) ^ Transposed) ? jp : j] = m_matrix.innerVector(((Side==OnTheRight) ^ Transposed) ? jp : j).size();

always returns the row size of matrix, so sizes[] object has same number (row size) in all cells.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
grado
Registered Member
Posts
1
Karma
0
Great. I have the same problem. Thank you


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]