42#ifndef TEUCHOS_POLYNOMIAL_HPP
43#define TEUCHOS_POLYNOMIAL_HPP
45#include "Teuchos_PolynomialDecl.hpp"
48template <
typename CoeffT>
51 unsigned int reserve) :
60 for (
unsigned int i=0;
i<
sz;
i++)
64template <
typename CoeffT>
66 unsigned int reserve) :
77template <
typename CoeffT>
82template <
typename CoeffT>
89 if (coeff[0] != Teuchos::null) {
90 for (
unsigned int i=sz;
i<d+1;
i++)
97template <
typename CoeffT>
104 "Polynomial<CoeffT>::getCoefficient(i): " <<
105 "Error, coefficient i = " <<
i <<
106 " is not in range, degree = " << d <<
"." );
111template <
typename CoeffT>
118 "Polynomial<CoeffT>::getCoefficient(i): " <<
119 "Error, coefficient i = " <<
i <<
120 " is not in range, degree = " << d <<
"." );
125template <
typename CoeffT>
132 "Polynomial<CoeffT>::setCoefficient(i,v): " <<
133 "Error, coefficient i = " <<
i <<
134 " is not in range, degree = " << d <<
"." );
137 "Polynomial<CoeffT>::setCoefficient(i,v): " <<
138 "Error, coefficient i = " <<
i <<
" is null!");
143template <
typename CoeffT>
152 "Polynomial<CoeffT>::setCoefficientPtr(i,v): " <<
153 "Error, coefficient i = " <<
i <<
154 " is not in range, degree = " << d <<
"." );
159template <
typename CoeffT>
168 for (
unsigned int i=0;
i<=d;
i++)
171 "Polynomial<CoeffT>::evaluate(): " <<
172 "Error, coefficient i = " <<
i <<
" is null!");
190 for (
int k=d-1;
k>=0; --
k) {
Defines basic traits for the scalar field type.
Traits class for polynomial coefficients in Teuchos::Polynomial.
static void assign(coeff_type *y, const scalar_type &alpha)
Assign a scalar to a coefficient.
static void update(coeff_type *y, const coeff_type &x, const scalar_type &beta)
y = x + beta*y
static void copy(const coeff_type &x, coeff_type *y)
Copy a coefficient.
void setCoefficient(unsigned int i, const CoeffT &v)
Set coefficient i to c.
Teuchos::RCP< CoeffT > getCoefficient(unsigned int i)
Return ref-count pointer to coefficient i.
Teuchos::PolynomialTraits< coeff_type >::scalar_type scalar_type
Typename of scalars.
unsigned int sz
Size of polynomial (may be > d)
void evaluate(typename Teuchos::Polynomial< CoeffT >::scalar_type &t, CoeffT *x, CoeffT *xdot=NULL) const
Evaluate polynomial and possibly its derivative at time t.
void setDegree(unsigned int deg)
Set degree of polynomial to deg.
std::vector< Teuchos::RCP< CoeffT > > coeff
Vector of polynomial coefficients.
unsigned int d
Degree of polynomial.
Polynomial(unsigned int deg, const CoeffT &cloneCoeff, unsigned int reserve=0)
Create a polynomial of degree deg.
void setCoefficientPtr(unsigned int i, const Teuchos::RCP< CoeffT > &c_ptr)
Set pointer for coefficient i to c_ptr. DANGEROUS!
Smart reference counting pointer class for automatic garbage collection.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
This structure defines some basic traits for a scalar field type.