I'm not sure I understand what you want to achieve with stateful functors ?
If for example you want to do some statistics on vectors or matrices, I could recommend using Boost.Accumulators

On Thu, Sep 15, 2011 at 10:27, <dariomt@gmail.com> wrote:
Hi all,

In my post "How to use function calls in ublas expression" [1] I was redirected to [2] which was very useful.

Now I can write code like this withput creating unnecessary temporaries

ublas::vector<double> x, y, z, w;
x = y + ublas::apply_to_all( z, functor::log<double>() ) + w;

But after looking into ublas code I found out that the template machinery ends up calling the static function apply() of the functor, making it impossible to use stateful functors in the expressions.

My question is: does anyone know the rationale for this decision? I would expect that allowing stateful functors and calling their operator() member function (like in STL) would make ublas much more extendable.

Thanks!

[1] http://boost.2283326.n4.nabble.com/Boost-ublas-How-to-use-function-calls-in-ublas-expression-tt2711515.html#a2711519

[2] http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Examples_-_How_To_Extend_UBLAS


_______________________________________________
ublas mailing list
ublas@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: david.bellot@gmail.com