EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ > Class Template Reference

Fixed points for the block named by the path Path_ of a state in Space_, one per value of the discrete space Cells_, such as the cells of a grid of positions. More...

#include <EmrysFilter/Distributions/GridGaussian.h>

Public Types

using Scalar = Scalar_
 The scalar type.
using SpaceType = Space_
 The whole state space.
using CellsType = Cells_
 The discrete space of cells.
using PathType = Path_
 The path naming the fixed block.
using CellCovarianceType = CellCovariance_
 SharedCovariance or PerPointCovariance.
using allocator_type = Allocator_
 The allocator, re-bound per buffer.
using PinnedSpace = typename internal::BlockSplit<Space_, Path_>::PinnedSpace
 The space of the fixed block.
using RestSpace = typename internal::BlockSplit<Space_, Path_>::RestSpace
 The space of the rest of the state, in order.
using CentersType = SampleSet<PinnedSpace, Scalar_>
 A plain matrix of centers, one per column, laid out as centers() is.
using PinnedVector = typename Moments<PinnedSpace, Scalar_>::VectorType
 A value of the block, such as a center.
using PinnedMatrix = typename Moments<PinnedSpace, Scalar_>::MatrixType
 A covariance over the block.

Public Member Functions

template<typename CentersDerived>
requires (Shared && !Regular)
 PointGrid (Space_ space, Cells_ cells, Eigen::MatrixBase< CentersDerived > const &centers, std::optional< PinnedMatrix > cellCovariance={}, Allocator_ const &allocator={})
 Points in space with centers, one column per value of cells in flat-index order, and cellCovariance, every cell's covariance about its center (none by default).
template<typename CentersDerived>
requires (!Shared && !Regular)
 PointGrid (Space_ space, Cells_ cells, Eigen::MatrixBase< CentersDerived > const &centers, std::span< PinnedMatrix const > cellCovariances, Allocator_ const &allocator={})
 Points in space with centers, one column per value of cells in flat-index order, and cellCovariances, each cell's covariance about its center, in the same order, from any contiguous storage.
 PointGrid (Space_ space, Cells_ cells, PinnedVector first, PinnedVector spacing, std::optional< PinnedMatrix > cellCovariance={}, Allocator_ const &allocator={})
 A regular grid in space over cells, whose cell with coordinates \( c \) (see DiscreteProduct::coordinates()) has its center at \( \mathit{first} + c \, \mathit{spacing} \), each coordinate scaling its axis's spacing, and cellCovariance, every cell's covariance about its center (none by default).
 PointGrid (Space_ space, Cells_ cells, PinnedVector first, PinnedVector spacing, std::span< PinnedMatrix const > cellCovariances, Allocator_ const &allocator={})
 A regular grid as above, with cellCovariances, each cell's covariance about its center in flat-index order.
allocator_type get_allocator () const
Space_ const & space () const
Cells_ const & cells () const
PinnedSpace const & pinnedSpace () const
RestSpace const & restSpace () const
Eigen::Index size () const
PinnedVector center (Eigen::Index cell) const
ConstSampleSetMap< PinnedSpace, Scalar_ > centers () const
PinnedVector const & first () const
PinnedVector const & spacing () const
bool hasCellCovariance () const
PinnedMatrix const & cellCovariance (Eigen::Index cell) const
BlockRows pinnedRows () const
auto const & restIndices () const
BlockRows pinnedDifferenceRows () const
auto const & restDifferenceIndices () const
PointGrid subdivided (Eigen::Index factor) const

Static Public Attributes

static constexpr bool Regular = internal::IsGridCells<Cells_>::value
 Whether the grid is regular: its cells are GridCells, and its centers are computed.

Detailed Description

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
class Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >

Fixed points for the block named by the path Path_ of a state in Space_, one per value of the discrete space Cells_, such as the cells of a grid of positions.

The grid of the point-mass filter of Bucy and Senne (1971), here for one block of the state only, with the rest Gaussian [rb-point-mass].

Each point is the center of its cell. With Cells_ GridCells, the grid is regular: the centers are computed from the first one and the spacing, and the grid can be subdivided (see subdivided()). Otherwise the centers are given and stored.

A cell may also have a covariance about its center: by default none, making each cell a point mass. With CellCovariance_ SharedCovariance there is at most one, the same for every cell, such as \( \mathrm{diag}(s^2 / 12) \) for a grid with spacing \( s \). With PerPointCovariance, each cell has its own, as cells of different sizes do (an irregular set of points, or a latitude-longitude grid). See RbPointMassFilter for what a cell covariance does and doesn't account for.

Template Parameters
Space_the whole state space
Path_the block the points fix, as a tag or a TagPath
Cells_the discrete space of cells (see Discrete spaces)
CellCovariance_SharedCovariance or PerPointCovariance, for the cells' covariances
Scalar_scalar type, double by default
Allocator_allocator for the stored centers and covariances, and for the GridGaussian over the grid (see Allocation)
See also
regularGrid(), pointGrid(), GridGaussian, RbPointMassFilter

Constructor & Destructor Documentation

◆ PointGrid()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
template<typename CentersDerived>
requires (Shared && !Regular)
Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::PointGrid ( Space_ space,
Cells_ cells,
Eigen::MatrixBase< CentersDerived > const & centers,
std::optional< PinnedMatrix > cellCovariance = {},
Allocator_ const & allocator = {} )
inline

Points in space with centers, one column per value of cells in flat-index order, and cellCovariance, every cell's covariance about its center (none by default).

The centers are copied into the grid's storage, so a map over a buffer of one's own passes them without allocating.

Member Function Documentation

◆ cellCovariance()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
PinnedMatrix const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::cellCovariance ( Eigen::Index cell) const
inlinenodiscard
Returns
the covariance about its center of the cell with flat index cell; the cells must have them

◆ cells()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
Cells_ const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::cells ( ) const
inlinenodiscard
Returns
the discrete space of cells, with its cardinalities

◆ center()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
PinnedVector Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::center ( Eigen::Index cell) const
inlinenodiscard
Returns
the center of the cell with flat index cell

◆ centers()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
ConstSampleSetMap< PinnedSpace, Scalar_ > Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::centers ( ) const
inlinenodiscard
Returns
every cell's center, one per column

◆ first()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
PinnedVector const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::first ( ) const
inlinenodiscard
Returns
the center of the first cell of a regular grid

◆ get_allocator()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
allocator_type Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::get_allocator ( ) const
inlinenodiscard
Returns
the allocator the stored centers and covariances come from

◆ hasCellCovariance()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
bool Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::hasCellCovariance ( ) const
inlinenodiscard
Returns
whether the cells have covariances about their centers, rather than being point masses

◆ pinnedDifferenceRows()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
BlockRows Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::pinnedDifferenceRows ( ) const
inlinenodiscard
Returns
the rows of the fixed block in the whole state's differences

◆ pinnedRows()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
BlockRows Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::pinnedRows ( ) const
inlinenodiscard
Returns
the rows of the fixed block in the whole state

◆ pinnedSpace()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
PinnedSpace const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::pinnedSpace ( ) const
inlinenodiscard
Returns
the fixed block's space, with its parameters

◆ restDifferenceIndices()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
auto const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::restDifferenceIndices ( ) const
inlinenodiscard
Returns
the rows of the rest of the state in the whole state's differences, in order

◆ restIndices()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
auto const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::restIndices ( ) const
inlinenodiscard
Returns
the rows of the rest of the state in the whole state, in order

◆ restSpace()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
RestSpace const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::restSpace ( ) const
inlinenodiscard
Returns
the space of the rest of the state, in order

◆ size()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
Eigen::Index Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::size ( ) const
inlinenodiscard
Returns
the number of cells

◆ space()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
Space_ const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::space ( ) const
inlinenodiscard
Returns
the whole state space

◆ spacing()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
PinnedVector const & Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::spacing ( ) const
inlinenodiscard
Returns
the spacing of a regular grid along each axis

◆ subdivided()

template<Space Space_, typename Path_, DiscreteSpace Cells_, typename CellCovariance_ = SharedCovariance, RealScalar Scalar_ = double, typename Allocator_ = DefaultAllocator>
PointGrid Emrys::PointGrid< Space_, Path_, Cells_, CellCovariance_, Scalar_, Allocator_ >::subdivided ( Eigen::Index factor) const
inlinenodiscard
Returns
the regular grid with each cell split into factor cells along each axis: the spacing divided by factor, the centers spread evenly over each old cell, and the cell covariance divided by factor squared. The cell with coordinates \( c \) becomes the cells with coordinates \( \mathit{factor} \, c + a \), \( 0 \le a_i < \mathit{factor} \).

With the covariance \( \mathrm{diag}(s^2 / 12) \) of a cell of width \( s \), the new cells' spread and covariances together match the old cell's covariance exactly.


The documentation for this class was generated from the following file: