Skip to content

Commit

Permalink
Merge pull request #3844 from pleroy/Arrays
Browse files Browse the repository at this point in the history
Change the vector and matrix classes to reexport their Scalar parameter
  • Loading branch information
pleroy authored Jan 14, 2024
2 parents c6178dc + 4bd57e7 commit 09a072a
Show file tree
Hide file tree
Showing 5 changed files with 393 additions and 387 deletions.
17 changes: 11 additions & 6 deletions numerics/fixed_arrays.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ using namespace principia::quantities::_si;

// TODO(phl): This should support the same operations as unbounded_arrays.hpp.

template<typename Scalar, int rows, int columns>
template<typename Scalar_, int rows, int columns>
class FixedMatrix;

template<typename Scalar, int size_>
template<typename Scalar_, int size_>
class FixedVector final {
public:
using Scalar = Scalar_;
static constexpr int dimension = size_;

constexpr FixedVector();
Expand Down Expand Up @@ -78,9 +79,10 @@ class FixedVector final {
FixedVector<R, c> const& right);
};

template<typename Scalar, int rows_, int columns_>
template<typename Scalar_, int rows_, int columns_>
class FixedMatrix final {
public:
using Scalar = Scalar_;
static constexpr int rows() { return rows_; }
static constexpr int columns() { return columns_; }
static constexpr int size() { return rows_ * columns_; }
Expand Down Expand Up @@ -126,9 +128,10 @@ class FixedMatrix final {
FixedVector<R, c> const& right);
};

template<typename Scalar, int rows_>
template<typename Scalar_, int rows_>
class FixedStrictlyLowerTriangularMatrix final {
public:
using Scalar = Scalar_;
static constexpr int rows() { return rows_; }
static constexpr int columns() { return rows_; }
static constexpr int size() { return rows_ * (rows_ - 1) / 2; }
Expand Down Expand Up @@ -156,9 +159,10 @@ class FixedStrictlyLowerTriangularMatrix final {
std::array<Scalar, size()> data_;
};

template<typename Scalar, int rows_>
template<typename Scalar_, int rows_>
class FixedLowerTriangularMatrix final {
public:
using Scalar = Scalar_;
static constexpr int rows() { return rows_; }
static constexpr int columns() { return rows_; }
static constexpr int size() { return rows_ * (rows_ + 1) / 2; }
Expand All @@ -183,9 +187,10 @@ class FixedLowerTriangularMatrix final {
std::array<Scalar, size()> data_;
};

template<typename Scalar, int columns_>
template<typename Scalar_, int columns_>
class FixedUpperTriangularMatrix final {
public:
using Scalar = Scalar_;
static constexpr int rows() { return columns_; }
static constexpr int columns() { return columns_; }
static constexpr int size() { return columns_ * (columns_ + 1) / 2; }
Expand Down
Loading

0 comments on commit 09a072a

Please sign in to comment.