Re: Matrix with vector interface.

Gunter Winkler <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <[email protected]>
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.

see 
http://www.boost.org/doc/libs/1_51_0/libs/numeric/ublas/doc/html/classboost_1_1numeric_1_1ublas_1_1generalized__vector__of__vector.html

(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.

see 
http://www.boost.org/doc/libs/1_51_0/libs/numeric/ublas/doc/html/classboost_1_1numeric_1_1ublas_1_1matrix__indirect.html#_details


mfg
Gunter

_______________________________________________
ublas mailing list
[email protected]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [email protected]
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAlBXeToACgkQghsXb/J0PcF8FwCdHNLXfpGd2WGljGQMkJ8D4ZVQ
AN8AnRP2875l3hVNklw+9smb85CO10Bn
=F+ia
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.