26using ScalarOf =
typename std::remove_cvref_t<X>::Scalar;
53template <Space Space_, RealScalar Scalar_ =
double>
96 template <MatrixExpression Mean, CovarianceExpression Cov>
98 : m_mean{std::forward<Mean>(
mean)}
99 , m_cov{std::forward<Cov>(cov)}
101 EMRYS_FILTER_ASSERT(m_cov.rows() == m_cov.cols() &&
"the covariance must be square");
103 (!internal::hasEqualSizes<Space_> || m_cov.rows() == m_mean.size())
104 &&
"the covariance must have a row per coordinate of the mean"
112 return m_mean.size();
171 template <
typename Path>
182 template <
typename Path>
190 template <
typename RowPath,
typename ColPath>
198 template <
typename Path>
199 [[nodiscard]]
decltype(
auto)
206 template <
typename Path>
207 [[nodiscard]]
decltype(
auto)
221#ifndef EMRYS_FILTER_NO_IO
231describe(std::ostream & stream,
MomentsError error, Indent indent)
237 stream <<
"the moments are infinite";
243template <
typename Space_,
typename Scalar_>
245describe(std::ostream & stream, Moments<Space_, Scalar_>
const & moments, Indent indent)
247 stream << indent <<
"moments";
248 printDimension(stream, moments.valueDimension(), moments.differenceDimension());
249 printMoments(stream, indent.deeper(), moments);
How a function that stores a matrix argument takes it (decisions.md [forwarded-matrices]): the concep...
The macros every header includes first.
Mathematical constants and scalar functions that work in every scalar type the library accepts,...
Printing: operator<< and std::formatter for every distribution, every filter (which prints its name a...
The Space concept and what every continuous space shares (decisions.md [sizes-and-dimensions]): the t...
Tag paths and the index utilities (decisions.md [tag-addressing], [index-names]): TagPath and TagPath...
decltype(auto) covarianceLower()
Definition Moments.h:208
Space_ SpaceType
Definition Moments.h:60
MatrixType const & covarianceLower() const
Definition Moments.h:148
Scalar_ Scalar
Definition Moments.h:58
Eigen::Index Index
Definition Moments.h:59
MatrixType & covarianceLower()
Definition Moments.h:162
DifferenceMatrix< Space_, Space_, Scalar > MatrixType
Definition Moments.h:76
DifferenceVector< Space_, Scalar > DifferenceVectorType
Definition Moments.h:75
Index differenceDimension() const
Definition Moments.h:117
Moments(Mean &&mean, Cov &&cov)
Constructs moments from mean and cov, moving either one passed as an rvalue of the stored type.
Definition Moments.h:97
ValueVector< Space_, Scalar > VectorType
Definition Moments.h:74
Moments(Index valueDimension, Index differenceDimension)
Constructs moments with valueDimension coordinates in the mean and differenceDimension in the covaria...
Definition Moments.h:83
auto covarianceLower() const
Definition Moments.h:184
Index valueDimension() const
Definition Moments.h:110
Moments(Space_ const &space)
Constructs moments sized for space, with uninitialized contents.
Definition Moments.h:89
VectorType & mean()
Definition Moments.h:155
static constexpr int MaxDifferenceDimensionAtCompileTime
Definition Moments.h:72
VectorType const & mean() const
Definition Moments.h:141
decltype(auto) mean()
Definition Moments.h:200
void resize(Index valueDimension, Index differenceDimension)
Definition Moments.h:126
auto covarianceLower() const
Definition Moments.h:192
auto mean() const
Definition Moments.h:173
static constexpr int DifferenceDimensionAtCompileTime
Definition Moments.h:69
static constexpr int MaxValueDimensionAtCompileTime
Definition Moments.h:66
static constexpr int ValueDimensionAtCompileTime
Definition Moments.h:63
void resize(Space_ const &space)
Resizes the mean and covariance for space.
Definition Moments.h:134
MomentsError
Reasons a distribution's moments() can fail.
Definition Moments.h:32
typename std::remove_cvref_t< X >::Scalar ScalarOf
The scalar type of the Eigen object or distribution X, for writing functions generic in it.
Definition Moments.h:26
@ Infinite
the distribution has no finite mean or covariance, such as a Student-t with
Definition Moments.h:33
Eigen::Index valueDimension(S const &space)
Definition Space.h:272
constexpr auto diffIdx()
idx<S, Path>() of the differences of the subspace named by Path: its rows of a covariance.
Definition TagPath.h:669
ValueVector< DifferenceSpace< S >, Scalar > DifferenceVector
A difference in S as an Eigen column vector of Scalar, the type of minus() and of the offset plus() t...
Definition Space.h:650
Eigen::Index differenceDimension(S const &space)
Definition Space.h:284
constexpr int valueDimensionAtCompileTime
The value dimension of Space at compile time, or Eigen::Dynamic if it is resizable.
Definition Space.h:251
constexpr int maxValueDimensionAtCompileTime
The largest valid value dimension of Space, or Eigen::Dynamic if it is unbounded.
Definition Space.h:258
constexpr auto idx()
Definition TagPath.h:658
internal::MatrixOf< Scalar, valueDimensionAtCompileTime< DifferenceSpace< Rows > >, valueDimensionAtCompileTime< DifferenceSpace< Cols > >, maxValueDimensionAtCompileTime< DifferenceSpace< Rows > >, maxValueDimensionAtCompileTime< DifferenceSpace< Cols > > > DifferenceMatrix
An Eigen matrix of Scalar over the differences of Rows and Cols: a covariance, with one space for bot...
Definition Space.h:659
Eigen::Matrix< Scalar, valueDimensionAtCompileTime< S >, 1, Eigen::ColMajor, maxValueDimensionAtCompileTime< S >, 1 > ValueVector
A value in S as an Eigen column vector of Scalar: a mean, a sample, or a true state.
Definition Space.h:640