lsst.afw  13.0-102-g6486c126f
Public Member Functions | List of all members
lsst::afw::geom::Functor Class Referenceabstract

Abstract base class for function objects. More...

#include <Functor.h>

Inheritance diagram for lsst::afw::geom::Functor:
lsst::afw::geom::LinearFunctor

Public Member Functions

 Functor (std::string const &name)
 
virtual ~Functor ()
 
virtual std::shared_ptr< Functor > clone () const =0
 
virtual double operator() (double x) const =0
 
virtual double inverse (double y, double tol=1e-10, unsigned int maxiter=1000) const
 
virtual double derivative (double x) const =0
 

Detailed Description

Abstract base class for function objects.

A default implementation of the inverse(...) member function is provided that computes the inverse of the function using the Newton-Raphson method. Concrete subclasses must therefore implement a derivative(...) member function. In cases where the function is analytically invertible, the inverse(...) function should be re-implemented in the subclass using the analytic expression.

Definition at line 50 of file Functor.h.

Constructor & Destructor Documentation

◆ Functor()

lsst::afw::geom::Functor::Functor ( std::string const &  name)
explicit
Parameters
nameThe name of the concrete subclass of this class. Used in the exception message from the inverse(...) member function.

◆ ~Functor()

virtual lsst::afw::geom::Functor::~Functor ( )
inlinevirtual

Definition at line 58 of file Functor.h.

Member Function Documentation

◆ clone()

virtual std::shared_ptr<Functor> lsst::afw::geom::Functor::clone ( ) const
pure virtual

◆ derivative()

virtual double lsst::afw::geom::Functor::derivative ( double  x) const
pure virtual
Returns
df(x)/dx evaluated at x. This is used in the inverse(...) member function.

Implemented in lsst::afw::geom::LinearFunctor.

◆ inverse()

virtual double lsst::afw::geom::Functor::inverse ( double  y,
double  tol = 1e-10,
unsigned int  maxiter = 1000 
) const
virtual
Parameters
ydesired value of functor
tolConvergence tolerance for the Newton-Raphson search such that abs(x_{iter} - x_{iter-1}) < tol.
maxiterMaximum number of iterations in the N-R search.
Returns
The x value such that y = f(x).
Exceptions
lsst::pex::exceptions::OutOfRangeErrorif (tol <= 0) or (tol > 1) or (maxiter < 1).
lsst::pex::exceptions::RuntimeErrorif the number of N-R iterations > maxiter.

◆ operator()()

virtual double lsst::afw::geom::Functor::operator() ( double  x) const
pure virtual
Returns
y = f(x)

Implemented in lsst::afw::geom::LinearFunctor.


The documentation for this class was generated from the following file: