28 template <
typename ScalarT>
29 void func(ScalarT& f,
const ScalarT&
x) {
33 int main(
int argc,
char **argv)
45 for (
int k=0; k<deg; k++) {
56 std::cout <<
"Taylor series solution = " << std::endl
67 std::cout <<
"Exact expansion = " << std::endl
73 for (
int k=0; k<=deg; k++) {
75 if (err > max_err) max_err = err;
77 std::cout <<
"Maximum relative error = " << max_err << std::endl;
81 std::cout <<
"\nExample passed!" << std::endl;
85 std::cout <<
"\nSomething is wrong, example failed!" << std::endl;
void resize(int d, bool keep_coeffs)
Resize polynomial to degree d.
T & fastAccessCoeff(int i)
Returns degree i term without bounds checking.
const T * coeff() const
Returns Taylor coefficient array.
void reserve(int d)
Reserve space for a degree d polynomial.
const T func(int n, T *x)