Boost logo

Boost :

From: Stas Fomin (stas_at_[hidden])
Date: 2002-11-30 12:57:25


 I have to make matrix resize with preserving of the content of the matrix.
 (add rows, columns...)

I try to do this using matrix ranges:

----------------------------------------------
  Mat A(2,2);
  A(0,0)=11;
  A(0,1)=12;
  A(1,0)=21;
  A(1,1)=22;

  Mat _A(4,4);
  _A.project(ublas::range(0,A.size1()), ublas::range(0,A.size2())).assign(A);
/* or ublas::project(_A, ublas::range(0,A.size1()),
ublas::range(0,A.size2()))).assign(A); */
  A.swap(_A);
  std::cout << A << std::endl; /* Zero matrix shown :( */
----------------------------------------------

  Questions:
1. Why this do not work? (see examples from
http://lists.boost.org/MailArchives/boost/msg31729.php)
2. How to do "preserving matrix resize" efficiently?

                Thanks all in advance,
                                        Stas Fomin.


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