24#ifndef LSST_MEAS_MODELFIT_TruncatedGaussian_h_INCLUDED
25#define LSST_MEAS_MODELFIT_TruncatedGaussian_h_INCLUDED
36namespace lsst {
namespace meas {
namespace modelfit {
38class TruncatedGaussianSampler;
39class TruncatedGaussianEvaluator;
40class TruncatedGaussianLogEvaluator;
250 template <
typename Derived>
260 ndarray::Array<Scalar const,2,1>
const & alpha,
261 ndarray::Array<Scalar,1,1>
const & output
281 template <
typename Derived>
289 ndarray::Array<Scalar const,2,1>
const & alpha,
290 ndarray::Array<Scalar,1,1>
const & output
329 ndarray::Array<Scalar,2,1>
const & alpha,
330 ndarray::Array<Scalar,1,1>
const & weights,
331 bool multiplyWeights=
false
343 return Sampler(*
this, strategy);
A class that can be used to generate sequences of random numbers according to a number of different a...
Helper class for evaluating the -log of a TruncatedGaussian.
void operator()(ndarray::Array< Scalar const, 2, 1 > const &alpha, ndarray::Array< Scalar, 1, 1 > const &output) const
Scalar operator()(Eigen::MatrixBase< Derived > const &alpha) const
TruncatedGaussianEvaluator(TruncatedGaussian const &parent)
Scalar operator()(ndarray::Array< Scalar const, 1, 1 > const &alpha) const
Represents a multidimensional Gaussian function truncated at zero.
TruncatedGaussianLogEvaluator LogEvaluator
LogEvaluator evaluateLog() const
Create a LogEvaluator object that can be used to efficiently evaluate the -log of the function.
Scalar getLogIntegral() const
Return the -log of the integral of the truncated function.
Scalar getLogPeakAmplitude() const
Return the -log of the peak amplitude of the untruncated function.
Vector maximize() const
Return the location of the maximum of the truncated Gaussian.
TruncatedGaussianSampler Sampler
int getDim() const
Return the dimensionality of the function.
TruncatedGaussianEvaluator Evaluator
static TruncatedGaussian fromStandardParameters(Vector const &mean, Matrix const &covariance)
Create from the "standard" mean and covariance parameters of the normal distribution.
SampleStrategy
Enum that describes different ways of sampling from a multidimensional TruncatedGaussian.
@ ALIGN_AND_WEIGHT
Create a similar Gaussian with no x-y covariance, and importance sample by drawing from the independe...
@ DIRECT_WITH_REJECTION
Draw from the untruncated Gaussian, and discard negative draws.
Scalar getUntruncatedFraction() const
Return the fraction of the Gaussian integral that was truncated by the bounds.
static TruncatedGaussian fromSeriesParameters(Scalar q0, Vector const &gradient, Matrix const &hessian)
Create from the first and second logarithmic derivatives of the Gaussian.
Evaluator evaluate() const
Create an Evaluator object that can be used to efficiently evaluate the function.
Sampler sample(SampleStrategy strategy) const
Create a Sampler object that uses the given strategy.
Helper class for evaluating the -log of a TruncatedGaussian.
void operator()(ndarray::Array< Scalar const, 2, 1 > const &alpha, ndarray::Array< Scalar, 1, 1 > const &output) const
Scalar operator()(ndarray::Array< Scalar const, 1, 1 > const &alpha) const
TruncatedGaussianLogEvaluator(TruncatedGaussian const &parent)
Scalar operator()(Eigen::MatrixBase< Derived > const &alpha) const
Helper class for drawing samples from a TruncatedGaussian.
~TruncatedGaussianSampler()
Scalar operator()(afw::math::Random &rng, ndarray::Array< Scalar, 1, 1 > const &alpha) const
Draw a single sample from a TruncatedGaussian.
TruncatedGaussianSampler(TruncatedGaussian const &parent, TruncatedGaussian::SampleStrategy strategy)
void operator()(afw::math::Random &rng, ndarray::Array< Scalar, 2, 1 > const &alpha, ndarray::Array< Scalar, 1, 1 > const &weights, bool multiplyWeights=false) const
Draw multiple samples from a TruncatedGaussian.
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
double Scalar
Typedefs to be used for probability and parameter values.