Boost logo

Ublas :

Subject: Re: [ublas] beginners question
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-01-08 09:42:15

Hello David,

I think Thomas answered most of your question. However, a function that is
in the making is "at", which would allow index-based access to vectors,
matrices, etc., of any type.

at( v, 2 ) = 2.0;
at( v, 2, 0 ) = 2.0; // transparently the same as above
at( m, 1, 4 ) = 5.0;

The stuff you are probably referring to would be something like

int idx[3] = { 0, 3, 6 };
some_op( columns( a, idx ) )

however, this is not directly supported by any algorithm in use by the
bindings (e.g., not supported by BLAS or LAPACK). In case of BLAS, my
suggestion would be to check if the costs of swapping the data and having
level 3 blas outweighs doing a number of level 2 calls.

Hope this helps,


David Bellot wrote:
> Hi everybody,
> I was wondering where I could find some documentation about the new traits
> system and what it brings compared to previous versions (<= 1.40).
> Does it mean for example that I can have a vector<bool> (ublas:: or std::)
> and index a matrix with something like my_matrix(my_boolean_vector,
> range(0,my_matrix.size2()) ?
> OK, I'm kidding but the real question is similar: does the new traits
> system allow to manipulate, it's my Holy Grail, matrices like I do in
> matlab ? Being able to address a matrix with vectors, matrices, the famous
> ':' operator, etc...
> Any pointer to a documentation would be most appreciated.
> Thanks for making this great library.
> Best Regards,
> David