Boost logo

Boost :

From: Stas Fomin (stas_at_[hidden])
Date: 2002-12-02 15:31:01


    Thanks for the answer!

> > I have to make matrix resize with preserving of the content of the matrix.
> > (add rows, columns...)
>
> I've just tested the following program under GCC 3.1:
>
> ----------
> #include <boost/numeric/ublas/vector.hpp>
....
>
> typedef ublas::matrix<double> Mat;

This sample works if "typedef ublas::matrix<double> Mat;"
and does not work with "typedef ublas::sparse_matrix<double,ublas::column_major> Mat";

> > 2. How to do "preserving matrix resize" efficiently?
>
> I.e. without copying/swapping? Why don't you start with your final matrix
> referencing the smaller sub matrices via matrix_range<>?

 This isn't clear to me. What do you mean?

 I write reading matrices from files in some sparsed formats (MatrixMarket, MPS).
I will implement one-pass reading, so the number of rows, columns and nonzeros
are not known in advance.
I use "sparse_matrix<double,column_major,std::map>" for fast random access,
and I will to know how implement "preserving matrix resize" efficiently.
The only way I found does not work :(.

Also I plan to use uBLAS in some linear programming algorithms,
so adding/deleting rows/columns in sparse matrices will be very desirable...

            Any ideas are welcomed...

                                Sincerely, Stas Fomin.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk