Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-03-21 11:27:52


Hi Andreas,

On Monday 21 March 2005 11:36, Andreas Klöckner wrote:
> Karl Meerbergen schrieb:
> > Perhaps, we should not allow to bind a compressed_matrix that is not
> > fully built up. For Direct solvers codes, this makes sense, because if
> > there is a row or column without elements, the matrix is singular.
>
> True. On the other hand, UMFPACK deals with singular matrices to some
> extent. Also, an all-zero column or row is (in theory) no problem for an
> eigensolver. I don't think we should preclude the use of this type of
> matrix.
>
> > In this situation, we only assert on the completeness of the matrix,
> > rather than modifying it.
>
> I agree that modifying a const parameter is problematic. We might make
> the completion method non-const and require the user to call it before
> using bindings code. Then the bindings code could just assert
> completeness, as you suggest. I will submit an updated patch.

I've had a quick look at the code and you patch. With regard to the original
patch "compressed_matrix<>::complete_index1_array()" must be implemented as a
non const member or index1 must be made mutable. Casting away the constness
had undefined behaviour unless the the instance is know to be non const!
My preference would be to make it a non const member as I see no reason for it
to be logically const.

Also you previously mentioned

> I'm slightly biased towards the innate invariant, I must say.

I think I agree with this! It might be more helpful to implement compressed
using the invariant that the index array is always complete. This may
actually simplify the code.

Michael