I want to gradually add sparse columns to a sparse matrix. Something like:
for ( int ieig_insert= 0; ieig_insert < 5000 ; ieig_insert++ ) {
arma::sp_vec tempVec( nSources_Total ) ; // nSources_Total ~= 60,000
createColValues( ieig_insert, tempVec ); // ~95% sparse
sp_mat.col( ieig_insert )= tempVec ;
}
Yes, I can create a temporary vector<arma::sp_vec>
to collect all the columns and then use a giant batch insertion constructor at the end, but that is inelegant. I tried the simpler approach above but it is maddeningly slow. It seems that this column insert should be efficient for CSC representation?