Boost logo

Ublas :

From: Anindha Parthy (anindha_at_[hidden])
Date: 2007-04-20 23:15:04


Hi All,

Is there a way I can efficiently resize ublas sparse matrices, whilst
preserving the contents of the matrix?

I wish to use ublas sparse matrices for an application where the
matrix is growing in size every operation.

For example:

matrix is 0x0 initially

while (more data)
   Increase number of rows and columns by 4
   Append to the matrix
   Perform computations
end

The only way I can think of to do this is to call resize every time I
need a bigger matrix.

Looking through the code, it seems that preserving the contents of the
matrix is not implemented.

i.e. M.resize(size,size, true);

gives the following error:

Assertion failed in file
/usr/include/boost/numeric/ublas/matrix_sparse.hpp at line 347:
!preserve
terminate called after throwing an instance of
'boost::numeric::ublas::internal_logic'
  what(): internal logic
Aborted (core dumped)

Thank you,

Anindha Parthy