SuperDex Physics C++ API
Loading...
Searching...
No Matches
matrix_utils.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
25
26namespace superdex {
27
28/**************************************************************************************************
29 Frobenius Norm
30*/
31
32// Square of the Frobenius norm of a matrix
33template <typename T, size_t N, size_t M>
34[[nodiscard]] MOCHI_FORCE_INLINE constexpr T NormSqr(NdArray<T, N, M> const& a);
35
36// Frobenius norm of a matrix
37template <typename T, size_t N, size_t M>
38[[nodiscard]] MOCHI_FORCE_INLINE T Norm(NdArray<T, N, M> const& a);
39
40// Square of the Frobenius norm of the upper-left 3x3 portion of a SIMD matrix
41template <typename T, size_t D0, int D1, MOCHI_CONCEPT(D0 >= 3 && D1 >= 3)>
42[[nodiscard]] MOCHI_FORCE_INLINE T NormSqr3x3(NdArray<Simd<T, D1>, D0> const& a);
43
44// Frobenius norm of the upper-left 3x3 portion of a SIMD matrix.
45template <typename T, size_t D0, int D1, MOCHI_CONCEPT(D0 >= 3 && D1 >= 3)>
46[[nodiscard]] MOCHI_FORCE_INLINE T Norm3x3(NdArray<Simd<T, D1>, D0> const& a);
47
48/**************************************************************************************************
49 Matrix-Vector Dot Product
50*/
51
52// Dot product of (matrix, array). The result is a 1D array where the ith element is defined as the
53// dot product of 'b' and a row (2nd dimension) of 'a'.
54template <typename T, size_t N, size_t M>
55[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, N> DotMatVec(
56 NdArray<T, N, M> const& a,
57 NdArray<T, M> const& b);
58
59template <typename T, size_t N, size_t M>
60[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, N> DotMatVec(
61 NdArray<T, N, M> const& a,
63
64template <typename T, size_t N, size_t M>
66
67// Dot product of a 3xN matrix and an Nx1 vector, where N <= 4. The result is interpreted as a 3x1
68// vector, with an additional invalid component for SIMD padding. The matrix is allowed to have
69// more (D0) rows, but rows beyond the third one will be ignored.
70template <size_t N, typename T, size_t D0>
72 NdArray<Simd<T, 4>, D0> const& m,
73 Simd<T, 4> v);
74
75// Dot product of (matrix, array). Supports 3x3 and 4x4 matrices, but only uses the upper-left 3x3
76// portion of the matrix. Ignores v[3]. Can be used to rotate 3D vectors, but DotVecMat3x3 is faster
77// if you already have the matrix transpose.
78template <typename T, size_t D0>
80 NdArray<Simd<T, 4>, D0> const& m,
81 Simd<T, 4> v);
82
83// Dot product of (matrix, array). Can be used to transform vectors, but DotVecMat4x4 is faster if
84// you already have the matrix transpose.
85template <typename T>
87 NdArray<Simd<T, 4>, 4> const& m,
88 Simd<T, 4> v);
89
90/**************************************************************************************************
91 Vector-Matrix Dot Product
92*/
93
94// Dot product of (array, matrix). The result is a 1D array where the ith element is defined as the
95// dot product of 'a' and a column (1st dimension) of 'b'.
96template <typename T, size_t N, size_t M>
97[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, M> DotVecMat(
98 NdArray<T, N> const& a,
99 NdArray<T, N, M> const& b);
100
101// Dot product of (array, matrix). SIMD specialization using the first 2 components of each Vec4r.
102template <typename T>
104 Simd<T, 4> v,
105 NdArray<Simd<T, 4>, 2> const& m);
106
107// Dot product of (array, matrix). Input matrices can be VMatrix3x3r or VMatrix4x4r, but only the
108// upper-left 3x3 portion will be used. Output is a Vec4r where the last SIMD component is
109// undefined.
110template <typename T, size_t D0>
112 Simd<T, 4> v,
113 NdArray<Simd<T, 4>, D0> const& m);
114
115// Dot product of (array, matrix). Full SIMD specialization.
116template <typename T>
118 Simd<T, 4> a,
119 NdArray<Simd<T, 4>, 4> const& b);
120
121/**************************************************************************************************
122 Matrix-Matrix Dot Product
123*/
124
125// Dot product of 2 matrices
126template <typename T, size_t N, size_t M, size_t L>
127[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, N, L> Dot(
128 NdArray<T, N, M> const& a,
129 NdArray<T, M, L> const& B);
130
131// Dot product of 2 matrices. VMatrix4x4r specialization.
132template <typename T>
134 NdArray<Simd<T, 4>, 4> const& a,
135 NdArray<Simd<T, 4>, 4> const& b);
136
137// Dot product of (matrix, matrix). Input matrices can be VMatrix3x3r or VMatrix4x4r, but only the
138// upper-left 3x3 portion will be used. Output is a VMatrix3x3r where the last SIMD component of
139// each row is undefined.
140template <typename T, size_t D0A, size_t D0B>
142 NdArray<Simd<T, 4>, D0A> const& a,
143 NdArray<Simd<T, 4>, D0B> const& b);
144
145// Matrix-matrix product of 2x2 matrices.
146template <typename T>
147[[nodiscard]] MOCHI_FORCE_INLINE Simd<T, 4> Dot2x2(Simd<T, 4> const& a, Simd<T, 4> const& b);
148
149/**************************************************************************************************
150 Outer Product
151*/
152
153// Outer product of two 2x1 vectors returning a 2x2 matrix
154template <typename T>
155[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 2, 2> Outer(
156 NdArray<T, 2> const& a,
157 NdArray<T, 2> const& b);
158
159// Outer product of two vectors, 3x1 and 1x2, returning a 3x2 matrix
160template <typename T>
161[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 3, 2> Outer(
162 NdArray<T, 3> const& a,
163 NdArray<T, 2> const& b);
164
165// Outer product of two 3x1 vectors returning a 3x3 matrix
166template <typename T>
167[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 3, 3> Outer(
168 NdArray<T, 3> const& a,
169 NdArray<T, 3> const& b);
170
171// Outer product of two 3x1 vectors, returning a symmetric 3x3 matrix stored as
172// [a00, a11, a22, a01, a02, a12]. Only the upper triangle is computed, so the result is exactly
173// symmetric.
174template <typename T>
175[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 6> OuterSym(
176 NdArray<T, 3> const& a,
177 NdArray<T, 3> const& b);
178
179// Outer product of two 3x1 vectors returning a 3x3 matrix
180template <typename T>
182
183// Outer product of a 3x1 vector and a 3x3 matrix returning a 3x3x3 3rd-order tensor
184template <typename T>
185[[nodiscard]] NdArray<Simd<T, 4>, 3, 3> Outer3(
186 Simd<T, 4> const& vec,
187 NdArray<Simd<T, 4>, 3> const& mat);
188
189// Outer product of a 3x3 matrix and a 3x1 vector returning a 3x3x3 3rd-order tensor
190template <typename T>
191[[nodiscard]] MOCHI_FORCE_INLINE NdArray<Simd<T, 4>, 3, 3> Outer3(
192 NdArray<Simd<T, 4>, 3> const& mat,
193 Simd<T, 4> const& vec);
194
195// Outer product of a 3x3x3 tensor and a 3x1 vector returning a 3x3x3x3 4th-order tensor
196template <typename T>
197[[nodiscard]] MOCHI_FORCE_INLINE NdArray<Simd<T, 4>, 3, 3, 3> Outer3(
198 NdArray<Simd<T, 4>, 3, 3> const& ten,
199 Simd<T, 4> const& vec);
200
201// Outer product of a 3x1 vector and 3x3x3 tensor and returning a 3x3x3x3 4th-order tensor
202template <typename T>
203[[nodiscard]] MOCHI_FORCE_INLINE NdArray<Simd<T, 4>, 3, 3, 3> Outer3(
204 Simd<T, 4> const& vec,
205 NdArray<Simd<T, 4>, 3, 3> const& ten);
206
207// Outer product of two 3x3 matrices returning a 3x3x3x3 4th-order tensor
208template <typename T>
209[[nodiscard]] MOCHI_FORCE_INLINE NdArray<Simd<T, 4>, 3, 3, 3> Outer3(
210 NdArray<Simd<T, 4>, 3> const& mat0,
211 NdArray<Simd<T, 4>, 3> const& mat1);
212
213// Outer product of 3 component vectors, returning a symmetric 3x3 SIMD matrix (assumed 4th
214// component unused).
215template <typename T>
217
218// Outer product of two 2x2 matrices, each stored in row-major order as SIMD vectors, returning a
219// 2x2x2x2 4th-order tensor whose last two indices are packed into a single SIMD vector, with
220// row-major order. For `c = Outer2(a, b)`, we have `c[i][j][2*k + l] = a[2*i + j] * b[2*k + l]`,
221// corresponding to $c_{ijkl} = a_{ij} b_{kl}$ in mathematical index notation.
222template <typename T>
223[[nodiscard]] MOCHI_FORCE_INLINE NdArray<Simd<T, 4>, 2, 2> Outer2(
224 Simd<T, 4> const& a,
225 Simd<T, 4> const& b);
226
227/**************************************************************************************************
228 Inner Product
229*/
230
231// Colon product (Frobenius inner product) of two 3x3 SIMD matrices A and B, i.e. the sum of the
232// element-wise products A:B = \sum_{i,j} A_{ij} B_{ij}.
233template <typename T>
234[[nodiscard]] MOCHI_FORCE_INLINE T
235Colon3x3(NdArray<Simd<T, 4>, 3> const& A, NdArray<Simd<T, 4>, 3> const& B);
236
237// Colon product (Frobenius inner product) of two matrices A and B, i.e. the sum of the element-wise
238// products A:B = \sum_{i,j} A_{ij} B_{ij}.
239template <typename T, size_t N, size_t M>
240[[nodiscard]] MOCHI_FORCE_INLINE constexpr T Colon(
241 NdArray<T, N, M> const& A,
242 NdArray<T, N, M> const& B);
243
244// Colon product (Frobenius inner product) of two symmetric 2x2 matrices stored as raw
245// [a00, a01, a11] components.
246template <typename T>
247[[nodiscard]] MOCHI_FORCE_INLINE constexpr T ColonSym2x2(
248 NdArray<T, 3> const& A,
249 NdArray<T, 3> const& B);
250
251/**************************************************************************************************
252 Invert
253*/
254
255// Invert 2x2 matrix
256template <typename T>
257[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 2, 2> Invert(NdArray<T, 2, 2> const& a);
258
259// Invert 2x2 matrix when the determinant is known
260template <typename T>
261[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 2, 2> Invert(
262 NdArray<T, 2, 2> const& a,
263 T det);
264
265// Invert 3x3 matrix
266template <typename T>
267[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 3, 3> Invert(NdArray<T, 3, 3> const& a);
268
269// Invert 3x3 matrix when the determinant is known
270template <typename T>
271[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 3, 3> Invert(
272 NdArray<T, 3, 3> const& a,
273 T det);
274
275// Invert a 4x4 matrix
276template <typename T>
277[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 4, 4> Invert(NdArray<T, 4, 4> const& A);
278
279// Invert a 4x4 SIMD matrix
280template <typename T>
281[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<Simd<T, 4>, 4> Invert4x4(
282 NdArray<Simd<T, 4>, 4> const& A);
283
284// Invert 3x3 SIMD matrix
285template <typename T>
287 NdArray<Simd<T, 4>, 3> const& mat);
288
289// Invert 3x3 SIMD matrix when the determinant is known
290template <typename T>
292 NdArray<Simd<T, 4>, 3> const& mat,
293 Simd<T, 4> det);
294
295// Invert 2x2 SIMD matrix when the determinant is known
296template <typename T>
297[[nodiscard]] MOCHI_FORCE_INLINE Simd<T, 4> Invert2x2(Simd<T, 4> const& mat, T det);
298
299// Invert a 3D transformation matrix consisting of scale, rotation, and translation only.
300// The matrix should be of the form:
301//
302// | Ax Bx Cx Tx | Where the first 3 columns are the orthogonal scaled basis vectors, and
303// | Ay By Cy Ty | the last column is the translation
304// | Az Bz Cz Tz |
305// | 0 0 0 1 |
306//
307template <typename T>
309 NdArray<Simd<T, 4>, 4> const& mat);
310
311// Invert a pre-transposed 3D transformation matrix consisting of scale, rotation, and translation
312// only. The input matrix should be of the form below. The result matrix will have the same form.
313//
314// | Ax Ay Az 0 | Where the first 3 rows are the orthogonal scaled basis vectors
315// | Bx By Bz 0 | The last row is the translation
316// | Cx Cy Cz 0 |
317// | Tx Ty Tz 1 |
318//
319template <typename T>
321 NdArray<Simd<T, 4>, 4> const& mat);
322
323/**************************************************************************************************
324 Matrix Builders
325*/
326
327// Return an NxN array with a given value down the diagonal. Equivalent to: (Eye<N, T>() *
328// valueOnDiagonal)
329template <size_t N, typename T>
330[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, N, N> DiagonalMatrix(T valueOnDiagonal);
331
332// Return an NxN array with a given array down the diagonal.
333template <size_t N, typename T>
335 NdArray<T, N> const& diagonalVector);
336
337// Return raw [a00, a01, a11] components of a symmetric 2x2 matrix.
338template <typename T>
339[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 3> Sym2x2Components(T a00, T a01, T a11);
340
341// Return raw [a00, a01, a11] components of the symmetric part of a 2x2 matrix.
342template <typename T>
344 NdArray<T, 2, 2> const& m);
345
346// Construct a 2x2 symmetric matrix from upper-triangle components.
347// [a00 a01]
348// [a01 a11]
349template <typename T>
350[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 2, 2> SymMatrix2x2(T a00, T a01, T a11);
351
352// Return the full matrix of a symmetric 3x3 matrix stored as [a00, a11, a22, a01, a02, a12].
353template <typename T>
354[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 3, 3> SymToFull3x3(NdArray<T, 6> const& m);
355
356// Add s to the diagonal of a symmetric 3x3 matrix stored as [a00, a11, a22, a01, a02, a12].
357template <typename T>
358MOCHI_FORCE_INLINE constexpr void AddToDiagonalSym3x3(NdArray<T, 6>& m, T const& s);
359
360// Return an NxN array with 1s down the diagonal (an identity matrix).
361template <size_t N, typename T = real>
362[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, N, N> Eye();
363
364// Return an NxN array with a given value down the diagonal. Equivalent to: (Eye<N, T>() *
365// valueOnDiagonal)
366template <size_t N, typename T>
367[[nodiscard]] MOCHI_FORCE_INLINE NdArray<Simd<T, 4>, N> VDiagonalMatrix(T valueOnDiagonal);
368
369// Return an NxN array with a given array down the diagonal.
370template <size_t N, typename T>
372 Simd<T, 4> const& diagonalVector);
373
374// Return an NxN array with 1s down the diagonal (an identity matrix).
375template <size_t N, typename T = real>
376[[nodiscard]] MOCHI_FORCE_INLINE NdArray<Simd<T, 4>, N> VEye();
377
378/**************************************************************************************************
379 Matrix Determinant
380*/
381
382// Determinant of 2x2 matrix.
383template <typename T>
384[[nodiscard]] MOCHI_FORCE_INLINE constexpr T Det(NdArray<T, 2, 2> const& A);
385
386// Determinant of 3x3 matrix.
387template <typename T>
388[[nodiscard]] MOCHI_FORCE_INLINE constexpr T Det(NdArray<T, 3, 3> const& A);
389
390// Determinant of the upper-left 3x3 of a SIMD matrix.
391template <typename T, size_t N>
392[[nodiscard]] MOCHI_FORCE_INLINE T
393Det3x3(NdArray<Simd<T, 4>, N> const& A); // Ignores the last SIMD column
394
395// Same as Det3x3 except that it returns Simd<T, 4>{det, det, det, det}
396template <typename T, size_t N>
397[[nodiscard]] MOCHI_FORCE_INLINE Simd<T, 4> VDet3x3(NdArray<Simd<T, 4>, N> const& A);
398
399template <typename T>
400[[nodiscard]] MOCHI_FORCE_INLINE T Det2x2(Simd<T, 4> const& A);
401
402/**************************************************************************************************
403 Matrix Transpose
404*/
405
406// Transpose matrix NxM
407template <typename T, size_t N, size_t M>
408[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, M, N> Transpose(NdArray<T, N, M> const& mat);
409
410// Transpose matrix 4x4 (SIMD)
411template <typename T>
413 NdArray<Simd<T, 4>, 4> const& m);
414
415// Transpose a 2x2 SIMD matrix stored in row-major order as a single Simd<T, 4>.
416template <typename T>
418
419// Transpose the upper-left 3x3 portion of a SIMD matrix. The 4th column will be filled by m[2][3].
420// Thus, if the 4th column was all zeros, then the 4th column of the transpose will also be all
421// zeros. Input matrix can have have 3 or 4 rows.
422template <typename T, size_t D0>
424 NdArray<Simd<T, 4>, D0> const& m);
425
426/**************************************************************************************************
427 Matrix Cofactor
428*/
429
430template <typename T>
431[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 2, 2> Cofactor(NdArray<T, 2, 2> const& mat);
432
433template <typename T>
434[[nodiscard]] inline constexpr NdArray<T, 3, 3> Cofactor(NdArray<T, 3, 3> const& mat);
435
436template <typename T>
437[[nodiscard]] NdArray<Simd<T, 4>, 3> Cofactor3x3(
438 NdArray<Simd<T, 4>, 3> const& mat); // Ignores the last SIMD column
439
440/**************************************************************************************************
441 Matrix Trace (sum of diagonal elements)
442*/
443template <typename T, size_t DimTotal = 3, size_t DimTrace = DimTotal>
444[[nodiscard]] MOCHI_FORCE_INLINE constexpr T Trace(NdArray<T, DimTotal, DimTotal> const& mat);
445
446template <typename T>
447[[nodiscard]] MOCHI_FORCE_INLINE constexpr T Trace2x2(Simd<T, 4> const& mat);
448
449template <typename T>
450[[nodiscard]] MOCHI_FORCE_INLINE constexpr T Trace3x3(NdArray<Simd<T, 4>, 3> const& mat);
451
452/**************************************************************************************************
453 Skew-symmetric matrix
454*/
455
456// Return the 3x3 skew-symmetric matrix [v] of a vector v, s.t. [v] * u = v x u, [v] = -[v]^T.
457template <typename T>
458[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, 3, 3> Skew(NdArray<T, 3> const& v);
459
460// Return the 3x3 skew-symmetric matrix [v] of a vector v, s.t. [v] * u = v x u, [v] = -[v]^T.
461template <typename T>
462[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<Simd<T, 4>, 3> Skew3(Simd<T, 4> const& vector);
463
464// Return the vector v s.t. skew(v) is the anti-symmetric part of the input matrix
465template <typename T>
466[[nodiscard]] MOCHI_FORCE_INLINE constexpr Simd<T, 4> InvSkew3(
467 NdArray<Simd<T, 4>, 3> const& matrix);
468
469// Computes the first derivative of Skew(v)
470template <typename T = real>
471[[nodiscard]] MOCHI_FORCE_INLINE NdArray<Simd<T, 4>, 3, 3> VDSkew3();
472
473/**************************************************************************************************
474 Vector Derivatives
475*/
476
477// Derivative of normalized 3-vector w.r.t. vector. Returns a 3x3 matrix representing dv_hat/dv,
478// where v_hat = v / ||v||.
479template <typename T>
481
482// Derivative of normalized N-vector w.r.t. vector. Returns an NxN matrix representing dv_hat/dv,
483// where v_hat = v / ||v||.
484template <typename T, size_t N>
485[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, N, N> DNormalize(NdArray<T, N> const& v);
486
487// Derivative of normalized N-vector w.r.t. vector with precomputed squared norm. Returns an NxN
488// matrix representing dv_hat/dv, where v_hat = v / ||v||.
489template <typename T, size_t N>
490[[nodiscard]] MOCHI_FORCE_INLINE constexpr NdArray<T, N, N> DNormalize(
491 NdArray<T, N> const& v,
492 T sqrNorm);
493
494/**************************************************************************************************
495 Matrix Row/Column Selection
496*/
497
498// Retrieves the largest row (in the L-2 sense) of the given matrix. Optionally outputs
499// its squared norm.
500template <typename T, size_t D0, size_t D1>
501[[nodiscard]] constexpr auto LargestRow(NdArray<T, D0, D1> const& A, T* sqrNorm = nullptr);
502
503} // namespace superdex
504
505#include "matrix_utils_inl.h"
#define MOCHI_FORCE_INLINE
constexpr NdArray< T, M > DotVecMat(NdArray< T, N > const &a, NdArray< T, N, M > const &b)
T Dot(Simd< T, N > a, Simd< T, N > b)
Definition simd.h:710
constexpr T Trace(NdArray< T, DimTotal, DimTotal > const &mat)
constexpr NdArray< T, N, N > DNormalize(NdArray< T, N > const &v)
constexpr NdArray< T, 2, 2 > SymMatrix2x2(T a00, T a01, T a11)
NdArray< Simd< T, 4 >, 3 > DNormalize3(Simd< T, 4 > const &v)
constexpr void AddToDiagonalSym3x3(NdArray< T, 6 > &m, T const &s)
Simd< T, 4 > Transpose2x2(Simd< T, 4 > const &m)
constexpr NdArray< T, 3 > Sym2x2Components(T a00, T a01, T a11)
T NormSqr(Simd< T, N > a)
Definition simd_inl.h:964
NdArray< Simd< T, 4 >, 3 > Cofactor3x3(NdArray< Simd< T, 4 >, 3 > const &mat)
Simd< T, 4 > DotVecMat4x4(Simd< T, 4 > a, NdArray< Simd< T, 4 >, 4 > const &b)
Simd< T, 4 > Invert2x2(Simd< T, 4 > const &mat, T det)
NdArray< Simd< T, 4 >, 4 > InvertTransformation(NdArray< Simd< T, 4 >, 4 > const &mat)
constexpr Simd< T, 4 > InvSkew3(NdArray< Simd< T, 4 >, 3 > const &matrix)
T Norm(Simd< T, N > a)
Definition simd_inl.h:969
T Det2x2(Simd< T, 4 > const &A)
Simd< T, 4 > DotMatVec3xN(NdArray< Simd< T, 4 >, D0 > const &m, Simd< T, 4 > v)
constexpr auto LargestRow(NdArray< T, D0, D1 > const &A, T *sqrNorm=nullptr)
NdArray< Simd< T, 4 >, 3, 3 > VDSkew3()
constexpr NdArray< T, N > DotMatVec(NdArray< T, N, M > const &a, NdArray< T, M > const &b)
Simd< T, 4 > DotMatVec4x4(NdArray< Simd< T, 4 >, 4 > const &m, Simd< T, 4 > v)
NdArray< Simd< T, 4 >, 3 > Transpose3x3(NdArray< Simd< T, 4 >, D0 > const &m)
constexpr NdArray< T, 3, 3 > SymToFull3x3(NdArray< T, 6 > const &m)
NdArray< Simd< T, 4 >, 4 > InvertTransformationTransposed(NdArray< Simd< T, 4 >, 4 > const &mat)
constexpr NdArray< T, M, N > Transpose(NdArray< T, N, M > const &mat)
constexpr NdArray< T, N, N > Eye()
TransformRT Invert(TransformRT const &a)
Simd< T, 4 > DotVecMat3x3(Simd< T, 4 > v, NdArray< Simd< T, 4 >, D0 > const &m)
constexpr T Colon(NdArray< T, N, M > const &A, NdArray< T, N, M > const &B)
Simd< T, 4 > DotVecMat2x3(Simd< T, 4 > v, NdArray< Simd< T, 4 >, 2 > const &m)
NdArray< Simd< T, 4 >, 4 > Transpose4x4(NdArray< Simd< T, 4 >, 4 > const &m)
NdArray< Simd< T, 4 >, 2, 2 > Outer2(Simd< T, 4 > const &a, Simd< T, 4 > const &b)
NdArray< Simd< T, 4 >, 4 > Dot4x4(NdArray< Simd< T, 4 >, 4 > const &a, NdArray< Simd< T, 4 >, 4 > const &b)
T Colon3x3(NdArray< Simd< T, 4 >, 3 > const &A, NdArray< Simd< T, 4 >, 3 > const &B)
NdArray< Simd< T, 4 >, 2 > OuterSym3(Simd< T, 4 > a, Simd< T, 4 > b)
Simd< T, 4 > DotMatVec3x3(NdArray< Simd< T, 4 >, D0 > const &m, Simd< T, 4 > v)
Simd< T, 4 > Dot2x2(Simd< T, 4 > const &a, Simd< T, 4 > const &b)
constexpr NdArray< T, 3, 3 > Skew(NdArray< T, 3 > const &v)
constexpr NdArray< Simd< T, 4 >, 3 > Skew3(Simd< T, 4 > const &vector)
NdArray< Simd< T, 4 >, 3 > Invert3x3(NdArray< Simd< T, 4 >, 3 > const &mat)
constexpr NdArray< T, 2, 2 > Cofactor(NdArray< T, 2, 2 > const &mat)
T Norm3x3(NdArray< Simd< T, D1 >, D0 > const &a)
T NormSqr3x3(NdArray< Simd< T, D1 >, D0 > const &a)
constexpr NdArray< T, 2, 2 > Outer(NdArray< T, 2 > const &a, NdArray< T, 2 > const &b)
constexpr T Trace3x3(NdArray< Simd< T, 4 >, 3 > const &mat)
NdArray< Simd< T, 4 >, 3 > Outer3(Simd< T, 4 > a, Simd< T, 4 > b)
constexpr T ColonSym2x2(NdArray< T, 3 > const &A, NdArray< T, 3 > const &B)
NdArray< Simd< T, 4 >, N > VEye()
constexpr T Det(NdArray< T, 2, 2 > const &A)
constexpr NdArray< T, N, N > DiagonalMatrix(T valueOnDiagonal)
NdArray< Simd< T, 4 >, N > VDiagonalMatrix(T valueOnDiagonal)
constexpr T Trace2x2(Simd< T, 4 > const &mat)
T Det3x3(NdArray< Simd< T, 4 >, N > const &A)
constexpr NdArray< T, 6 > OuterSym(NdArray< T, 3 > const &a, NdArray< T, 3 > const &b)
constexpr NdArray< Simd< T, 4 >, 4 > Invert4x4(NdArray< Simd< T, 4 >, 4 > const &A)
Simd< T, 4 > VDet3x3(NdArray< Simd< T, 4 >, N > const &A)
NdArray< Simd< T, 4 >, 3 > Dot3x3(NdArray< Simd< T, 4 >, D0A > const &a, NdArray< Simd< T, 4 >, D0B > const &b)