|
Ublas : |
Subject: Re: [ublas] Matrix with vector interface.
From: Gunter Winkler (guwi17_at_[hidden])
Date: 2012-09-17 15:25:45
Hello,
Am Monday 17 September 2012 schrieb Joaquim Duran:
> Dear all,
>
> My name is Joaquim Duran. I'm new to this mail list.
>
> I'm using ublas for signal processing and I'm interested that the
> matrix have a similar interface to a vector, using a proxy, to apply
> algorithms designed for vectors. To get an idea, if the element of a
> vector is a double, then the element of a row facade is a column. If
> this possible to get this behavior using existing proxies?
Why not using a set of vectors and a matrix view of them?
ublas::generalized_vector_of_vector<
double,
ublas::column_major,
ublas::vector<ublas::vector<double> > > gvov;
this class has a data() function which returns a reference to the
storage array (which is a vector<vector<double> >)
So you could use gvov.data().begin() as an iterator of vectors.
(Additionally you get a very fast swap() of column references compared
to swapping all the elements)
Alternatively you could sort the indices of the columns instead of the
real columns and use the ublas::matrix_indirect view for further
computations.
mfg
Gunter