55inline constexpr int maxCountOf =
56 S::ValueDimensionStep == 0 ? 0
66inline constexpr bool blocksAddValues = [] {
67 if constexpr (IsComposite<In>)
69 return []<
typename... Blocks>(std::tuple<Blocks...> *) {
70 return ((!HasPlus<Blocks> && hasEqualSizes<Blocks>) && ...);
71 }(
static_cast<CompositeBlocks<In> *
>(
nullptr));
75 return !HasPlus<In> && hasEqualSizes<In>;
102template <
typename Path, Space MeasurementSpace>
106 internal::resizableBlockCount<MeasurementSpace> == 1,
107 "CountFrom's measurement space must have exactly one resizable block"
111 template <Space StateSpace>
112 [[nodiscard]] MeasurementSpace
115 using Block = internal::PathSubspaceType<StateSpace, Path>;
117 internal::resizableBlockCount<Block> == 1,
118 "CountFrom's block of the state must have exactly one resizable block"
121 internal::maxCountOf<MeasurementSpace> == Eigen::Dynamic
122 || (internal::maxCountOf<Block> != Eigen::Dynamic
123 && internal::maxCountOf<MeasurementSpace> >= internal::maxCountOf<Block>),
124 "CountFrom's measurement space must hold a block per repetition of the state's block at its largest"
126 Eigen::Index
const count = (
valueDimension(internal::pathSubspace<Path>(space)) - Block::FixedValueDimension)
127 / Block::ValueDimensionStep;
128 auto result = MeasurementSpace{};
129 result.resize(MeasurementSpace::FixedValueDimension + count * MeasurementSpace::ValueDimensionStep);
154template <
typename F,
typename... Policies>
158 using Set = internal::PolicySet<Policies...>;
167 static constexpr bool HasFunction = !std::is_same_v<F, internal::NoFunction>;
170 template <
internal::PolicyKind K>
174 template <
internal::PolicyKind K>
175 using Policy =
typename Set::template Type<K>;
180 , m_policies{std::move(
policies)...}
184 [[nodiscard]] F
const &
191 template <
internal::PolicyKind K>
195 return Set::template get<K>(m_policies);
199 [[nodiscard]] std::tuple<Policies...>
const &
208 std::tuple<Policies...> m_policies;
216inline constexpr bool isMeasurementFunction =
false;
219template <
typename F,
typename... Policies>
220inline constexpr bool isMeasurementFunction<MeasurementFunction<F, Policies...>>{
true};
240template <
typename Matrix>
249 explicit LinearFunction(Matrix matrix)
250 : m_matrix{std::move(matrix)}
254 [[nodiscard]] Matrix
const &
261 [[nodiscard]] Eigen::Index
264 return m_matrix.rows();
270 template <
typename In,
typename Out,
typename X>
272 operator()([[maybe_unused]] In
const & in, Out
const &, X
const & x)
const
276 "a linear measurement model reads blocks with no plus() of their own; a block such as a unit quaternion "
277 "has no linear measurement, so give measurementModel() a function"
282 "a linear measurement model's matrix must have a column per coordinate of the blocks it reads"
285 m_matrix.cols() == x.size()
286 &&
"a linear measurement model's matrix must have a column per coordinate of the blocks it reads"
288 using T =
typename X::Scalar;
289 using Value = Eigen::Matrix<T, Matrix::RowsAtCompileTime, 1, Eigen::ColMajor, Matrix::MaxRowsAtCompileTime, 1>;
290 Value value = m_matrix.template cast<T>() * x;
305 static constexpr bool IsPlaced =
false;
306 static constexpr bool Each =
false;
307 static constexpr int Rows = Eigen::Dynamic;
312template <MatrixExpression M,
typename P>
313struct ColumnsOf<OnPath<M, P>>
315 static constexpr bool IsPlaced =
true;
316 static constexpr bool Each =
false;
317 static constexpr int Rows = M::RowsAtCompileTime;
322template <MatrixExpression M,
typename P>
323 requires(!std::is_same_v<P, WholeSpace>)
324struct ColumnsOf<OnEach<M, P>>
326 static constexpr bool IsPlaced =
true;
327 static constexpr bool Each =
true;
328 static constexpr int Rows = M::RowsAtCompileTime;
333template <
int... Rows>
334inline constexpr int agreedRows = [] {
335 int result = Eigen::Dynamic;
336 for (
int const rows : std::array<
int,
sizeof...(Rows)>{Rows...})
338 if (rows == Eigen::Dynamic)
342 if (result != Eigen::Dynamic && rows != result)
352template <
typename... Placed>
353struct FirstEachPathOf
360template <
typename First,
typename... Rest>
361struct FirstEachPathOf<First, Rest...>
365 conditional_t<ColumnsOf<First>::Each,
typename ColumnsOf<First>::Path,
typename FirstEachPathOf<Rest...>::type>;
394template <
typename... Placed>
397 static_assert(
sizeof...(Placed) > 0,
"a model's matrix needs at least one block of columns");
399 (internal::ColumnsOf<Placed>::IsPlaced && ...),
400 "each block of a model's columns is a matrix placed on a block of the state, with on<Path>() or "
404 !(internal::ColumnsOf<Placed>::IsPlaced && ...)
405 || internal::distinctTypes<internal::AsTagPath<typename internal::ColumnsOf<Placed>::Path>...>(),
406 "a model's columns name each block of the state once"
409 internal::agreedRows<internal::ColumnsOf<Placed>::Rows...> != 0,
410 "every block of a model's columns has the rows of one repetition of the measurement"
416 static constexpr bool Repeats = (internal::ColumnsOf<Placed>::Each || ...);
419 static constexpr int Rows = internal::agreedRows<internal::ColumnsOf<Placed>::Rows...>;
429 : m_placed{std::move(
placed)...}
433 [&](
auto const &... each) {
434 return ((each.value.rows() ==
rows()) && ...);
438 &&
"every block of a model's columns has the rows of one repetition of the measurement"
443 [[nodiscard]] std::tuple<Placed...>
const &
450 [[nodiscard]] Eigen::Index
453 return std::get<0>(m_placed).value.rows();
458 std::tuple<Placed...> m_placed;
466inline constexpr bool isColumns =
false;
469template <
typename... Placed>
470inline constexpr bool isColumns<Columns<Placed...>>{
true};
478template <
typename Path,
int Rows>
479struct LinearPerRepetition
482 template <
typename StateSpace>
484 operator()(StateSpace
const & space)
const
486 using Block = PathSubspaceType<StateSpace, Path>;
488 Block::FixedValueDimension == 0 && Block::ValueDimensionStep > 0,
489 "a model's onEach<Path>() repeats over a resizable block of the state, and the block named is fixed-size"
491 return CountFrom<Path, Repeated<Linear<Rows>, maxCountOf<Block>>>{}(space);
501template <
typename... Placed>
505 using Scalar =
typename std::remove_cvref_t<
506 decltype(std::get<0>(std::declval<std::tuple<Placed...>
const &>()).value)>::Scalar;
513 using OutputSpaceType = Linear<Columns<Placed...>::Rows>;
516 explicit ColumnsFunction(Columns<Placed...> columns)
517 : m_columns{std::move(columns)}
521 [[nodiscard]] Columns<Placed...>
const &
530 [[nodiscard]] Eigen::Index
532 requires(!Columns<Placed...>::Repeats)
534 return m_columns.rows();
540 template <
typename In,
typename Out,
typename X>
542 operator()(In
const & in, Out
const & out, X
const & x)
const
546 "a linear measurement model reads blocks with no plus() of their own; a block such as a unit quaternion "
547 "has no linear measurement, so give measurementModel() a function"
549 using T =
typename X::Scalar;
550 constexpr int OutRows = Columns<Placed...>::Repeats ? Eigen::Dynamic : Columns<Placed...>::Rows;
551 constexpr int OutMaxRows =
553 using Value = Eigen::Matrix<T, OutRows, 1, Eigen::ColMajor, OutMaxRows, 1>;
556 Eigen::Index
const rows = m_columns.rows();
557 Eigen::Index
const count = [&] {
558 if constexpr (Columns<Placed...>::Repeats)
563 &&
"a linear model's matrices have a row per coordinate of one repetition of the measurement"
569 return Eigen::Index{1};
572 Jacobian jacobian = Jacobian::Zero(count * rows,
valueDimension(in));
573 Eigen::Index column = 0;
575 [&](
auto const &... placed) {
576 (place(placed, in, count, column, jacobian), ...);
582 &&
"a linear model's matrices must have a column per coordinate of the blocks they read"
584 Value value = jacobian.template cast<T>() * x;
585 return WithJacobian<Value, Jacobian>{std::move(value), std::move(jacobian)};
594 template <
typename P,
typename In,
typename Jacobian>
596 place(P
const & placed, In
const & in, Eigen::Index count, Eigen::Index & column, Jacobian & jacobian)
598 using C = ColumnsOf<P>;
599 using Name = PathTag<typename C::Path>;
600 auto const & matrix = placed.value;
601 Eigen::Index
const rows = matrix.rows();
602 Eigen::Index
const width =
valueDimension(pathSubspace<Name>(in));
603 if constexpr (C::Each)
605 using Block = PathSubspaceType<In, Name>;
607 Block::FixedValueDimension == 0 && Block::ValueDimensionStep > 0,
608 "a model's onEach<Path>() names a repeated block of the state"
610 constexpr int Cols = std::remove_cvref_t<
decltype(matrix)>::ColsAtCompileTime;
612 Cols == Eigen::Dynamic || Cols == Block::ValueDimensionStep,
613 "a model's onEach<Path>() matrix has a column per coordinate of one repetition of the block"
616 matrix.cols() * count == width
617 &&
"a model's onEach<Path>() blocks have the measurement's count of repetitions"
619 for (Eigen::Index i = 0; i < count; ++i)
621 jacobian.block(i * rows, column + i * matrix.cols(), rows, matrix.cols()) = matrix;
627 matrix.cols() == width
628 &&
"a linear model's matrix must have a column per coordinate of the block it reads"
630 for (Eigen::Index i = 0; i < count; ++i)
632 jacobian.block(i * rows, column, rows, matrix.cols()) = matrix;
638 Columns<Placed...> m_columns;
642template <PolicyKind K,
typename... Policies>
643inline constexpr bool hasPolicy = ((policyKind<std::remove_cvref_t<Policies>> == K) || ...);
646template <
typename... Paths>
648readsOf(TagPaths<Paths...> *)
659template <
typename Set>
660[[nodiscard]]
consteval bool
661checkMeasurementPolicies()
664 !Set::template has<PolicyKind::continuousNoise>,
665 "continuousNoise() is a process model's; a measurement model's noise is additiveNoise()"
668 !Set::template has<PolicyKind::affineIn> || Set::template has<PolicyKind::reads>,
669 "affineIn() names items of reads(), and a model without reads() reads the whole state under no names"
682 static constexpr int value = -1;
687 requires requires { &F::operator(); }
688struct CallArityOf<F> : CallArityOf<decltype(&F::operator())>
693template <
typename... A>
694struct ArityOfParameters
696 static constexpr int value =
sizeof...(A);
699template <
typename R,
typename... A>
700struct CallArityOf<R (*)(A...)> : ArityOfParameters<A...>
703template <
typename R,
typename... A>
704struct CallArityOf<R (*)(A...) noexcept> : ArityOfParameters<A...>
707template <
typename R,
typename C,
typename... A>
708struct CallArityOf<R (C::*)(A...)> : ArityOfParameters<A...>
711template <
typename R,
typename C,
typename... A>
712struct CallArityOf<R (C::*)(A...) noexcept> : ArityOfParameters<A...>
715template <
typename R,
typename C,
typename... A>
716struct CallArityOf<R (C::*)(A...) const> : ArityOfParameters<A...>
719template <
typename R,
typename C,
typename... A>
720struct CallArityOf<R (C::*)(A...) const noexcept> : ArityOfParameters<A...>
723template <
typename R,
typename C,
typename... A>
724struct CallArityOf<R (C::*)(A...) const &> : ArityOfParameters<A...>
727template <
typename R,
typename C,
typename... A>
728struct CallArityOf<R (C::*)(A...) const & noexcept> : ArityOfParameters<A...>
737template <
typename F,
typename Set>
738[[nodiscard]]
consteval auto
741 if constexpr (Set::template has<PolicyKind::outputSpace>)
743 return std::type_identity<void>{};
745 else if constexpr (Set::template has<PolicyKind::writes>)
747 return std::type_identity<typename Set::template Type<PolicyKind::writes>::OutputSpace>{};
749 else if constexpr (
requires {
typename F::OutputSpaceType; })
751 return std::type_identity<typename F::OutputSpaceType>{};
755 return std::type_identity<void>{};
767[[nodiscard]]
consteval int
768noiseRowsAtCompileTime()
770 if constexpr (MatrixExpression<X>)
772 return X::RowsAtCompileTime;
774 else if constexpr (
requires {
typename X::SpaceType; })
776 return differencesAtCompileTime<typename X::SpaceType>;
780 return Eigen::Dynamic;
787[[nodiscard]]
consteval bool
788noiseRowsFit(
int rows,
int coordinates)
790 return rows == Eigen::Dynamic || coordinates == Eigen::Dynamic || rows == coordinates;
794template <
typename Out,
typename X>
795[[nodiscard]]
consteval bool
796noisePartFits(X
const *)
798 return noiseRowsFit(noiseRowsAtCompileTime<X>(), differencesAtCompileTime<Out>);
802template <
typename Out,
typename X,
typename Path>
803[[nodiscard]]
consteval bool
804noisePartFits(OnPath<X, Path>
const *)
806 using Block =
typename EachBlockOf<Out, Path>::type;
807 return noiseRowsFit(noiseRowsAtCompileTime<std::remove_cvref_t<X>>(), differencesAtCompileTime<Block>);
813template <
typename Out,
typename X,
typename Path>
814[[nodiscard]]
consteval bool
815noisePartFits(OnEach<X, Path>
const *)
817 using Block =
typename EachBlockOf<Out, Path>::type;
818 if constexpr (
requires {
typename Block::BlockType; })
821 noiseRowsAtCompileTime<std::remove_cvref_t<X>>(),
822 differencesAtCompileTime<typename Block::BlockType>
834template <
typename Out,
typename... Parts>
835[[nodiscard]]
consteval bool
836noiseFits(AdditiveNoise<Parts...>
const *)
838 return (noisePartFits<Out>(
static_cast<std::remove_cvref_t<Parts>
const *
>(
nullptr)) && ...);
853template <
typename F,
typename Set>
854[[nodiscard]]
consteval bool
855checkMeasurementFunction()
857 constexpr int Arity = CallArityOf<F>::value;
859 Arity < 0 || (Arity >= 1 && Arity <= 3),
860 "a measurement model's function takes one to three arguments, h(x), h(in, x), or h(in, out, x), with in the "
861 "input space, out the output space, and x a vector in the input space"
864 !Set::template has<PolicyKind::sample>,
865 "a measurement model with a function draws its observation through the function and its noise, so sample(g) "
866 "is for a model known by its likelihood alone"
868 using Known =
typename decltype(knownOutputType<F, Set>())::type;
869 if constexpr (!std::is_void_v<Known> && Set::template has<PolicyKind::additiveNoise>)
872 noiseFits<Known>(
static_cast<typename Set::template Type<PolicyKind::additiveNoise>
const *
>(
nullptr)),
873 "a measurement model's additive noise has a row for each difference coordinate of the output space, from "
874 "writes() or the matrix's rows, or of the block it is placed on"
910template <
typename F,
typename... Policies>
911 requires(!
MatrixExpression<F> && !internal::ModelPolicy<F> && !internal::isColumns<std::remove_cvref_t<F>>)
915 using Set = internal::PolicySet<std::remove_cvref_t<Policies>...>;
916 static_assert(internal::checkMeasurementPolicies<Set>());
917 static_assert(internal::checkMeasurementFunction<std::decay_t<F>, Set>());
919 std::forward<F>(function),
920 std::forward<Policies>(policies)...
937template <MatrixExpression Matrix,
typename... Policies>
941 using Plain = internal::PlainResult<std::remove_cvref_t<Matrix>>;
942 using Set = internal::PolicySet<std::remove_cvref_t<Policies>...>;
943 static_assert(internal::checkMeasurementPolicies<Set>());
944 static_assert(internal::checkMeasurementFunction<internal::LinearFunction<Plain>, Set>());
946 internal::LinearFunction<Plain>{Plain{std::forward<Matrix>(matrix)}},
947 std::forward<Policies>(policies)...
957template <
typename... Placed,
typename... Policies>
961 using ColumnsType =
Columns<Placed...>;
963 !internal::hasPolicy<internal::PolicyKind::reads, Policies...>,
964 "a model given Columns reads the blocks its columns are placed on, so it takes no reads()"
966 auto const read = internal::readsOf(
static_cast<typename ColumnsType::Paths *
>(
nullptr));
967 using Function = internal::ColumnsFunction<Placed...>;
968 if constexpr (ColumnsType::Repeats && !internal::hasPolicy<internal::PolicyKind::outputSpace, Policies...>)
971 ColumnsType::Rows != Eigen::Dynamic,
972 "a model whose columns repeat infers its measurement space from its matrices' rows, so fix them at "
973 "compile time, or give it outputSpace() with a function such as CountFrom"
976 outputSpace(internal::LinearPerRepetition<typename ColumnsType::FirstEachPath, ColumnsType::Rows>{});
977 using Set = internal::PolicySet<
decltype(read),
decltype(space), std::remove_cvref_t<Policies>...>;
978 static_assert(internal::checkMeasurementFunction<Function, Set>());
979 return MeasurementFunction<Function,
decltype(read),
decltype(space), std::remove_cvref_t<Policies>...>{
980 Function{std::move(columns)},
983 std::forward<Policies>(policies)...
988 using Set = internal::PolicySet<
decltype(read), std::remove_cvref_t<Policies>...>;
989 static_assert(internal::checkMeasurementFunction<Function, Set>());
991 Function{std::move(columns)},
993 std::forward<Policies>(policies)...
1005template <internal::ModelPolicy... Policies>
1009 using Set = internal::PolicySet<std::remove_cvref_t<Policies>...>;
1010 static_assert(internal::checkMeasurementPolicies<Set>());
1012 Set::template has<internal::PolicyKind::logLikelihood>,
1013 "a measurement model without a function is known by its likelihood alone, so it takes logLikelihood(g)"
1016 !Set::template has<internal::PolicyKind::additiveNoise>,
1017 "a measurement model known by its likelihood alone has no function to add noise to"
1020 internal::NoFunction{},
1021 std::forward<Policies>(policies)...
1039enum class ArgumentKind
1051template <
typename T>
1052[[nodiscard]] T
const &
1053inputOf(T
const & argument)
1059template <
typename T>
1060inline constexpr ArgumentKind argumentKind = [] {
1061 using Plain = std::remove_cvref_t<T>;
1062 if constexpr (isSure<Plain>)
1064 return ArgumentKind::sure;
1066 else if constexpr (UncertainInput<Plain>)
1068 return ArgumentKind::uncertain;
1070 else if constexpr (isLinearizedAbout<Plain>)
1072 return ArgumentKind::reference;
1074 else if constexpr (CovarianceUpdate<Plain>)
1076 return ArgumentKind::form;
1078 else if constexpr (Repair<Plain>)
1080 return ArgumentKind::repair;
1082 else if constexpr (isConsider<Plain>)
1084 return ArgumentKind::consider;
1088 return ArgumentKind::other;
1095template <
typename T>
1102template <
typename T>
1103 requires(argumentKind<T> == ArgumentKind::uncertain || argumentKind<T> == ArgumentKind::sure)
1107 typename std::remove_cvref_t<
decltype(inputOf(std::declval<std::remove_cvref_t<T>
const &>()))>::SpaceType;
1113template <
typename T>
1114using InputTag =
typename InputTagOf<T>::type;
1123template <
typename... Args>
1124[[nodiscard]]
consteval bool
1128 ((argumentKind<Args> != ArgumentKind::other) && ...),
1129 "an argument after the observation is an uncertain input over a tagged space, sure<Tag>(value), a covariance "
1130 "update form such as updates::joseph(), a repair of the innovation covariance such as roots::ridge(), or the "
1131 "blocks to consider, consider(path<Bias>); after a prediction's step, an uncertain or a sure input, or a "
1132 "linearizedAbout() reference first"
1135 (std::size_t{argumentKind<Args> == ArgumentKind::reference} + ... + 0) <= 1,
1136 "give the linearizedAbout() reference once"
1139 ((argumentKind<Args> != ArgumentKind::uncertain || !IsUntagged<InputTag<Args>>) && ...),
1140 "an uncertain input is named by the tag of its space, so give it over a tag such as struct SpecificForce : "
1144 (std::size_t{argumentKind<Args> == ArgumentKind::form} + ... + 0) <= 1,
1145 "give the covariance update form once"
1148 (std::size_t{argumentKind<Args> == ArgumentKind::repair} + ... + 0) <= 1,
1149 "give the repair of the innovation covariance once"
1152 (std::size_t{argumentKind<Args> == ArgumentKind::consider} + ... + 0) <= 1,
1153 "give the blocks to consider in one consider()"
1157 std::conditional_t<std::is_void_v<InputTag<Args>>, std::type_identity<Args>, InputTag<Args>>...>(),
1158 "two inputs of the call have one tag; an input's tag names it once"
1164template <ArgumentKind K,
typename Default,
typename... Args>
1165struct ArgumentOfKindOf
1167 using type = Default;
1171template <ArgumentKind K,
typename Default,
typename First,
typename... Rest>
1172struct ArgumentOfKindOf<K, Default, First, Rest...>
1174 using type = std::conditional_t<
1175 argumentKind<First> == K,
1176 std::remove_cvref_t<First>,
1177 typename ArgumentOfKindOf<K, Default, Rest...>::type>;
1183template <ArgumentKind K,
typename Default,
typename... Args>
1184using ArgumentOfKind =
typename ArgumentOfKindOf<K, Default, Args...>::type;
1187template <ArgumentKind K,
typename Default,
typename... Args>
1188[[nodiscard]]
auto const &
1189argumentOfKind(std::tuple<Args...>
const & args, Default
const & fallback)
1191 using Result = ArgumentOfKind<K, Default, Args...>;
1192 constexpr std::size_t position = [] {
1193 constexpr auto kinds = std::array<ArgumentKind,
sizeof...(Args)>{argumentKind<Args>...};
1194 for (std::size_t i = 0; i < kinds.size(); ++i)
1201 return sizeof...(Args);
1203 if constexpr (position <
sizeof...(Args))
1205 return static_cast<Result
const &
>(std::get<position>(args));
1230template <
typename Method,
typename Model,
typename Observation,
typename... Args>
1239 static constexpr bool HasMethod = !std::is_same_v<Method, internal::NoMethod>;
1242 static constexpr bool HasObservation = !std::is_same_v<Observation, internal::NoObservation>;
1250 using InnovationRepair = internal::ArgumentOfKind<internal::ArgumentKind::repair, internal::NoRepair, Args...>;
1253 using ConsiderType = internal::ArgumentOfKind<internal::ArgumentKind::consider, Consider<>, Args...>;
1255 static_assert(internal::isModel<ModelType>,
"an observation is of a model");
1256 static_assert(internal::checkArguments<Args...>());
1259 template <
typename M,
typename Z>
1261 : m_method{std::move(
method)}
1262 , m_model(std::forward<M>(
model))
1264 , m_arguments{std::move(args)...}
1268 EMRYS_FILTER_ASSERT(m_observation.cols() == 1 &&
"an observation is a column vector");
1273 [[nodiscard]] Method
const &
1287 [[nodiscard]] Observation
const &
1290 return m_observation;
1304 return internal::argumentOfKind<internal::ArgumentKind::form>(m_arguments, m_standard);
1320template <
typename T>
1321inline constexpr bool isObserved =
false;
1324template <
typename Method,
typename Model,
typename Observation,
typename... Args>
1325inline constexpr bool isObserved<Observed<Method, Model, Observation, Args...>>{
true};
1336template <
typename M>
1337concept Measurement = internal::isObserved<std::remove_cvref_t<M>> && std::remove_cvref_t<M>::HasObservation;
1343template <
typename M>
1349template <
typename M>
1350inline constexpr bool hasOwnLikelihood = std::remove_cvref_t<M>::ModelType::template has<PolicyKind::logLikelihood>;
1353template <
typename M>
1354inline constexpr bool hasInnovationRepair =
1355 !std::is_same_v<typename std::remove_cvref_t<M>::InnovationRepair, NoRepair>;
1358template <
typename M>
1359inline constexpr bool hasConsider = std::remove_cvref_t<M>::ConsiderType::Count > 0;
1362template <
typename F>
1363inline constexpr bool isLinearFunction =
false;
1366template <
typename Matrix>
1367inline constexpr bool isLinearFunction<LinearFunction<Matrix>>{
true};
1369template <
typename... Placed>
1370inline constexpr bool isLinearFunction<ColumnsFunction<Placed...>>{
true};
1376template <
typename Model>
1377using MethodWithoutOne =
1378 std::conditional_t<isLinearFunction<typename Model::FunctionType>,
methods::Linearized, NoMethod>;
1399observe(Method method, M && model, Z && observation, Args &&... args)
1401 using Stored = std::unwrap_ref_decay_t<M>;
1402 using Observation =
typename internal::CrtpDerived<Z>::PlainObject;
1405 std::forward<M>(model),
1406 std::forward<Z>(observation),
1407 std::forward<Args>(args)...
1425template <
typename M, MatrixExpression Z,
typename... Args>
1426 requires MeasurementModel<std::unwrap_ref_decay_t<M>>
1428observe(M && model, Z && observation, Args &&... args)
1430 using Stored = std::unwrap_ref_decay_t<M>;
1431 using Observation =
typename internal::CrtpDerived<Z>::PlainObject;
1432 using Method = internal::MethodWithoutOne<Stored>;
1435 std::forward<M>(model),
1436 std::forward<Z>(observation),
1437 std::forward<Args>(args)...
1448template <
typename M,
typename... Args>
1449 requires isModel<std::remove_cvref_t<std::unwrap_ref_decay_t<M>>>
1451modelWith(M && model, Args &&... args)
1453 using Stored = std::unwrap_ref_decay_t<M>;
1454 return Observed<NoMethod, Stored, NoObservation, std::unwrap_ref_decay_t<Args>...>{
1456 std::forward<M>(model),
1458 std::forward<Args>(args)...
Spaces built from other spaces (decisions.md [sizes-and-dimensions], [several-resizable-blocks]): Com...
The Kalman conditioning of a marked input on an observation of a transform's output (decisions....
The coordinate types (decisions.md [no-bounded-coordinates]): Linear, plain coordinates,...
How a function that stores a matrix argument takes it (decisions.md [forwarded-matrices]): the concep...
The Gaussian: its parameters GaussianParams, the Gaussian that evaluates the density,...
The macros every header includes first.
The transform methods, as policies made by their factories (decisions.md [policy-factories],...
The policies a model is built from, and the marks on a step's arguments (decisions....
Square roots of a covariance (decisions.md [sigma-point-axes]): the Axes and Repair concepts that a r...
The Space concept and what every continuous space shares (decisions.md [sizes-and-dimensions]): the t...
Subspaces, and growing and shrinking blocks (decisions.md [several-resizable-blocks]).
Tag paths and the index utilities (decisions.md [tag-addressing], [index-names]): TagPath and TagPath...
The matrix of a linear measurement model by its columns: a matrix per block of the state read,...
Definition MeasurementModel.h:396
static constexpr bool Repeats
whether the measurement repeats, with a block of the state read per repetition by onEach()
Definition MeasurementModel.h:416
TagPaths< typename internal::ColumnsOf< Placed >::Path... > Paths
The paths read, in order, as a TagPaths.
Definition MeasurementModel.h:422
Eigen::Index rows() const
Definition MeasurementModel.h:451
typename internal::FirstEachPathOf< Placed... >::type FirstEachPath
The path of the first block read per repetition, or void.
Definition MeasurementModel.h:425
Columns(Placed... placed)
The matrices placed.
Definition MeasurementModel.h:428
static constexpr int Rows
the rows of one repetition of the measurement, or Eigen::Dynamic
Definition MeasurementModel.h:419
std::tuple< Placed... > const & placed() const
Definition MeasurementModel.h:444
A measurement model: a function of its input, with the policies that say what it reads,...
Definition MeasurementModel.h:156
static constexpr bool IsModel
a model, for internal::isModel
Definition MeasurementModel.h:164
Policy< K > const & policy() const
Definition MeasurementModel.h:193
typename Set::template Type< K > Policy
The policy of kind K, or internal::NoPolicy.
Definition MeasurementModel.h:175
std::tuple< Policies... > const & policies() const
Definition MeasurementModel.h:200
static constexpr bool HasFunction
whether the model has a function; a model known by its likelihood alone has none
Definition MeasurementModel.h:167
F const & function() const
Definition MeasurementModel.h:185
MeasurementFunction(F function, Policies... policies)
The model of function with policies.
Definition MeasurementModel.h:178
F FunctionType
the function
Definition MeasurementModel.h:162
static constexpr bool has
Whether the policy of kind K was given.
Definition MeasurementModel.h:171
An observation of a measurement model: the observed value, the model, the method that pushes the stat...
Definition MeasurementModel.h:1232
ModelType const & model() const
Definition MeasurementModel.h:1281
static constexpr bool HasObservation
whether an observed value was given
Definition MeasurementModel.h:1242
FormType const & covarianceUpdate() const
Definition MeasurementModel.h:1302
Observed(Method method, M &&model, Z &&observation, Args... args)
The observation observation of model by method, with the call's args.
Definition MeasurementModel.h:1260
static constexpr bool HasMethod
whether a method was given
Definition MeasurementModel.h:1239
ArgumentsType const & arguments() const
Definition MeasurementModel.h:1295
internal::ArgumentOfKind< internal::ArgumentKind::consider, Consider<>, Args... > ConsiderType
The blocks the update considers rather than estimates, or Consider<> (decisions.md [consider-states])...
Definition MeasurementModel.h:1253
std::tuple< Args... > ArgumentsType
the arguments, as held
Definition MeasurementModel.h:1238
std::remove_cvref_t< Model > ModelType
the model's type
Definition MeasurementModel.h:1236
internal::ArgumentOfKind< internal::ArgumentKind::form, updates::Standard, Args... > FormType
The covariance update form given, or updates::Standard.
Definition MeasurementModel.h:1245
Method const & method() const
Definition MeasurementModel.h:1274
Method MethodType
the method
Definition MeasurementModel.h:1235
Observation const & observation() const
Definition MeasurementModel.h:1288
Observation ObservationType
the observed value's type
Definition MeasurementModel.h:1237
internal::ArgumentOfKind< internal::ArgumentKind::repair, internal::NoRepair, Args... > InnovationRepair
The repair of an innovation covariance that is not positive definite, or internal::NoRepair (decision...
Definition MeasurementModel.h:1250
A dense matrix or matrix expression, possibly cv- or reference-qualified: what a const Eigen::MatrixB...
Definition Forwarding.h:39
A measurement model: what measurementModel() returns, or a composition of such models (decisions....
Definition MeasurementModel.h:231
A measurement: an observed value with its model and the call's inputs, and the method a Kalman update...
Definition MeasurementModel.h:1337
#define EMRYS_FILTER_NO_UNIQUE_ADDRESS
Assertion used for programmer errors (misuse of the API).
Definition Macros.h:38
OutputSpace< std::remove_cvref_t< X > > outputSpace(X &&x)
Definition Policies.h:718
auto observe(Method method, M &&model, Z &&observation, Args &&... args)
Definition MeasurementModel.h:1399
auto measurementModel(F &&function, Policies &&... policies)
Definition MeasurementModel.h:913
Eigen::Index valueDimension(S const &space)
Definition Space.h:272
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 TagPath< Tags... > path
The path TagPath<Tags...> as a value, for a call that takes its paths as arguments rather than as tem...
Definition TagPath.h:372
The measurement space function of a model whose measurement has a block of MeasurementSpace per repet...
Definition MeasurementModel.h:104
MeasurementSpace operator()(StateSpace const &space) const
Definition MeasurementModel.h:113
Dimension_ plain coordinates, or a resizable run of at most MaxDimension_ of them if Dimension_ is Ei...
Definition Coordinates.h:87
A list of tag paths, each a tag or a TagPath, such as the blocks a measurement reads (TagPaths<Positi...
Definition TagPath.h:363
What a function returns when it knows its Jacobian: its value, and the Jacobian of its output differe...
Definition Methods.h:46
Linearized method: and , with the Jacobians of f at the input means.
Definition Methods.h:327
The standard covariance update of condition(): , which is written without .
Definition Condition.h:75