Skip to content

Commit

Permalink
[filter] constexpr some operations
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCarouge committed Oct 27, 2022
1 parent 6f86c82 commit ffcc289
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/fcarouge/internal/kalman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct kalman<State, Output, void, Divide, pack<UpdateTypes...>,
using update_types = std::tuple<UpdateTypes...>;
using prediction_types = std::tuple<PredictionTypes...>;

inline static const auto i{identity_v<matrix<state, state>>};
static inline const auto i{identity_v<matrix<state, state>>};

state x{zero_v<state>};
estimate_uncertainty p{identity_v<estimate_uncertainty>};
Expand Down Expand Up @@ -214,7 +214,7 @@ struct kalman<State, Output, Input, Divide, pack<UpdateTypes...>,
using update_types = std::tuple<UpdateTypes...>;
using prediction_types = std::tuple<PredictionTypes...>;

inline static const auto i{identity_v<matrix<state, state>>};
static inline const auto i{identity_v<matrix<state, state>>};

state x{zero_v<state>};
estimate_uncertainty p{identity_v<estimate_uncertainty>};
Expand Down
9 changes: 5 additions & 4 deletions include/fcarouge/internal/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,24 @@ constexpr void for_constexpr(Function &&function) {
}

template <typename Type>
inline const Type identity_v{
inline constexpr Type identity_v{
//! @todo Implement standard, default form.
};

template <arithmetic Arithmetic>
inline const Arithmetic identity_v<Arithmetic>{1};
inline constexpr Arithmetic identity_v<Arithmetic>{1};

template <typename Matrix>
requires requires(Matrix value) { value.Identity(); }
inline const auto identity_v<Matrix>{Matrix::Identity()};

template <typename Type>
inline const Type zero_v{
inline constexpr Type zero_v{
//! @todo Implement standard, default form.
};

template <arithmetic Arithmetic> inline const Arithmetic zero_v<Arithmetic>{0};
template <arithmetic Arithmetic>
inline constexpr Arithmetic zero_v<Arithmetic>{0};

template <typename Matrix>
requires requires(Matrix value) { value.Zero(); }
Expand Down

0 comments on commit ffcc289

Please sign in to comment.