21template <VectorContainer Vec>
31 for (std::size_t
i = 0;
i < N; ++
i) {
34 for (std::size_t
j =
i;
j < N; ++
j) {
52template <std::
size_t N>
55 for (std::size_t
i = 0;
i < N; ++
i)
p_inv(
p(
i)) =
i;
67template <MatrixContainer Mat>
72 for (std::size_t
i = 0;
i < N; ++
i)
73 for (std::size_t
j = 0;
j < N; ++
j)
J_p(
i,
j) = J(
p(
i),
p(
j));
85template <MatrixContainer Mat>
90 for (std::size_t
i = 0;
i < N; ++
i)
91 for (std::size_t
j = 0;
j < N; ++
j) R(
p(
i),
p(
j)) =
A(
i,
j);
120template <SquareMatrix Mat>
124 using Complex = std::complex<ScalarT>;
127 static_assert(N >= 1,
"Matrix exponential requires at least 1 row");
153 std::size_t
j =
i + 1;
156 const auto eig = D(
p(
i));
Field classified by scalar_traits as complex.
typename vector_traits_t< Vec >::element_type vector_element_t
Registered vector coordinate type.
typename scalar_traits_t< T >::real_type real_type_t
Associated real component type registered for T.
constexpr auto as_complex_matrix(const Mat &A)
express matrix as complex one
constexpr auto permute_ptjp(const Mat &J, const Vector< std::size_t, mat_rows_v< Mat > > &p)
Reorder matrix rows and columns by the same permutation.
constexpr bool is_same(const T &a, const T &b, real_type_t< T > tol=1e-10)
Compare complex scalars by magnitude of their difference.
constexpr std::size_t mat_rows_v
Registered compile-time row count after cv/ref normalization.
constexpr auto make_group_permutation(const Vec &D, real_type_t< vector_element_t< Vec > > tol=1e-10)
Group approximately equal eigenvalues into contiguous index runs.
constexpr auto matrix_exp(const Mat &A)
Compute exp(A) using its eigenvector and generalized-eigenvector basis.
constexpr auto invert_permutation(const Vector< std::size_t, N > &p)
Invert an index permutation.
typename mat_traits< remove_cvref_t< Mat > >::value_type matrix_scalar_t
Registered matrix scalar type after cv/ref normalization.
constexpr auto unpermute_papt(const Mat &A, const Vector< std::size_t, mat_rows_v< Mat > > &p)
Scatter matrix entries through a row-and-column permutation.
constexpr auto constexpr_exp_lambda(const T &lambda, int terms=16)
Approximate the exponential of a complex scalar.
Computes eigenvalues and eigenvectors satisfying A V = V diag(lambda).
Owning, fixed-size, row-major matrix container over a scalar field.
Owning, fixed-size vector container.