Boost logo

Boost :

From: Kresimir Fresl (fresl_at_[hidden])
Date: 2002-03-27 15:53:04


Hi Joerg,

>>I am afraid that I found a bug in the implementation of this
>>assignment:

> I simply shouldn't tell you, how the software is supposed to work ;-)

Well, someone said that all errors are results of checking
and controls.

>> std::vector<double> storage (8); // ;o)
>> numerics::array_adaptor<double> aa (8, &storage[0]);

> Funny.

;o)

> You're right. I've changed the code in numerics::vector<>::clear and
> numerics::matrix<>::clear to use std::fill instead. The change is checked in
> already.

I noticed that you didn't change `vector_of_vector<>::clear()',
which also calls `clear()' of inner array. But it works anyway
with `std::vector< std::vector<> >. I am puzzled.

> OTOH, our current
> sparse_vector is interesting, because it can be used in conjunction with
> std::map :-).

Yes, I know. Even tried it ;o)

> So two questions arise:
> - should we eliminate the superfluous non_zero for sparse_vector?

IMHO no. It's good to have uniform interface. But in the case of the
`sparse_vector<>' some default value can be provided.

> - should we rename sparse_vector and/or compressed_vector?

They seem fine to me.

I have one more suggestion. There is
`sparse_vector_of_sparse_vector<>' as a kind of sparse matrix.
But I think there should also be `vector_of_sparse_vector<>'.
At least in my field (structural analysis) sparse matrices always
have at least one non-zero element in each row -- therefore
there is no need for outer vector to be sparse. And dense
vector can provide faster access to rows. (I didn't peruse
the code of `sp_vec_of_sp_vec'. Maybe it is already possible
to use dense vector despite the name?)

Sincerely,

fres


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