|
|
| SqrtGaussianParams () |
| | Constructs a SqrtGaussianParams in a default space, with a zero mean and root.
|
|
| SqrtGaussianParams (Space_ space) |
| | Constructs a SqrtGaussianParams in space, with a zero mean and root.
|
template<MatrixExpression Mean, MatrixExpression Root>
requires internal::SizedByLength<Space_> |
| | SqrtGaussianParams (Mean &&mean, Root &&root) |
| | Constructs a SqrtGaussianParams from mean and the lower triangle of root, moving either one passed as an rvalue of the stored type, in a default space resized to fit them.
|
|
template<MatrixExpression Mean, MatrixExpression Root> |
| | SqrtGaussianParams (Space_ space, Mean &&mean, Root &&root) |
| | SqrtGaussianParams(mean, root) in space, which is resized to fit them if it has one resizable block.
|
| Index | valueDimension () const |
| Index | differenceDimension () const |
| Space_ const & | space () const |
| VectorType const & | mean () const |
| MatrixType const & | root () const |
| MomentsType | moments () 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<MatrixExpression Root> |
| void | setRoot (Root &&root) |
| | Sets the root to the lower triangle of root, moving it if it is an rvalue of the stored type.
|
| 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> |
| auto | marginal (Index element) const |
| | marginal<Path>() of repetition element of the repeated block Path starts at (see GaussianParams::marginal(element)).
|
| std::expected< void, GaussianError > | factorize () const |
| | Checks the root and computes \( \log|\Sigma| = 2 \sum_i \log|S_{ii}| \), writing it to a cache when it has changed, so that a container of components can read their densities (see Component).
|
|
template<typename R> |
| std::expected< void, GaussianError > | factorize (R const &) const |
| | Refused: a root needs no repair, being positive semidefinite by construction, so a mixture of square-root components given a repair does not compile.
|
| std::expected< DensityType, GaussianError > | toDensity () const & |
| | factorize(), so that the cache it writes is not safe on one object from two threads at once while the root changes.
|
|
void | toDensity () const &&=delete |
| | A density of a temporary would outlive it.
|
template<Space Space_, RealScalar Scalar_ = double>
class Emrys::SqrtGaussianParams< Space_, Scalar_ >
A Gaussian kept as a mean and a lower-triangular root of its covariance.
The multivariate normal distribution with covariance \( \Sigma = S S^T \), where the lower-triangular \( S \) is what is stored and the covariance is formed only on request (decisions.md [gaussian-forms]). A root is positive semidefinite by construction and represents the covariance at twice the precision of the covariance itself, so a filter that keeps it, updating it by triangularize() rather than by adding and subtracting covariances, never needs the repair that a Repair makes after the fact. The density, its whitening, and draws come from \( S \) directly, where Gaussian has to factorize first.
Only the lower triangle of a root passed in is kept; the upper is set to zero. The diagonal may have either sign, since flipping the sign of a column of \( S \) leaves \( S S^T \) unchanged. A zero on the diagonal makes the covariance singular: covarianceRoot() and covariance() still succeed, and precision(), precisionRoot(), and toDensity() return GaussianError::NotPositiveDefinite.
The space and dimension contract is Gaussian's [sizes-and-dimensions]: the mean is a value with valueDimension() coordinates, normalized whenever it is set, and the root is square over its differences. toDensity() returns a FormGaussian, which checks this object for changes as Gaussian checks a GaussianParams. marginal<Path>() returns parameters, since its root is computed rather than selected; a conditional, insert(), and erase() go through toGaussian() and back.
It is a Component (decisions.md [component-first]), so a MixtureParams or a Hybrid holds it as it holds GaussianParams: factorize() checks the root and caches its log-determinant, and the collapse of several is one triangularization, so a mixture filter or an IMM over the square-root form keeps roots throughout.
- Template Parameters
-
| Space_ | space of the coordinates (see Spaces) |
| Scalar_ | scalar type, double by default |
- See also
- toSqrt(), class GaussianParams, GaussianForm