Boost logo

Ublas :

From: James Sutherland (James.Sutherland_at_[hidden])
Date: 2008-08-13 12:29:46


I need to modify the location (column) of some elements in a sparse
matrix. I would prefer to do this through the MatrixRow directly
rather than using the "remove_element" and "insert_element" functions
on the matrix.

I would like to do something like:

   typedef compressed_matrix< double, row_major > MatType;
   MatType m( nrow, ncol, nonzeros );

   // ... build matrix m ...

   matrix_row<MatType> row( m, irow );
   row(3).index() = 1; // move column 3 to column 1.

Of course I cannot do this directly since the index() method returns a
value, not a reference. Is there another way to accomplish this using
a matrix_row object?

James