File Integrate.h

Defines

integ_dbg1
integ_dbg2
integ_dbg3
namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace afw
namespace math

Functions

template<class UF>
UF::result_type int1d(UF const &func, IntRegion<typename UF::result_type> &reg, typename UF::result_type const &abserr = DEFABSERR, typename UF::result_type const &relerr = DEFRELERR)

Front end for the 1d integrator

template<class BF, class YREG>
BF::result_type int2d(BF const &func, IntRegion<typename BF::result_type> &reg, YREG const &yreg, typename BF::result_type const &abserr = DEFABSERR, typename BF::result_type const &relerr = DEFRELERR)

Front end for the 2d integrator

template<class TF, class YREG, class ZREG>
TF::result_type int3d(TF const &func, IntRegion<typename TF::result_type> &reg, YREG const &yreg, ZREG const &zreg, typename TF::result_type const &abserr = DEFABSERR, typename TF::result_type const &relerr = DEFRELERR)

Front end for the 3d integrator

template<class BF>
BF::result_type int2d(BF const &func, IntRegion<typename BF::result_type> &reg, IntRegion<typename BF::result_type> &yreg, typename BF::result_type const &abserr = DEFABSERR, typename BF::result_type const &relerr = DEFRELERR)

Front end for the 2d integrator

template<class TF>
TF::result_type int3d(TF const &func, IntRegion<typename TF::result_type> &reg, IntRegion<typename TF::result_type> &yreg, IntRegion<typename TF::result_type> &zreg, typename TF::result_type const &abserr = DEFABSERR, typename TF::result_type const &relerr = DEFRELERR)

Front end for the 3d integrator

template<typename UnaryFunctionT>
UnaryFunctionT::result_type integrate(UnaryFunctionT func, typename UnaryFunctionT::argument_type const a, typename UnaryFunctionT::argument_type const b, double eps = 1.0e-6)

The 1D integrator

Note

This simply wraps the int1d function above and handles the instantiation of the intRegion.

template<typename BinaryFunctionT>
BinaryFunctionT::result_type integrate2d(BinaryFunctionT func, typename BinaryFunctionT::first_argument_type const x1, typename BinaryFunctionT::first_argument_type const x2, typename BinaryFunctionT::second_argument_type const y1, typename BinaryFunctionT::second_argument_type const y2, double eps = 1.0e-6)

The 2D integrator

Note

Adapted from RHL’s SDSS code

Variables

double const MOCK_INF = 1.e10
double const DEFABSERR = 1.e-15
double const DEFRELERR = 1.e-6
template<class T>
struct IntRegion

Public Functions

IntRegion(T const a, T const b, std::ostream *dbgout = 0)
IntRegion(IntRegion const&)
IntRegion(IntRegion&&)
IntRegion &operator=(IntRegion const&)
IntRegion &operator=(IntRegion&&)
~IntRegion()
bool operator<(IntRegion<T> const &r2) const
bool operator>(IntRegion<T> const &r2) const
void SubDivide(std::vector<IntRegion<T>> *children)
void Bisect()
void AddSplit(const T x)
size_t NSplit() const
T const &Left() const
T const &Right() const
T const &Err() const
T const &Area() const
void SetArea(const T &a, const T &e)
std::ostream *getDbgout()

Private Members

T _a
T _b
T _error
T _area
std::vector<T> _splitpoints
std::ostream *_dbgout
namespace details

Functions

template<class T>
T norm(const T &x)
template<class T>
T real(const T &x)
template<class T>
T Epsilon()
template<class T>
T MinRep()
template<class T>
T rescale_error(T err, T const &resabs, T const &resasc)
template<class UF>
bool intGKPNA(UF const &func, IntRegion<typename UF::result_type> &reg, typename UF::result_type const epsabs, typename UF::result_type const epsrel, std::map<typename UF::result_type, typename UF::result_type> *fxmap = 0)

Non-adaptive integration of the function f over the region ‘reg’.

Note

The algorithm computes first a Gaussian quadrature value then successive Kronrod/Patterson extensions to this result. The functions terminates when the difference between successive approximations (rescaled according to rescale_error) is less than either epsabs or epsrel * I, where I is the latest estimate of the integral. The order of the Gauss/Kronron/Patterson scheme is determined by which file is included above. Currently schemes starting with order 1 and order 10 are calculated. There seems to be little practical difference in the integration times using the two schemes, so I haven’t bothered to calculate any more.

template<class UF>
void intGKP(UF const &func, IntRegion<typename UF::result_type> &reg, typename UF::result_type const epsabs, typename UF::result_type const epsrel, std::map<typename UF::result_type, typename UF::result_type> *fxmap = 0)

An adaptive integration algorithm which computes the integral of f over the region reg.

The area and estimated error are returned as reg.Area() and reg.Err() If desired, *retx and *retf return std::vectors of x,f(x) respectively They only include the evaluations in the non-adaptive pass, so they do not give an accurate estimate of the number of function evaluations.

Note

First the non-adaptive GKP algorithm is tried. If that is not accurate enough (according to the absolute and relative accuracies, epsabs and epsrel), the region is split in half, and each new region is integrated. The routine continues by successively splitting the subregion which gave the largest absolute error until the integral converges.

template<class UF>
AuxFunc1<UF> Aux1(UF uf)

Auxiliary function 1

template<class UF>
AuxFunc2<UF> Aux2(UF uf)

Auxiliary function 2

template<class BF, class Tp>
binder2_1<BF> bind21(const BF &oper, const Tp &x)
template<class TF, class Tp>
binder3_1<TF> bind31(const TF &oper, const Tp &x)
template<class UF>
struct AuxFunc1 : public std::unary_function<UF::argument_type, UF::result_type>
#include <Integrate.h>

Auxiliary struct 1

Public Functions

AuxFunc1(const UF &f)
UF::result_type operator()(typename UF::argument_type x) const

Private Members

UF const &_f
template<class UF>
struct AuxFunc2 : public std::unary_function<UF::argument_type, UF::result_type>

Public Functions

AuxFunc2(UF const &f)
UF::result_type operator()(typename UF::argument_type x) const

Private Members

UF const &_f
template<class BF>
class binder2_1 : public std::unary_function<BF::second_argument_type, BF::result_type>

Public Functions

binder2_1(const BF &oper, typename BF::first_argument_type val)
BF::result_type operator()(const typename BF::second_argument_type &x) const

Protected Attributes

BF _oper
BF::first_argument_type _value
template<class TF>
class binder3_1 : public std::binary_function<TF::secondof3_argument_type, TF::thirdof3_argument_type, TF::result_type>

Public Functions

binder3_1(const TF &oper, typename TF::firstof3_argument_type val)
TF::result_type operator()(typename TF::secondof3_argument_type const &x1, typename TF::thirdof3_argument_type const &x2) const

Protected Attributes

TF _oper
TF::firstof3_argument_type _value
template<class T>
struct ConstantReg1 : public std::unary_function<T, IntRegion<T>>
#include <Integrate.h>

Helpers for constant regions for int2d, int3d:

Public Functions

ConstantReg1(T a, T b)
ConstantReg1(IntRegion<T> const &r)
IntRegion<T> operator()(T) const

Public Members

IntRegion<T> ir
template<class T>
struct ConstantReg2 : public std::binary_function<T, T, IntRegion<T>>

Public Functions

ConstantReg2(T a, T b)
ConstantReg2(IntRegion<T> const &r)
IntRegion<T> operator()(T x, T y) const

Public Members

IntRegion<T> ir
template<typename BinaryFunctionT>
class FunctionWrapper : public std::unary_function<BinaryFunctionT::second_argument_type, BinaryFunctionT::result_type>
#include <Integrate.h>

Wrap an integrand in a call to a 1D integrator: romberg()

When romberg2D() is called, it wraps the integrand it was given in a FunctionWrapper functor. This wrapper calls romberg() on the integrand to get a 1D (along the x-coord, for constant y) result . romberg2D() then calls romberg() with the FunctionWrapper functor as an integrand.

Public Functions

FunctionWrapper(BinaryFunctionT func, typename BinaryFunctionT::first_argument_type const x1, typename BinaryFunctionT::first_argument_type const x2, double const eps = 1.0e-6)
BinaryFunctionT::result_type operator()(typename BinaryFunctionT::second_argument_type const y) const

Private Members

BinaryFunctionT _func
BinaryFunctionT::first_argument_type _x1
BinaryFunctionT::first_argument_type _x2
double _eps
template<class BF, class YREG>
class Int2DAuxType : public std::unary_function<BF::first_argument_type, BF::result_type>

Public Functions

Int2DAuxType(BF const &func, YREG const &yreg, typename BF::result_type const &abserr, typename BF::result_type const &relerr)
BF::result_type operator()(typename BF::first_argument_type x) const

Private Members

BF const &_func
YREG const &_yreg
BF::result_type _abserr
BF::result_type _relerr
template<class TF, class YREG, class ZREG>
class Int3DAuxType : public std::unary_function<TF::firstof3_argument_type, TF::result_type>

Public Functions

Int3DAuxType(const TF &func, const YREG &yreg, const ZREG &zreg, const typename TF::result_type &abserr, const typename TF::result_type &relerr)
TF::result_type operator()(typename TF::firstof3_argument_type x) const

Private Members

const TF &_func
const YREG &_yreg
const ZREG &_zreg
TF::result_type _abserr
TF::result_type _relerr