14 std::shared_ptr<OrthogonalPolynomial> OrthogonalPolynomial::Construct(std::string
const& polyName)
16 return std::dynamic_pointer_cast<OrthogonalPolynomial>(IndexedScalarBasis::Construct(polyName));
20 double OrthogonalPolynomial::Normalization(
unsigned int polyOrder)
const {
22 std::string rawName =
typeid(*this).name();
27 std::unique_ptr<char, void(*)(
void*)> res {
28 abi::__cxa_demangle(rawName.c_str(), NULL, NULL, &status),
32 std::string className = (status==0) ? res.get() : rawName;
34 throw muq::NotImplementedError(
"The Normalization function has not been implemented for the class \"" + className +
"\". Is this polynomial family orthogonal?");
36 return std::numeric_limits<double>::quiet_NaN();
39 double OrthogonalPolynomial::BasisEvaluate(
int const order,
double const x)
const {
53 for(
int k=order-1;
k>=0;
k-- ) {
57 alpha = ak(
k+1)*x + bk(
k+1);
59 yk = alpha*yk1 + beta*yk2;
62 return yk1*phi1(x) + beta * phi0(x)*yk2;
66 Eigen::VectorXd OrthogonalPolynomial::EvaluateAllTerms(
int const maxOrder,
67 double const x)
const {
69 Eigen::VectorXd output(maxOrder+1);
74 for(
int i=2; i<=maxOrder; ++i)
75 output(i) = (ak(i)*x + bk(i))*output(i-1) - ck(i)*output(i-2);
Class for virtual base functions that are not implemented.