|
Ublas : |
Subject: Re: [ublas] [Boost-ublas] How to use stateful functors in ublas expression
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2011-09-15 07:47:43
Hi,
I don't have a rationale for this, but maybe you can find another type of
expression which fits your needs? For functions like pow(v,3.5) you might
use the ublas::vector_binary_scalar1 as the base type.
Greetings,
Oswin
> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: Oswin.Krause_at_[hidden]