29 #ifndef DINAMICA_COMPILEDDA_T_H_ 30 #define DINAMICA_COMPILEDDA_T_H_ 57 template<
class T> std::vector<T>
compiledDA::eval(
const std::initializer_list<T> l)
const{
70 std::vector<T> res(dim);
71 eval(std::vector<T>(l), res);
76 template<
class T> std::vector<T>
compiledDA::eval(
const T args[],
const unsigned int length)
const{
87 std::vector<T> arg(args,args+length);
88 std::vector<T> res(dim);
102 std::vector<T> args(1);
103 std::vector<T> res(dim);
118 template<
class T>
void compiledDA::eval(
const std::vector<T> &args, std::vector<T> &res)
const{
119 const unsigned int narg = args.size();
120 unsigned int jlskip = ord+1;
122 T *xm =
new T[ord+1];
125 xm[0] = args[0]*0.0 + 1.0;
127 for(
unsigned int i=0; i<dim; i++, p++)
128 res[i] = args[0]*0.0 + (*p);
130 for(
unsigned int i=1; i<terms; i++){
131 unsigned int jl = (
unsigned int)(*p); p++;
132 unsigned int jv = (
unsigned int)(*p)-1; p++;
145 xm[jl] = xm[jl-1]*args[jv];
146 for(
unsigned int j=0; j<dim; j++, p++)
147 if((*p)!=0.0) res[j] += xm[jl]*(*p);
Definition: AlgebraicMatrix.cpp:39
std::vector< T > evalScalar(const T &arg) const
Evaluate the compiled polynomial with a single variable of arithmetic type and return vector of resul...
Definition: compiledDA_t.h:94
V eval(const V &args) const
Evaluate the compiled polynomial with a vector of any arithmetic type and return vector of results...
Definition: compiledDA_t.h:40