LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Private Attributes | List of all members
lsst::afw::geom::Functor Class Referenceabstract

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. More...

#include <Functor.h>

Inheritance diagram for lsst::afw::geom::Functor:
lsst::daf::base::Citizen lsst::afw::geom::LinearFunctor

Public Member Functions

 Functor (std::string const &name)
 
virtual ~Functor ()
 
virtual boost::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
 
- Public Member Functions inherited from lsst::daf::base::Citizen
 Citizen (const std::type_info &)
 
 Citizen (Citizen const &)
 
 ~Citizen ()
 
Citizenoperator= (Citizen const &)
 
std::string repr () const
 Return a string representation of a Citizen. More...
 
void markPersistent (void)
 Mark a Citizen as persistent and not destroyed until process end. More...
 
memId getId () const
 Return the Citizen's ID. More...
 

Private Attributes

std::string _name
 

Additional Inherited Members

- Public Types inherited from lsst::daf::base::Citizen
enum  { magicSentinel = 0xdeadbeef }
 
typedef unsigned long memId
 Type of the block's ID. More...
 
typedef memId(* memNewCallback )(const memId cid)
 A function used to register a callback. More...
 
typedef memId(* memCallback )(const Citizen *ptr)
 
- Static Public Member Functions inherited from lsst::daf::base::Citizen
static bool hasBeenCorrupted ()
 Check all allocated blocks for corruption. More...
 
static memId getNextMemId ()
 Return the memId of the next object to be allocated. More...
 
static int init ()
 Called once when the memory system is being initialised. More...
 
static int census (int, memId startingMemId=0)
 How many active Citizens are there? More...
 
static void census (std::ostream &stream, memId startingMemId=0)
 Print a list of all active Citizens to stream, sorted by ID. More...
 
static const std::vector
< const Citizen * > * 
census ()
 Return a (newly allocated) std::vector of active Citizens sorted by ID. More...
 
static memId setNewCallbackId (memId id)
 Call the NewCallback when block is allocated. More...
 
static memId setDeleteCallbackId (memId id)
 Call the current DeleteCallback when block is deleted. More...
 
static memNewCallback setNewCallback (memNewCallback func)
 Set the NewCallback function. More...
 
static memCallback setDeleteCallback (memCallback func)
 Set the DeleteCallback function. More...
 
static memCallback setCorruptionCallback (memCallback func)
 Set the CorruptionCallback function. More...
 

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 49 of file Functor.h.

Constructor & Destructor Documentation

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.
virtual lsst::afw::geom::Functor::~Functor ( )
inlinevirtual

Definition at line 58 of file Functor.h.

58 {}

Member Function Documentation

virtual boost::shared_ptr< Functor > lsst::afw::geom::Functor::clone ( ) const
pure virtual
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.

virtual double lsst::afw::geom::Functor::inverse ( double  y,
double  tol = 1e-10,
unsigned int  maxiter = 1000 
) const
virtual
Returns
The x value such that y = f(x).
Parameters
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.
Exceptions
lsst::pex::exceptions::OutOfRangeErrorif (tol <= 0) or (tol > 1) or (maxiter < 1).
lsst::pex::exceptions::RuntimeErrorif the number of N-R iterations > maxiter.
virtual double lsst::afw::geom::Functor::operator() ( double  x) const
pure virtual
Returns
y = f(x)

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

Member Data Documentation

std::string lsst::afw::geom::Functor::_name
private

Definition at line 82 of file Functor.h.


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