From: jhrwalter (walter_at_[hidden])
Date: 2002-01-24 05:32:16


--- In boost_at_y..., Kresimir Fresl <fresl_at_g...> wrote:
>
> jhrwalter wrote:
>
> > Toon Knapen <toon.knapen_at_s...> wrote:
>
> >> But another concept I'm missing, and which is in neither of the
> >> three libraries, is creating a sub-array (of the same order as
the
>
> >> array) that contains a specific selection of indices for every
>
> >> dimension of the array. e.g. in the 2D case I would like to do
>
>
> >> matrix< double > A(8,8);
> >> boost::array<3> i1 = { 0,1,6 };
> >> boost::array<5> i2 = { 5,6,7 };
> >> sub_matrix sub_A = submatrix(A, i1,i2 );
>
> >> where sub_A contains all element that are in columns 5,6 and 7
and
> >> in rows 0,1 and 6. The difference with a range is thus that this
> >> subarray is not a continuous block in the original array. The
diff with the
> >> current definition of slicing is that the selection does not
need to be
> >> strided.
>
> In 1D case this is very similar to `indirect_array' view of
`std::valarray'.
>
> >> Is there a reason this kind of subarray does not exist ?
>
> > Interesting question. Should this sub matrix support dense
matrices
> > only or sparse matrices also (the old question of genericity ;-)?
>
> Both. FEM matrices, for example, are usually sparse.

I believe, that it's difficult to estimate the complexity of
operations on such a view for sparse matrices (in other words: they
could be rather inefficient). May be we currently should be more
interested in some gather and scatter functionality for sparse
matrices.
 
Regards
 
Joerg