24template <VectorContainer Vec>
25constexpr auto add(
const Vec&
A,
const Vec&
B) {
31 for (std::size_t
i = 0;
i < N; ++
i)
C(
i) =
A(
i) +
B(
i);
40template <VectorContainer Vec>
51template <MatrixContainer Mat>
52constexpr auto add(
const Mat&
A,
const Mat&
B) {
57 for (std::size_t row = 0; row < Rows; ++row)
58 for (std::size_t
col = 0;
col < Cols; ++
col)
64template <MatrixContainer Mat>
79template <VectorContainer Vec, Field Alpha>
93template <VectorContainer Vec, Field Alpha>
104template <MatrixContainer Mat, Field Alpha>
110 for (std::size_t row = 0; row < Rows; ++row)
111 for (std::size_t
col = 0;
col < Cols; ++
col)
117template <MatrixContainer Mat, Field Alpha>
128template <VectorContainer Vec>
134template <MatrixContainer Mat>
149template <FieldVector Vec>
154 for (std::size_t
i = 0;
i < N; ++
i)
x_t(
i, 0) = x(
i);
165template <ComplexVector Vec>
170 for (std::size_t
i = 0;
i < N; ++
i)
result(
i) = std::conj(x(
i));
182template <FieldVector Vec>
184constexpr auto cross(
const Vec& x,
const Vec& y) {
185 return Vec{x(1) * y(2) - x(2) * y(1), -(x(0) * y(2) - x(2) * y(0)),
186 x(0) * y(1) - x(1) * y(0)};
197template <FieldVector Vec>
203 for (std::size_t
i = 0;
i < N; ++
i)
cnt += x(
i) == T(0);
214template <std::
size_t idx, FieldVector Vec>
223 for (std::size_t
j = 0;
i < N; ++
i, ++
j)
b(
j) = x(
i);
224 return std::tuple(
a,
b);
239template <MatrixContainer MatA, MatrixContainer MatB>
246 for (std::size_t
i = 0;
i < Rows; ++
i)
247 for (std::size_t
j = 0;
j < Cols; ++
j)
result(
i,
j) =
A(
i, 0) *
B(0,
j);
260template <MatrixContainer Mat>
266 for (std::size_t
i = 0;
i < Rows; ++
i)
280template <SquareMatrix Mat>
286 for (std::size_t
i = 0;
i < Rows; ++
i)
sum +=
A(
i,
i);
299template <MatrixContainer Mat>
306 for (std::size_t
i = 0;
i < Cols; ++
i)
307 for (std::size_t
j = 0;
j < Rows; ++
j)
A_t(
i,
j) = std::conj(
A_t(
i,
j));
319template <MatrixContainer MatA, MatrixContainer MatB>
327 for (std::size_t
i = 0;
i < Rows; ++
i) {
328 for (std::size_t
j = 0;
j < Cols; ++
j) {
345template <MatrixContainer Mat, VectorContainer Vec>
347constexpr auto operator*(
const Mat&
A,
const Vec&
X) {
352 for (std::size_t
i = 0;
i < Rows; ++
i) {
354 for (std::size_t
j = 0;
j < Cols; ++
j)
value +=
A(
i,
j) *
X(
j);
367template <VectorContainer Vec>
369constexpr auto min(
const Vec& x) {
373 for (std::size_t
i = 1;
i < N; ++
i)
mn = x(
i) <
mn ? x(
i) :
mn;
384template <VectorContainer Vec>
386constexpr auto max(
const Vec& x) {
390 for (std::size_t
i = 1;
i < N; ++
i)
mx = x(
i) >
mx ? x(
i) :
mx;
401template <VectorContainer Vec>
408 for (std::size_t
i = 1;
i < N; ++
i)
420template <VectorContainer Vec>
427 for (std::size_t
i = 1;
i < N; ++
i)
Field classified by scalar_traits as complex.
constexpr auto splice(const Vec &x)
splice operator
typename vector_traits_t< Vec >::element_type vector_element_t
Registered vector coordinate type.
constexpr auto operator+(const Vec &A, const Vec &B)
operator overload for add
constexpr auto conjugate_transpose(const Mat &A)
conjugate transpose of a matrix
constexpr auto add(const Vec &A, const Vec &B)
add two vectors together to get a third
constexpr auto outer_product(const MatA &A, const MatB &B)
Multiply matrix-shaped column and row operands as an outer product.
constexpr auto transpose(const Vec &x)
tranpose of a vector
constexpr std::size_t arg_max(const Vec &x)
max element
constexpr auto operator*(const Alpha &alpha, const Vec &A)
operator overload for scalar multiplication
constexpr std::size_t mat_rows_v
Registered compile-time row count after cv/ref normalization.
constexpr auto scalar_multiplication(const Alpha &alpha, const Vec &A)
multiply a vector A with a scalar alpha
constexpr auto min(const Vec &x)
min element
constexpr auto max(const Vec &x)
max element
constexpr auto conjugate(const Vec &x)
conjugate a vector
constexpr std::size_t arg_min(const Vec &x)
min element
constexpr bool all_zero(const Vec &x)
simple function that checks if a vector contains only zeros (hence spans nullspace)
constexpr auto trace(const Mat &A)
trace of a matrix
typename mat_traits< remove_cvref_t< Mat > >::value_type matrix_scalar_t
Registered matrix scalar type after cv/ref normalization.
constexpr auto cross(const Vec &x, const Vec &y)
cross product between x x y = Z
constexpr auto operator-(const Vec &A, const Vec &B)
operator overload for subtraction
Owning, fixed-size, row-major matrix container over a scalar field.
Owning, fixed-size vector container.