Greetings users, Anyone know how to convert a matrix<int> to a compressed_vector<int> using the boost/numeric/ublas/ library? Here is a code snippet: #include <boost/numeric/ublas/matrix.hpp> #include <boost/numeric/ublas/io.hpp> using namespace boost::numeric::ublas; using namespace std; #include <fstream> int A=2000; int D=2000; int main() { matrix<int> ADf(A,D); //Author-Document (full) fstream IN; IN.open("./eoh_ADf"); for(unsigned i=0;i<ADf.size1();++i) { for (unsigned j=0;j<ADf.size2();++j) { IN>>ADf(i,j); } } IN.close(); cout<<ADf<<endl; return 0; } I badly need to convert the matrix ADf into sparse form... Isn't there some function to convert ADf into ADs (AD sparse)? i.e. ADs=sparse(ADf)... Let's say ADf isn't a 2000x2000, but simply a 5x5: ADf=[[1,-1,0,-3,0],[-1,5,0,0,0],[0,0,4,6,4],[-3,0,6,7,0],[0,0,4,0,-5]] I want this converted to: values = [1 -1 -3 -2 5 4 6 4 -4 2 7 8 -5] columns = [1 2 4 1 2 3 4 5 1 3 4 2 5] rowIndex = [1 4 6 9 12 14] Any help that users can offer me would be much appreciated. Thanks in advance, Eamorr