
Boost : 
From: boost (boost_at_[hidden])
Date: 20020430 13:36:02
Salut,
On Tuesday 30 April 2002 18:09, Toon Knapen wrote:
> Currently, the matrices can be clear()ed such that all elements are set to
> 0. I would find it even more convenient to be able to use
> operator=(some_value_type) to assign a specific value to all the entries in
> the matrix. But I figure there's some good reason one has to use clear()
> instead of operator=() ?
As fas as I understand, this is only true for raw memory, if you use
std::vector, then std::vector().clear() will be called, erasing the elements.
If I'm correct than one has to be carefull to use ublas::matrix<
std::vector<..>, ... > to interface with FORTRAN libraries, since one
must not call clear() before calling FORTRAN routines. (This question
was raised some time ago on this list).
Jörg, am I'm correct ?
Concerning your operator, one might instead define a matrix with all elements
set to 1, similar to matrix_identity, otherwise
matrix A = 2
might be confusin. I'd expect this expression to set the diagonal elements
only, while you might expect that all elements are set to 2:
Matrix A = 2 * matrix_identity;
Matrix B = 2 * matrix_all_elements_one;
Best wishes,
Peter
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk