|
|
| GaussianParams () |
| | Constructs a Gaussian in a default space, with a zero mean and covariance, which factorize() rejects until a covariance is set.
|
| | GaussianParams (Index n) |
| | Constructs a Gaussian with n value coordinates, with a zero mean and covariance.
|
|
| GaussianParams (MomentsType moments) |
| | Constructs a Gaussian from moments, in a default space resized to fit them.
|
template<MatrixExpression Mean, CovarianceExpression Cov>
requires internal::SizedByLength<Space_> |
| | GaussianParams (Mean &&mean, Cov &&cov) |
| | Constructs a Gaussian from mean and cov, moving either one passed as an rvalue of the stored type.
|
|
| GaussianParams (Space_ space) |
| | Constructs a Gaussian in space, with a zero mean and covariance.
|
| | GaussianParams (Space_ space, Index n) |
| | Constructs a Gaussian with n value coordinates in space, with a zero mean and covariance.
|
|
| GaussianParams (Space_ space, MomentsType moments) |
| | Constructs a Gaussian from moments in space, which is resized to fit them if it has one resizable block.
|
|
template<MatrixExpression Mean, CovarianceExpression Cov> |
| | GaussianParams (Space_ space, Mean &&mean, Cov &&cov) |
| | GaussianParams(mean, cov) in space.
|
| | GaussianParams (GaussianParams const &other) |
| | Copies the data and any valid factorization.
|
|
| GaussianParams (GaussianParams &&other) noexcept |
| | Moves the data and any valid factorization; a view of other may not be read afterward.
|
|
GaussianParams & | operator= (GaussianParams const &other) |
| | Copies the data and any valid factorization; a view of this object may not be read afterward.
|
|
GaussianParams & | operator= (GaussianParams &&other) noexcept |
| | Moves the data and any valid factorization; a view of either object may not be read afterward.
|
| Index | valueDimension () const |
| Index | differenceDimension () const |
| void | resize (Index n) |
| | Resizes mean, covariance, and factorization, and the space's resizable block, to n value coordinates.
|
| template<typename Path, typename MeanDerived, typename CovDerived, typename CrossDerived> |
| void | insert (Index element, Eigen::MatrixBase< MeanDerived > const &mean, Eigen::MatrixBase< CovDerived > const &cov, Eigen::MatrixBase< CrossDerived > const &cross) |
| | Inserts the entries mean into the resizable block named by the tag path Path, before its element element, with covariance cov and cross-covariance cross with the existing entries (a row per difference coordinate of the new entries and a column per existing one, in order).
|
|
template<typename Path, typename MeanDerived, typename CovDerived> |
| void | insert (Index element, Eigen::MatrixBase< MeanDerived > const &mean, Eigen::MatrixBase< CovDerived > const &cov) |
| | insert() of entries independent of the existing ones.
|
| template<typename Path> |
| void | erase (Index element, Index count=1) |
| | Removes count elements of the resizable block named by the tag path Path, starting at its element element: the marginal of the rest.
|
| Space_ const & | space () const |
| MomentsType const & | moments () const |
| VectorType const & | mean () const |
| MatrixType const & | covarianceLower () const |
| template<typename Path> |
| auto | mean () const |
|
template<typename Path> |
| auto | mean (Index element) const |
| | mean<Path>() of repetition element of the repeated block Path starts at (see marginal<Path>(element)).
|
| template<typename Path> |
| auto | covariance () const |
|
template<typename Path> |
| auto | covariance (Index element) const |
| | covariance<Path>() of repetition element of the repeated block Path starts at.
|
| template<typename RowPath, typename ColPath> |
| auto | covariance () const |
| template<MatrixExpression Mean> |
| void | setMean (Mean &&mean) |
| | Sets the mean, normalized by the space, moving mean if it is an rvalue of the stored type.
|
| template<CovarianceExpression Cov> |
| void | setCovariance (Cov &&cov) |
| | Sets the covariance, moving cov if it is an rvalue of the stored type, and invalidates the factorization.
|
| void | scaleToConfidence (Scalar probability) |
| | Scales the covariance so that its one-standard-deviation ellipsoid is the probability confidence region, and invalidates the factorization.
|
| std::expected< MatrixType, GaussianError > | covariance () const |
| std::expected< MatrixType, GaussianError > | precision () const |
| std::expected< MatrixType, GaussianError > | covarianceRoot () const |
| std::expected< MatrixType, GaussianError > | precisionRoot () const |
| template<typename Path> |
| auto | marginal () const & |
|
template<typename Path> |
| void | marginal () const &&=delete |
| | A marginal of a temporary would outlive it; copy the marginal of a named Gaussian instead.
|
| template<typename Path> |
| auto | marginal (Index element) const & |
|
template<typename Path> |
| void | marginal (Index element) const &&=delete |
| | A marginal of a temporary would outlive it.
|
| template<typename GivenPath, typename Derived> |
| auto | conditional (Eigen::MatrixBase< Derived > const &values) const |
| template<typename GivenPath, typename Derived> |
| auto | conditionalWithEvidence (Eigen::MatrixBase< Derived > const &values) const |
| std::expected< void, GaussianError > | factorize () const |
| | Factorizes the covariance if it has changed since the last factorization.
|
| template<typename R> |
| std::expected< void, GaussianError > | factorize (R const &repair) |
| | factorize(), repairing a covariance that is not positive definite by repair, a Repair: g.factorize(roots::ridge()).
|
| std::expected< DensityType, GaussianError > | toDensity () const & |
| | Factorizes the covariance if needed (see factorize()), which writes the cache and so is not safe on one object from two threads at once.
|
|
void | toDensity () const &&=delete |
| | A density of a temporary would outlive it.
|
| template<typename R> |
| std::expected< DensityType, GaussianError > | toDensity (R const &repair) & |
| | toDensity(), repairing a covariance that is not positive definite by repair (see factorize(R const &)): g.toDensity(roots::ridge()).
|
|
template<typename R> |
| void | toDensity (R const &) &&=delete |
| | A density of a temporary would outlive it.
|
template<Space Space_, RealScalar Scalar_ = double>
class Emrys::GaussianParams< Space_, Scalar_ >
A Gaussian distribution: a mean and covariance in a space.
The multivariate normal distribution, with the space's \( \boxplus \) and \( \boxminus \) in place of addition and subtraction where its coordinates are not plain.
toDensity() factorizes the covariance (if it has changed since the last factorization) and returns a Gaussian, which evaluates the density. The density checks this object for changes: reading it after this object has changed in any way is a programmer error caught by EMRYS_FILTER_ASSERT (decisions.md [view-stamp]). The check detects the change and prevents nothing: it does not synchronize threads or block the mutators (see Distributions). Share the Gaussian between threads, or a copy of moments(), rather than this object: its const members factorize into a cache (see factorize()).
marginal() returns a read-only view of a subset of the entries, which checks only this object's size and structure: its values may change under the marginal, which sees them, but reading the marginal after a resize, an insert() or erase(), or an assignment is a programmer error. Neither view may outlive this object, and neither may be made from a temporary.
The space's value dimension always matches the mean's length. insert() and erase() grow and shrink the space's resizable block in place, such as adding or dropping a landmark, and resize() resizes it whole.
The space describes how each coordinate behaves (see Spaces). The mean is normalized whenever it is set, and residuals are normalized before they are used, so a periodic coordinate's mean stays in range and its residuals take the short way around. Densities use the nearest image only (see Spaces).
Only the lower triangle of the covariance is read by the factorization. Changing the mean does not invalidate the factorization.
- Template Parameters
-
| Space_ | space of the coordinates, which sets the dimension and the storage bound (see Spaces) |
| Scalar_ | scalar type, double by default |
- See also
- class Gaussian, class Moments