I'm pretty inexperienced in such things, but I'm trying to create a template function that evaluates a n-variable function at "rotated" argument (see example below) and returns a vector of all these values.
For example for n=3 with a function f(x,y,z) the returned triple\vector should be
< f(x,0,0), f(0,x,0), f(0,0,x) >
The naive version of what I need could look like the following (not necessary correct\working)
typedef FunctionSignature Function;
template<class Function, size_t Dimensions>
std::array<Function::Out,Dimensions> F(Function::InComponent x)
{
std::array<Function::Out,Dimensions> Result;
for (i=0; i<Dimensions; i++)
Result[i] = Function::f("rotate((x,0,...,0),i)");
return Result;
}
But how to make the rotate
thing.
I also hope that the run-time for
could be somehow be eliminated since n
is well known in time of compilation.