$include_dir="/home/hyper-archives/ublas/include"; include("$include_dir/msg-header.inc") ?>
From: Jon Pearce (j.pearce_at_[hidden])
Date: 2005-06-01 00:43:30
Dear All,
The current implementation of ublas::indirect_array appears to implicity 
treat an empty index set as "the set of all indices".
In the following implementation of indirect_array::preprocess(), the 
call to indirect_array::all() returns a static, default-constructed 
instance, hence which has an empty set of indirection indices:
[ublas/storage.hpp line 1554]
        BOOST_UBLAS_INLINE
        indirect_array preprocess (size_type size) const {
            if (*this != all ())
                return *this;
            indirect_array ia (size);
            for (size_type i = 0; i < size; ++ i)
               ia (i) = i;
            return ia;
        }
It appears to me that this definition results in an inconsistency. 
Introducing some variable names...
    typedef ublas  ublas::vector<double> vector_type;
    vector_type v(100);
    ublas::indirect_array< > indices1 = ... , indices2 = ... ;
    ublas::vector_indirect<vector_type> view1(v, indices1), view2(v, 
indices2);
... IMHO the following would make a sensible invariant:
    "[indices1.size() < indices2.size()]  implies  [view1.size() < 
view2.size()]"
Currently, this relationship does not necessarily hold if 0==size(indices1).
I would be grateful for any comments. In particular
* Does anyone else see this as a problem?
* Would it be a good idea to modify the current implementation? (Does 
anyone currently rely on the default behaviour, such that they would be 
affected by a change)
Many thanks in advance
Jon Pearce