Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2006-04-20 16:18:38


On Tuesday, 18. April 2006 22:58, Russ wrote:
> I would like to contribute the following input and output operators for
> indirect_array objects (see below). Hopefully this code can be added to
> io.hpp.

I am wondering if a special IO implmentation just for indirect_array objects
is the right way to go. range and slice are already defined in the uBLAS
documentation as models of an STL Revisible Container. I think indirect_array
would also be modeled as such.

Since Revisible Container provides enough functionality to write generic IO
functions. One could therefore right a generic formated stream reader and
writter for these containers and them simply tie them simply provide operator
<< and >> overloads for the types.

> In addition, I would like to ask a quick question...
>
> Background: I am trying to write some code that performs a similar
> operation to the Matlab find() function - e.g. returns row and column
> indices of non-zero matrix elements. The indirect_array class seems ideal
> for storing the indices, since in addition to normal array properties, they
> can also be used to create a matrix_vector_indirect proxy object. However,
> I appreciate that the indirect_array class is undocumented and its future
> is unknown.
>
> Is there any reason why there is no resize() method for the indirect_array
> templated class? Would anyone mind if I added one?
I think resize() would be nice BUT. To be consistent with people expectations
it might be good to go all the way and define insert and erase operations.

> I propose that the size_
> attribute is removed, and that the array size is determined as the
> data_.size(). New resize() methods would call data_.resize().
Sound good.

> If the resize() method were added then it would be possible define a free
> function that returns info about the non-zero elements as follows:
>
> template< class M, class IA >
> void Find( M Matrix, IA &RowIndices, IA &ColIndices )
>
> where IA = indirect_array<>. The Find function could then resize the
> indirect_arrays to the number of non-zero elements found in M.

We will need to find a place to but all these non BLAS free functions :-)

Michael

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________