Boost logo

Boost :

From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-05-03 15:18:27


----- Original Message -----
From: "Victor A. Wagner, Jr." <vawjr_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, May 03, 2002 6:11 PM
Subject: Re: [boost] ublas: matrix clear() and operator=

> At Wednesday 2002/05/01 12:17, you wrote:
> >----- Original Message -----
> >From: "Toon Knapen" <toon.knapen_at_[hidden]>
> >To: <boost_at_[hidden]>
> >Sent: Tuesday, April 30, 2002 6:09 PM
> >Subject: [boost] ublas: matrix clear() and operator=
> >
> >
> > > 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.
> >
> >How would you define the semantics of such an assignment operator for
sparse
> >matrices?
>
> It seems to me the whether the matrix is implemented as a 2D array or held
> in some sparse implementation, ALL of the entries should now have
> (some_value_type).

I just realized that my last answer to Toon's question missed the main
point: in ublas matrix containers are usually dense, packed (i.e. symmetric,
hermitean, triangular, banded) or sparse. If we use a scalar assignment
operator, we could assume a matrix layout. It seems reasonable to assume a
dense layout. The main point now is, that the proposed assignment operator
is rather useless, if one assigns a non zero scalar to a sparse matrix
assuming dense matrix layout.

IOW I'd like to keep scalars, vectors and matrices separate ;-)

> As an implementation detail for the sparse representation, there is
nothing
> sacred about calling the value of an unheld entry zero(0), it could be any
> value. One possible implementation of this operator would to be to
"empty"
> the sparse cells which exist and set the "default value" appropriately.

Yes, in the zero case you're right.

Regards

Joerg


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