0
votes

In my application, I want to obtain the left singular vectors from a given data matrix with double entries, which is given in the code as

Eigen::MatrixXd m;

and has dimensions 45 x 904140. Now I use the constructor for the SVD decomposition in the Eigen library as below

Eigen::BDCSVD<Eigen::MatrixXd> svd(m, Eigen::ComputeFullU | Eigen::ComputeFullV);

and there, a bad alloc exception is thrown, more precisely:

Unhandled exception at 0x00007FFA058850D8: Microsoft C++ exception: std::bad_alloc at memory location
1
Can you put the full error in your question - Geno C
@GenoC I did now. - MPB94
Computing the full V matrix requires a 904140*904140 double matrix (which would take almost 6TiB). Do you actually need the full V, or would Eigen::ComputeThinV suffice? - chtz
@chtz Thin SVD would mean that V has dimension 9044140x45 in this case, right? I would like to use the columns of V to span a subspace of particular size, in my application, 67. That's why I used the full SVD instead, as I would only get a subspace of 45 with thin SVD. - MPB94

1 Answers

2
votes

The error std::bad_alloc usually means there is not enough memory to complete your task.

You might not be able to compute the matrix that requires a 904140 x 904140 on your machine.