MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ power_sum()

double MayaFlux::Nodes::Generator::Polynomial::power_sum ( const std::vector< double > &  coefficients,
double  x 
)
staticprivatenoexcept

Evaluates the coefficient list at x, highest power first.

Parameters
coefficientsCoefficient vector
xEvaluation point
Returns
Sum of coefficient * x^k, accumulated from the last coefficient

The one loop behind create_polynomial_function and the live DIRECT evaluation of a node built from coefficients.

Definition at line 230 of file Polynomial.cpp.

231{
232 double result = 0.0;
233 double x_power = 1.0;
234
235 for (double coefficient : std::ranges::reverse_view(coefficients)) {
236 result += coefficient * x_power;
237 x_power *= x;
238 }
239
240 return result;
241}

Referenced by create_polynomial_function(), and process_sample().

+ Here is the caller graph for this function: