Template Class BasePolynomialFunction2

Inheritance Relationships

Base Type

Derived Types

Class Documentation

template<typename ReturnT>
class BasePolynomialFunction2 : public lsst::afw::math::Function2<ReturnT>

Base class for 2-dimensional polynomials of the form:

f(x,y) =   c0 f0(x) f0(y)                                        (0th order)
         + c1 f1(x) f0(x) + c2 f0(x) f1(y)                       (1st order)
         + c3 f2(x) f0(y) + c4 f1(x) f1(y) + c5 f0(x) f2(y)      (2nd order)
         + ...

and typically f0(x) = 1

Subclassed by lsst::afw::math::Chebyshev1Function2< ReturnT >, lsst::afw::math::PolynomialFunction2< ReturnT >

Public Functions

BasePolynomialFunction2(unsigned int order)

Parameters
  • order: order of polynomial (0 for constant)

Construct a polynomial function of specified order.

The polynomial will have (order + 1) * (order + 2) / 2 coefficients

The parameters are initialized to zero.

BasePolynomialFunction2(std::vector<double> params)

Parameters
  • params: polynomial coefficients

Construct a polynomial function with specified parameters.

The order of the polynomial is determined from the length of the params vector (see orderFromNParameters) and only certain lengths are suitable: 1, 3, 6, 10, 15…

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: if params length is unsuitable

BasePolynomialFunction2(BasePolynomialFunction2 const&)
BasePolynomialFunction2(BasePolynomialFunction2&&)
BasePolynomialFunction2 &operator=(BasePolynomialFunction2 const&)
BasePolynomialFunction2 &operator=(BasePolynomialFunction2&&)
~BasePolynomialFunction2()
int getOrder() const

Get the polynomial order

bool isLinearCombination() const

Is the function a linear combination of its parameters?

Return

true if the function can be expressed as: sum over i of parameter_i * function_i(args)

Warning

: subclasses must override if true.

std::vector<double> getDFuncDParameters(double x, double y) const

Return the derivative of the Function with respect to its parameters

Because this is a polynomial, c0 F0(x,y) + c1 F1(x,y) + c2 F2(x,y) + … we can set ci = 0 for all i except the parameter of interest and evaluate. This isn’t necessarily the most efficient algorithm, but it’s general, and you can override it if it isn’t suitable for your particular subclass.

Public Static Functions

static int nParametersFromOrder(int order)

Compute number of parameters from polynomial order.

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: if order < 0

static int orderFromNParameters(int nParameters)

Compute polynomial order from the number of parameters

Only certain values of nParameters are acceptable, including: nParameters order 1 0 3 1 6 2 10 3 15 4 …

Exceptions
  • lsst::pex::exceptions::InvalidParameterError: if nParameters is invalid

Protected Functions

BasePolynomialFunction2()

Protected Attributes

int _order

order of polynomial