Skip to content

Commit

Permalink
[linalg] avoid auto and deduce type
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCarouge committed Jan 13, 2025
1 parent c8de63e commit efa8082
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions include/fcarouge/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ inline constexpr Arithmetic identity<Arithmetic>{1};

template <typename Type>
requires requires { Type::Identity(); }
inline auto identity<Type>{Type::Identity()};
inline Type identity<Type>{Type::Identity()};

template <typename Type>
requires requires { Type::identity(); }
inline auto identity<Type>{Type::identity()};
inline Type identity<Type>{Type::identity()};

//! @brief The zero matrix.
//!
Expand All @@ -272,11 +272,11 @@ inline constexpr Arithmetic zero<Arithmetic>{0};

template <typename Type>
requires requires { Type::Zero(); }
inline auto zero<Type>{Type::Zero()};
inline Type zero<Type>{Type::Zero()};

template <typename Type>
requires requires { Type::zero(); }
inline auto zero<Type>{Type::zero()};
inline Type zero<Type>{Type::zero()};

//! @}

Expand Down
1 change: 0 additions & 1 deletion test/kalman_f_5x4x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ template <auto Row, auto Column> using matrix = matrix<double, Row, Column>;
[[maybe_unused]] auto test{[] {
const auto i5x5{identity<matrix<5, 5>>};
const auto z5x5{zero<matrix<5, 5>>};
const vector<3> z3{zero<vector<3>>};
kalman filter{state{vector<5>{0., 0., 0., 0., 0.}}, output<vector<4>>,
input<vector<3>>, update_types<double, float, int>,
prediction_types<int, float, double>};
Expand Down
2 changes: 1 addition & 1 deletion test/linalg_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace fcarouge::test {
namespace {
//! @test Verifies the zero matrices values are null.
[[maybe_unused]] auto test{[] {
auto z{zero<matrix<double, 3, 3>>};
matrix z{zero<matrix<double, 3, 3>>};

assert(z(0, 0) == 0.0);
assert(z(0, 1) == 0.0);
Expand Down

0 comments on commit efa8082

Please sign in to comment.