Boost logo

Ublas :

Subject: [ublas] Matrix with vector interface.
From: Joaquim Duran (jduran.gm_at_[hidden])
Date: 2012-09-17 05:04:54

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?

I'll detail which is the expected behavior of the proxy:

Matrix Column Proxy
-------- --------------------
begin2() begin()
end2() end()
rbegin2() rbegin()
rend2() rend()
size2() size()
resize2() resize()
*iter: double matrix_row(matrix, i)

Matrix Row Proxy
-------- --------------------
begin1() begin()
end1() end()
rbegin1() rbegin()
rend1() rend()
size1() size()
resize1() resize()
*iter: double matrix_column(matrix, i)

Example: Sort the columns of a matrix based on their module:

using namespace boost::numeric::ublas;

template <typedef Vector>
bool less_module(const Vector& v1, const Vector& v2)

     vector v1;