Boost logo

Ublas :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2007-03-08 16:58:45

I'm wondering if it would be reasonable to try to use expression templates
for some conversions between complex and various real representations.

As an example, consider the case where I have a vector of real, and I want
to interpret this as complex:

c[n] = a[2n]+ i a[2n+1]

vector_unary doesn't appear to handle this, because
         // Element access
        const_reference operator () (size_type i) const {
            return functor_type::apply (e_ (i));
doesn't feed the index 'i' to the functor.

So, my question is, would this be a reasonable thing to attempt, and what
would be the basic approach? (Assume this is one example of a related set.
Other related members would be:

* convert a pair of real vectors to complex
* convert a real vector to complex, mapping
c[n] = a[n]
Actually, we can already do that, I think.