BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
fn_polyval.hpp File Reference

Evaluates a polynomial. More...

#include "typedefs.hpp"
#include "assert.h"
#include "cl_Vector.hpp"
Include dependency graph for fn_polyval.hpp:

Go to the source code of this file.

Namespaces

namespace  belfem
 USER GUIDES:

Functions

template<typename T>
belfem::polyval (const Vector< T > &aCoeffs, const T aX)
 Evaluates a polynomial at one point, by Horner's scheme.
template<typename T>
void belfem::polyval (const Vector< T > &aCoeffs, const Vector< T > &aX, Vector< T > &aY)

Detailed Description

Evaluates a polynomial.

Coefficient order is descending: aCoeffs(0) is the coefficient of the highest power and the last entry is the constant term, so a vector of length n+1 describes a polynomial of degree n. This is the convention Armadillo and MATLAB use, and it is the opposite of the ascending order some other libraries take. Getting it backwards produces a plausible-looking wrong answer rather than an error.