LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
25 #ifndef LSST_AFW_MATH_FUNCTION_H
26 #define LSST_AFW_MATH_FUNCTION_H
35 #include "boost/format.hpp"
82 template <
typename ReturnT>
175 os <<
"parameters: [ ";
201 template <
typename ReturnT>
238 virtual ReturnT operator()(
double x) const = 0;
258 template <
typename ReturnT>
297 virtual ReturnT operator()(
double x,
double y) const = 0;
307 "getDFuncDParameters is not implemented for this class");
325 template <
typename ReturnT>
372 os <<
"order=" << order <<
" invalid: must be >= 0";
375 return (order + 1) * (order + 2) / 2;
393 int order =
static_cast<int>(
394 0.5 + ((-3.0 + (
std::sqrt(1.0 + (8.0 *
static_cast<double>(nParameters))))) / 2.0));
397 os <<
"nParameters=" << nParameters <<
" invalid: order is not an integer";
417 for (
unsigned int i = 0; i < numParams; ++i) {
418 dummy->setParameter(i, 0.0);
421 for (
unsigned int i = 0; i < numParams; ++i) {
422 dummy->setParameter(i, 1.0);
423 deriv[i] = (*dummy)(
x,
y);
424 dummy->setParameter(i, 0.0);
440 template <
typename ReturnT>
449 ReturnT operator()(
double)
const noexcept(IS_NOTHROW_INIT<ReturnT>)
override {
450 return static_cast<ReturnT
>(0);
457 template <
typename ReturnT>
466 ReturnT operator()(
double,
double)
const noexcept(IS_NOTHROW_INIT<ReturnT>)
override {
467 return static_cast<ReturnT
>(0);
474 #endif // #ifndef LSST_AFW_MATH_FUNCTION_H
int _order
order of polynomial
Function & operator=(Function const &)=default
std::string getPythonModule() const override
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
std::shared_ptr< Function1< ReturnT > > clone() const override
Return a pointer to a deep copy of this function.
static int orderFromNParameters(int nParameters)
Compute polynomial order from the number of parameters.
Function2 & operator=(Function2 const &)=default
Function1(std::vector< double > const ¶ms)
Construct a Function1 given the function parameters.
~BasePolynomialFunction2() noexcept override=default
virtual std::shared_ptr< Function2< ReturnT > > clone() const =0
Return a pointer to a deep copy of this function.
std::vector< double > getDFuncDParameters(double x, double y) const override
Return the derivative of the Function with respect to its parameters.
Function2 & operator=(Function2 &&)=default
Reports attempts to access elements using an invalid key.
virtual std::shared_ptr< Function1< ReturnT > > clone() const =0
Return a pointer to a deep copy of this function.
std::vector< double > const & getParameters() const noexcept
Return all function parameters.
virtual std::vector< double > getDFuncDParameters(double, double) const
Return the derivative of the Function with respect to its parameters.
static int nParametersFromOrder(int order)
Compute number of parameters from polynomial order.
Base class for 2-dimensional polynomials of the form:
BasePolynomialFunction2 & operator=(BasePolynomialFunction2 const &)=default
constexpr bool IS_NOTHROW_INIT
Test that a Function's return value is nothrow-castable to T.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
std::shared_ptr< Function2< ReturnT > > clone() const override
Return a pointer to a deep copy of this function.
BasePolynomialFunction2(unsigned int order)
Construct a polynomial function of specified order.
BasePolynomialFunction2()
BasePolynomialFunction2(BasePolynomialFunction2 &&)=default
Function1(Function1 const &)=default
virtual void computeCache(int const n)
virtual bool isLinearCombination() const noexcept
Is the function a linear combination of its parameters?
std::string toString(std::string const &prefix="") const override
Return a string representation of the function.
~Function2() noexcept override=default
Function(Function const &)=default
a class used in function calls to indicate that no Function2 is being provided
BasePolynomialFunction2 & operator=(BasePolynomialFunction2 &&)=default
~Function1() noexcept override=default
Function2(unsigned int nParams)
Construct a Function2 given the number of function parameters.
void setParameters(std::vector< double > const ¶ms)
Set all function parameters.
Function(std::vector< double > const ¶ms)
Construct a Function given the function parameters.
Function & operator=(Function &&)=default
Function(unsigned int nParams)
Construct a Function given the number of function parameters.
BasePolynomialFunction2(BasePolynomialFunction2 const &)=default
Function2(Function2 &&)=default
virtual double getParameter(unsigned int ind) const
Get one function parameter without range checking.
A base class for image defects.
bool isLinearCombination() const noexcept override
Is the function a linear combination of its parameters?
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
~Function() noexcept override=default
std::vector< double > _params
BasePolynomialFunction2(std::vector< double > params)
Construct a polynomial function with specified parameters.
A Function taking two arguments.
A base class for objects that can be persisted via afw::table::io Archive classes.
a class used in function calls to indicate that no Function1 is being provided
Function2(std::vector< double > const ¶ms)
Construct a Function2 given the function parameters.
Function(Function &&)=default
Reports invalid arguments.
void setParameter(unsigned int ind, double newValue)
Set one function parameter without range checking.
unsigned int getNParameters() const noexcept
Return the number of function parameters.
Function1(unsigned int nParams)
Construct a Function1 given the number of function parameters.
A CRTP facade class for subclasses of Persistable.
virtual std::string toString(std::string const &) const
Return a string representation of the function.
int getOrder() const noexcept
Get the polynomial order.
Function1 & operator=(Function1 const &)=default
std::string toString(std::string const &prefix="") const override
Return a string representation of the function.
A Function taking one argument.
Function1 & operator=(Function1 &&)=default
Function2(Function2 const &)=default
Function1(Function1 &&)=default