| 35 | |
| 36 | template <typename T> |
| 37 | std::vector<std::map<unsigned long, T> > mat_to_sparse ( |
| 38 | const matrix<T>& A |
| 39 | ) |
| 40 | { |
| 41 | std::vector<std::map<unsigned long,T> > temp(A.nr()); |
| 42 | for (long r = 0; r < A.nr(); ++r) |
| 43 | { |
| 44 | for (long c = 0; c < A.nc(); ++c) |
| 45 | { |
| 46 | temp[r][c] = A(r,c); |
| 47 | } |
| 48 | } |
| 49 | return temp; |
| 50 | } |
| 51 | |
| 52 | // ---------------------------------------------------------------------------------------- |
| 53 |