Boost logo

Boost :

From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-12-03 02:46:06


----- Original Message -----
From: "Stas Fomin" <stas_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Monday, December 02, 2002 9:31 PM
Subject: Re: [boost] UBLAS: preserving matrix resize.

> 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";

I understand. This is probably a bug in the 1_29_0 release: I've just tested
that change against the CVS version and see the same results as in the dense
case.

> > > 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 :(.

Sorry for inconvenience. If you upgrade to the CVS version, you may also
consider to use the new coordinate_matrix implementing Fortran COO storage
layout.

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

Regards

Joerg


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