Boost logo

Ublas :

Subject: Re: [ublas] [Boost-ublas] How to use function calls in ublas expression
From: dariomt (dariomt_at_[hidden])
Date: 2009-06-29 10:27:07


Kim Kuen Tang <kuentang <at> vodafone.de> writes:

>
> Hi dariomt,
>
> If you really want to write code like above then you need to implement
> it by yourself.
>

<snip proto example>

It is very interesting, thanks a lot! I'll be spending some time studying this
code and learning a bit more about Proto.

> MixedOps::assign(u, 0.0);
> u+=v+w+sin(m);

I'm guessing it is possible to define operator+= but not possible to redefine
operator=. It's a pity we cannot have both to get more homogeneous code.

And one question:

Let's say my function is a function object, say

class MyFunctionObject
{
private:
    // store some state
public:
    double operator() (double x)
    {
    // using state to make it work
    ...
    }
};

MyFunctionObject f;

u += v + w + f(m);

Is there a way to make it work calling operator() for instance f at every
iteration?

Thanks again!