
Ublas : 
From: Gunter Winkler (guwi17_at_[hidden])
Date: 20070417 16:49:13
Am Dienstag, 17. April 2007 20:14 schrieb Neal Becker:
> Any clue about the feasibility of making the ublas functions
> real/imag into lvalues, so we could say:
>
> real (z) = w
> where z is a vector<complex> and w is vector<double>, for example
The difference between range(M, i, k) and real(M) is that the first is a
proxy and the second is just a simple expression template. In order to
get such assignments work you have to create a (mutable) proxy class
like range() instead of the current vector_unary. Maybe you extend
vector_unary to a mutable_vector_unary by adding some nonconst
methods.
Alternatively you can try to do something like the noalias() proxy,
which essentially maps operator=() to assign() such that your proxy
maps operator=() to some real_assign(). (This may be work by simply
adding scalar_real_assign similar to scalar_plus_assign and using
vector_assign<scalar_real_assign>(x,y) )
mfg
Gunter
PS: What about reinterpreting z.data() as nby2 dense rowmajor matrix
and using the column proxy?
(note to myself: this would be a nice example of matrix, array_adaptor
and column.)