Boost logo

Ublas :

From: Harris, Chris GOSS EXT (Chris.Harris.EXT_at_[hidden])
Date: 2005-12-28 11:16:34


I am just getting started with UBLAS, using VC 7.1 Boost Version
1.32.0. I know there is a newer version version of boost. I tried it,
and it exhibits the same behavior.
 
My question is on the class matrix.
 
The documentation for resize and for construction seem to be
inconsistent. The constructor specifically states that the matrix
values are uninitialized. ( Not default constructed )
The documentation for resize states that it Reallocates a matrix to hold
size1 rows of size2 elements. The existing elements of the matrix are
preserved when specified.
 
Under the The Matrix concept
    The sizing constructor does not mention whether values are default
initialized or not.
 
    Resize will
    Reallocate the matrix so that it can hold n1 rows and n2 columns.
    Erases or appends elements in order to bring the matrix to the
prescribed size. Appended elements are value_type() copies.
    When p == false then existing elements are not preserved and
elements will not appended as normal. Instead the matrix is in the same
state as that after an equivalent sizing constructor.
 
So if I use the constructor values are not default initialized. If I
use the resize new values may or may not be default initialized,
depending on if I wish to preserve old values.
 
Maybe matrix should behave like std::vector and always default
initialize its values.
 
 
Thank you
 
Chris Harris