Isis 3 Programmer Reference
|
Nth degree Polynomial with one variable. More...
#include <PolynomialUnivariate.h>
Public Member Functions | |
PolynomialUnivariate (int degree) | |
Create a PolynomialUnivariate object. More... | |
PolynomialUnivariate (int degree, std::vector< double > coeffs) | |
Create a PolynomialUnivariate object. More... | |
~PolynomialUnivariate () | |
Destroys the PolynomialUnivariate object. More... | |
void | Expand (const std::vector< double > &vars) |
This is the the overriding virtual function that provides the expansion of the two input variables into the polynomial equation. More... | |
double | DerivativeVar (const double value) |
This will take the Derivative with respect to the variable and evaluate at given value. More... | |
double | DerivativeCoef (const double value, const int coefIndex) |
Evaluate the derivative of the polynomial defined by the given coefficients with respect to the coefficient at the given index, at the current value. More... | |
void | SetCoefficients (const std::vector< double > &coefs) |
Set the coefficients for the equation. More... | |
double | Evaluate (const std::vector< double > &vars) |
Compute the equation using the input variables. More... | |
double | Evaluate (const double &var) |
Compute the equation using the input variable. More... | |
int | Coefficients () const |
Returns the number of coefficients for the equation. More... | |
int | Variables () const |
Returns the number of variables in the equation. More... | |
QString | Name () const |
Returns the name of the equation. More... | |
double | Term (int c) const |
Returns the cth term. More... | |
double | Coefficient (int i) const |
Returns the ith coefficient. More... | |
Protected Attributes | |
QString | p_name |
The name of the equation. Call it by using Name() More... | |
int | p_numVars |
The number of variables in the equation. Call it by using Variables() More... | |
int | p_numCoefs |
The number of coefficients in the equation. More... | |
std::vector< double > | p_coefs |
A vector of the coefficients in the equation. More... | |
std::vector< double > | p_terms |
A vector of the terms in the equation. More... | |
Private Attributes | |
int | p_degree |
The order/degree of the polynomial. More... | |
Nth degree Polynomial with one variable.
This is a derived class from Basis1VariableFunction which provides the capabilities of a polynomial equation in one variable with degree n, where n is specified during the object construction. For example, Degree = 1 z = a + b*x Degree = 2 z = a + b*x + c*x**2 Degree = 3 z = a + b*x + c*x**2 + d*x**3 In general the number of coefficients will be degree + 1.
2008-01-11 Tracie Sucharski - Renamed from Poly1D, add derivative methods.
2008-02-05 Jeannie Walldren - Renamed from Polynomial1Variable.
2015-02-20 Jeannie Backer - Improved error messages.
2016-11-10 Kristin Berry - Added additional convenience constructor which accepts a vector of coeffs. References #3888.
Definition at line 53 of file PolynomialUnivariate.h.
Isis::PolynomialUnivariate::PolynomialUnivariate | ( | int | degree | ) |
Create a PolynomialUnivariate object.
degree | The order/degree of the polynomial |
Definition at line 37 of file PolynomialUnivariate.cpp.
References p_degree.
Isis::PolynomialUnivariate::PolynomialUnivariate | ( | int | degree, |
std::vector< double > | coeffs | ||
) |
Create a PolynomialUnivariate object.
degree | The order/degree of the polynomial |
coeffs | a list of the coefficients |
Definition at line 49 of file PolynomialUnivariate.cpp.
References p_degree, and Isis::BasisFunction::SetCoefficients().
|
inline |
Destroys the PolynomialUnivariate object.
Definition at line 59 of file PolynomialUnivariate.h.
|
inlineinherited |
Returns the ith coefficient.
i | The index for the desired coefficient. |
Definition at line 123 of file BasisFunction.h.
References Isis::BasisFunction::p_coefs.
Referenced by DerivativeVar(), Isis::SpicePosition::LoadHermiteCache(), Isis::SurfaceModel::MinMax(), Isis::SpicePosition::SetPolynomial(), Isis::SpiceRotation::SetPolynomial(), and Isis::Affine::Solve().
|
inlineinherited |
Returns the number of coefficients for the equation.
Definition at line 80 of file BasisFunction.h.
References Isis::BasisFunction::p_numCoefs.
Referenced by DerivativeCoef(), DerivativeVar(), Isis::SpicePosition::SetPolynomial(), Isis::SpiceRotation::SetPolynomial(), Isis::LeastSquares::SolveQRD(), and Isis::LeastSquares::SolveSVD().
|
virtual |
Evaluate the derivative of the polynomial defined by the given coefficients with respect to the coefficient at the given index, at the current value.
[in] | value | (const double) value at which to evaluate derivative |
[in] | coefIndex | (const int) The index of the coefficient to differentiate with respect to |
Implements Isis::Basis1VariableFunction.
Definition at line 105 of file PolynomialUnivariate.cpp.
References _FILEINFO_, Isis::BasisFunction::Coefficients(), Isis::IException::Programmer, and Isis::toString().
|
virtual |
This will take the Derivative with respect to the variable and evaluate at given value.
[in] | value | (const double) value at which to evaluate derivative |
Implements Isis::Basis1VariableFunction.
Definition at line 82 of file PolynomialUnivariate.cpp.
References Isis::BasisFunction::Coefficient(), and Isis::BasisFunction::Coefficients().
|
inherited |
Compute the equation using the input variables.
vars | A vector of double values to use for the equation. After setting the coefficients, this can be invoked many times to compute output values given input values. |
Definition at line 80 of file BasisFunction.cpp.
References _FILEINFO_, Isis::BasisFunction::Expand(), Isis::BasisFunction::p_coefs, Isis::BasisFunction::p_numCoefs, Isis::BasisFunction::p_numVars, Isis::BasisFunction::p_terms, Isis::IException::Programmer, and Isis::toString().
Referenced by Isis::BasisFunction::Evaluate(), Isis::LeastSquares::Evaluate(), Isis::SpiceRotation::EvaluatePolyFunction(), Isis::SpicePosition::LoadHermiteCache(), Isis::SpicePosition::SetEphemerisTimePolyFunction(), Isis::SpiceRotation::setEphemerisTimePolyFunction(), Isis::LeastSquares::SolveQRD(), and Isis::LeastSquares::SolveSVD().
|
inherited |
Compute the equation using the input variable.
var | A single double value to use for the equation. |
Definition at line 117 of file BasisFunction.cpp.
References Isis::BasisFunction::Evaluate().
|
virtual |
This is the the overriding virtual function that provides the expansion of the two input variables into the polynomial equation.
See BasisFunction for more information.
vars | A vector of double values to use for the expansion. |
Reimplemented from Isis::BasisFunction.
Definition at line 63 of file PolynomialUnivariate.cpp.
References p_degree, and Isis::BasisFunction::p_terms.
|
inlineinherited |
Returns the name of the equation.
Definition at line 96 of file BasisFunction.h.
References Isis::BasisFunction::p_name.
Referenced by Isis::LeastSquares::AddKnown().
|
inherited |
Set the coefficients for the equation.
coefs | A vector of coefficients for the equation. |
Definition at line 58 of file BasisFunction.cpp.
References _FILEINFO_, Isis::BasisFunction::p_coefs, Isis::BasisFunction::p_numCoefs, Isis::IException::Programmer, and Isis::toString().
Referenced by Isis::SpiceRotation::DCJdt(), Isis::SpiceRotation::EvaluatePolyFunction(), Isis::SpicePosition::LoadHermiteCache(), PolynomialUnivariate(), Isis::SpicePosition::SetEphemerisTimePolyFunction(), Isis::SpiceRotation::setEphemerisTimePolyFunction(), Isis::SpicePosition::SetPolynomial(), Isis::SpiceRotation::SetPolynomial(), Isis::LeastSquares::SolveQRD(), Isis::LeastSquares::SolveSparse(), and Isis::LeastSquares::SolveSVD().
|
inlineinherited |
Returns the cth term.
This is only valid after a Evalute/Expand has been invoked. It represents the expansion of the variables into the ith term. For example,
\[ x = C1 + C2*x + C3*y + C4*x*y \]
would return x*y for the 3rd term (zero-based)
c | The index for the desired coefficient. |
Definition at line 113 of file BasisFunction.h.
References Isis::BasisFunction::p_terms.
Referenced by Isis::LeastSquares::FillSparseA(), Isis::LeastSquares::SolveQRD(), and Isis::LeastSquares::SolveSVD().
|
inlineinherited |
Returns the number of variables in the equation.
Definition at line 88 of file BasisFunction.h.
References Isis::BasisFunction::p_numVars.
Referenced by Isis::LeastSquares::AddKnown().
|
protectedinherited |
A vector of the coefficients in the equation.
Call it by using Coefficient()
Definition at line 139 of file BasisFunction.h.
Referenced by Isis::BasisFunction::Coefficient(), Isis::BasisFunction::Evaluate(), and Isis::BasisFunction::SetCoefficients().
|
private |
The order/degree of the polynomial.
Definition at line 67 of file PolynomialUnivariate.h.
Referenced by Expand(), and PolynomialUnivariate().
|
protectedinherited |
The name of the equation. Call it by using Name()
Definition at line 125 of file BasisFunction.h.
Referenced by Isis::BasisFunction::BasisFunction(), and Isis::BasisFunction::Name().
|
protectedinherited |
The number of coefficients in the equation.
Call it by using Coefficients()
Definition at line 135 of file BasisFunction.h.
Referenced by Isis::BasisFunction::BasisFunction(), Isis::BasisFunction::Coefficients(), Isis::BasisFunction::Evaluate(), and Isis::BasisFunction::SetCoefficients().
|
protectedinherited |
The number of variables in the equation. Call it by using Variables()
Definition at line 131 of file BasisFunction.h.
Referenced by Isis::BasisFunction::BasisFunction(), Isis::BasisFunction::Evaluate(), and Isis::BasisFunction::Variables().
|
protectedinherited |
A vector of the terms in the equation.
Call it by using Term()
Definition at line 143 of file BasisFunction.h.
Referenced by Isis::BasisFunction::Evaluate(), Isis::PolynomialBivariate::Expand(), Expand(), Isis::BasisFunction::Expand(), and Isis::BasisFunction::Term().