UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Chaos::TDenseMatrix< T_MAXELEMENTS > Class Template Reference

#include <DenseMatrix.h>

Public Member Functions

 TDenseMatrix ()
 
 TDenseMatrix (const int32 InNRows, const int32 InNCols)
 
 TDenseMatrix (const TDenseMatrix< MaxElements > &A)
 
TDenseMatrix< MaxElements > & operator= (const TDenseMatrix< MaxElements > &A)
 
FORCEINLINE int32 NumRows () const
 
FORCEINLINE int32 NumColumns () const
 
FORCEINLINE int32 NumElements () const
 
FORCEINLINE void SetDimensions (const int32 InNumRows, const int32 InNumColumns)
 
FORCEINLINE int32 AddRows (const int32 InNumRows)
 
FORCEINLINE FRealAt (const int32 RowIndex, const int32 ColumnIndex)
 
FORCEINLINE const FRealAt (const int32 RowIndex, const int32 ColumnIndex) const
 
void Init (const int32 InNRows, const int32 InNCols, FReal V)
 
FORCEINLINE void SetAt (const int32 RowIndex, const int32 ColumnIndex, const FReal V)
 
void Set (FReal V)
 
void SetDiagonal (FReal V)
 
void SetDiagonalAt (int32 Start, int32 Num, FReal V)
 
void SetRowAt (const int32 RowIndex, const int32 ColumnIndex, const FReal *V, const int32 NumV)
 
void SetRowAt (const int32 RowIndex, const int32 ColumnIndex, const FVec3 &V)
 
void SetRowAt (const int32 RowIndex, const int32 ColumnIndex, const FReal V0, const FReal V1, const FReal V2)
 
void SetColumnAt (const int32 RowIndex, const int32 ColumnIndex, const FReal *V, const int32 NumV)
 
void SetColumnAt (const int32 RowIndex, const int32 ColumnIndex, const FVec3 &V)
 
template<int32 T_EA>
void SetBlockAt (const int32 RowOffset, const int32 ColumnOffset, const TDenseMatrix< T_EA > &V)
 
void SetBlockAt (const int32 RowOffset, const int32 ColumnOffset, const FMatrix33 &V)
 
void SetBlockAtDiagonal33 (const int32 RowOffset, const int32 ColumnOffset, const FReal VDiag, const FReal VOffDiag)
 

Static Public Member Functions

static TDenseMatrix< MaxElementsMake (const int32 InNumRows, const int32 InNumCols)
 
static TDenseMatrix< MaxElementsMake (const int32 InNumRows, const int32 InNumCols, const FReal V)
 
static TDenseMatrix< MaxElementsMake (const int32 InNumRows, const int32 InNumCols, const FReal *V, const int32 VLen)
 
static TDenseMatrix< MaxElementsMake (const FVec3 &InM)
 
static TDenseMatrix< MaxElementsMake (const FMatrix33 &InM)
 
static TDenseMatrix< MaxElementsMakeDiagonal (const int32 InNumRows, const int32 InNumCols, const FReal D)
 
static TDenseMatrix< MaxElementsMakeIdentity (const int32 InDim)
 
template<int32 T_EA>
static TDenseMatrix< MaxElementsTranspose (const TDenseMatrix< T_EA > &A)
 
template<int32 T_EA>
static TDenseMatrix< MaxElementsNegate (const TDenseMatrix< T_EA > &A)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsAdd (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsAdd_Symmetric (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsSubtract (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsMultiplyAB (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsMultiplyAtB (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsMultiplyABt (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsMultiplyAtBt (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsMultiplyAB_Symmetric (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA, int32 T_EB, int32 T_EC>
static TDenseMatrix< MaxElementsMultiplyBCAddA_Symmetric (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B, const TDenseMatrix< T_EC > &C)
 
template<int32 T_EA>
static TDenseMatrix< MaxElementsMultiplyAB (const TDenseMatrix< T_EA > &A, const FMassMatrix &B)
 
template<int32 T_EB>
static TDenseMatrix< MaxElementsMultiplyAB (const FMassMatrix &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EB>
static TDenseMatrix< MaxElementsMultiplyABt (const FMassMatrix &A, const TDenseMatrix< T_EB > &B)
 
template<int32 T_EA>
static TDenseMatrix< MaxElementsMultiply (const TDenseMatrix< T_EA > &A, const FReal V)
 
template<int32 T_EA>
static TDenseMatrix< MaxElementsMultiply (const FReal V, const TDenseMatrix< T_EA > &A)
 
template<int32 T_EA>
static TDenseMatrix< MaxElementsDivide (const TDenseMatrix< T_EA > &A, const FReal V)
 
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElementsDotProduct (const TDenseMatrix< T_EA > &A, const TDenseMatrix< T_EB > &B)
 

Static Public Attributes

static const int32 MaxElements = T_MAXELEMENTS
 

Detailed Description

template<int32 T_MAXELEMENTS>
class Chaos::TDenseMatrix< T_MAXELEMENTS >

A matrix with run-time variable dimensions, up to an element limit defined at compile-time.

Elements are stored in row-major order (i.e., elements in a row are adjacent in memory). Note that FMatrix stores elements in column-major order so that we can access the columns quickly which is handy when you have rotation matrices and want the spatial axes. We don't care about that so we use the more conventional row-major indexing and matching storage.

Constructor & Destructor Documentation

◆ TDenseMatrix() [1/3]

template<int32 T_MAXELEMENTS>
Chaos::TDenseMatrix< T_MAXELEMENTS >::TDenseMatrix ( )
inline

◆ TDenseMatrix() [2/3]

template<int32 T_MAXELEMENTS>
Chaos::TDenseMatrix< T_MAXELEMENTS >::TDenseMatrix ( const int32  InNRows,
const int32  InNCols 
)
inline

◆ TDenseMatrix() [3/3]

template<int32 T_MAXELEMENTS>
Chaos::TDenseMatrix< T_MAXELEMENTS >::TDenseMatrix ( const TDenseMatrix< MaxElements > &  A)
inline

Member Function Documentation

◆ Add()

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Add ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = A + B

◆ Add_Symmetric()

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Add_Symmetric ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = A + B, where A and B are symetric.

◆ AddRows()

template<int32 T_MAXELEMENTS>
FORCEINLINE int32 Chaos::TDenseMatrix< T_MAXELEMENTS >::AddRows ( const int32  InNumRows)
inline

Add uninitialized rows to the matrix. This will not invalidate data in any previously added rows, so it can be used to build NxM matrices where M is known, but N is calculated later. /return the index of the first new row.

◆ At() [1/2]

template<int32 T_MAXELEMENTS>
FORCEINLINE FReal & Chaos::TDenseMatrix< T_MAXELEMENTS >::At ( const int32  RowIndex,
const int32  ColumnIndex 
)
inline

Return a writable reference to the element at the specified row and column.

◆ At() [2/2]

template<int32 T_MAXELEMENTS>
FORCEINLINE const FReal & Chaos::TDenseMatrix< T_MAXELEMENTS >::At ( const int32  RowIndex,
const int32  ColumnIndex 
) const
inline

Return a read-only reference to the element at the specified row and column.

◆ Divide()

template<int32 T_MAXELEMENTS>
template<int32 T_EA>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Divide ( const TDenseMatrix< T_EA > &  A,
const FReal  V 
)
inlinestatic

Return C = A / V, where A is an MxN matrix, and V a real number.

◆ DotProduct()

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::DotProduct ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = At x B. If A and B are column vectors (Nx1 matrices), this is a vector dot product.

◆ Init()

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::Init ( const int32  InNRows,
const int32  InNCols,
FReal  V 
)
inline

Set the dimensions and initial values of the matrix.

◆ Make() [1/5]

template<int32 T_MAXELEMENTS>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Make ( const FMatrix33 InM)
inlinestatic

Create a copy of the 3x3 matrix.

◆ Make() [2/5]

template<int32 T_MAXELEMENTS>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Make ( const FVec3 InM)
inlinestatic

Create a copy of the 3x1 columns vector.

◆ Make() [3/5]

template<int32 T_MAXELEMENTS>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Make ( const int32  InNumRows,
const int32  InNumCols 
)
inlinestatic

Create a matrix with the specified dimensions, but all elements are uninitialized.

◆ Make() [4/5]

template<int32 T_MAXELEMENTS>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Make ( const int32  InNumRows,
const int32  InNumCols,
const FReal V,
const int32  VLen 
)
inlinestatic

Create a matrix with the specified elements supplied as an array in row-major order (i.e., the first N elements are for Row 0, the next N for Row 1, etc., where N is the number of columns).

◆ Make() [5/5]

template<int32 T_MAXELEMENTS>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Make ( const int32  InNumRows,
const int32  InNumCols,
const FReal  V 
)
inlinestatic

Create a matrix with the specified dimensions, and initialize all elements with "V".

◆ MakeDiagonal()

template<int32 T_MAXELEMENTS>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MakeDiagonal ( const int32  InNumRows,
const int32  InNumCols,
const FReal  D 
)
inlinestatic

Create a matrix with all elemets set to zero, except the diagonal elements.

◆ MakeIdentity()

template<int32 T_MAXELEMENTS>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MakeIdentity ( const int32  InDim)
inlinestatic

Create an identity matrix.

◆ Multiply() [1/2]

template<int32 T_MAXELEMENTS>
template<int32 T_EA>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Multiply ( const FReal  V,
const TDenseMatrix< T_EA > &  A 
)
inlinestatic

Return C = A x V, where A is an MxN matrix, and V a real number.

◆ Multiply() [2/2]

template<int32 T_MAXELEMENTS>
template<int32 T_EA>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Multiply ( const TDenseMatrix< T_EA > &  A,
const FReal  V 
)
inlinestatic

Return C = A x V, where A is an MxN matrix, and V a real number.

◆ MultiplyAB() [1/3]

template<int32 T_MAXELEMENTS>
template<int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyAB ( const FMassMatrix A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = A x B, where B is an 6xN matrix, and A is a 6x6 mass matrix (Mass in upper left 3x3 diagonals, Inertia in lower right 3x3). C = |M 0| * |B0| = |M.B0| |0 I| |B1| |I.B1|

◆ MultiplyAB() [2/3]

template<int32 T_MAXELEMENTS>
template<int32 T_EA>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyAB ( const TDenseMatrix< T_EA > &  A,
const FMassMatrix B 
)
inlinestatic

Return C = A x B, where A is an Nx6 matrix, and B is a 6x6 mass matrix (Mass in upper left 3x3 diagonals, Inertia in lower right 3x3). C = |A0 A1| * |M 0| = |A0.M A1.I| |0 I|

◆ MultiplyAB() [3/3]

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyAB ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = A x B, the product of A and B where each element of C is Cij = DotProduct(A.GetRow(i), B.GetColumns(j)). /see MultiplyAtB, MultiplyABt, MultipltAtBt.

◆ MultiplyAB_Symmetric()

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyAB_Symmetric ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = A x B, where the results is known to be symmetric. /see MultiplyAtB.

◆ MultiplyABt() [1/2]

template<int32 T_MAXELEMENTS>
template<int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyABt ( const FMassMatrix A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = A x Transpose(B), where B is an Nx6 matrix, and A is a 6x6 mass matrix (Mass in upper left 3x3 diagonals, Inertia in lower right 3x3). C = |M 0| * |B0 B1|(T) = |M.B0(T)| |0 I| |I.B1(T)|

◆ MultiplyABt() [2/2]

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyABt ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = A x Transpose(B). /see MultiplyAB, MultiplyAtB, MultipltAtBt.

◆ MultiplyAtB()

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyAtB ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = Transpose(A) x B. /see MultiplyAB, MultiplyABt, MultipltAtBt.

◆ MultiplyAtBt()

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyAtBt ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = Transpose(A) x Transpose(B). /see MultiplyAB, MultiplyAtB, MultipltABt.

◆ MultiplyBCAddA_Symmetric()

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB, int32 T_EC>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::MultiplyBCAddA_Symmetric ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B,
const TDenseMatrix< T_EC > &  C 
)
inlinestatic

Return C = A + B x C, where the A and (B x C) are known to be symmetric. /see MultiplyAtB, Add_Symmetric.

◆ Negate()

template<int32 T_MAXELEMENTS>
template<int32 T_EA>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Negate ( const TDenseMatrix< T_EA > &  A)
inlinestatic

Copy a matrix and set each element to its negative.

◆ NumColumns()

template<int32 T_MAXELEMENTS>
FORCEINLINE int32 Chaos::TDenseMatrix< T_MAXELEMENTS >::NumColumns ( ) const
inline

The number of columns in the matrix.

◆ NumElements()

template<int32 T_MAXELEMENTS>
FORCEINLINE int32 Chaos::TDenseMatrix< T_MAXELEMENTS >::NumElements ( ) const
inline

The number of elements in the matrix.

◆ NumRows()

template<int32 T_MAXELEMENTS>
FORCEINLINE int32 Chaos::TDenseMatrix< T_MAXELEMENTS >::NumRows ( ) const
inline

The number of rows in the matrix.

◆ operator=()

template<int32 T_MAXELEMENTS>
TDenseMatrix< MaxElements > & Chaos::TDenseMatrix< T_MAXELEMENTS >::operator= ( const TDenseMatrix< MaxElements > &  A)
inline

◆ Set()

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::Set ( FReal  V)
inline

Set all elements to 'V'.

◆ SetAt()

template<int32 T_MAXELEMENTS>
FORCEINLINE void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetAt ( const int32  RowIndex,
const int32  ColumnIndex,
const FReal  V 
)
inline

Set the element

◆ SetBlockAt() [1/2]

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetBlockAt ( const int32  RowOffset,
const int32  ColumnOffset,
const FMatrix33 V 
)
inline

Set the 3x3 block starting at ("RowOffset", "ColumnOffset") from the specified 3x3 matrix "V" (note: assumes the input UE matrix is column-major order)

◆ SetBlockAt() [2/2]

template<int32 T_MAXELEMENTS>
template<int32 T_EA>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetBlockAt ( const int32  RowOffset,
const int32  ColumnOffset,
const TDenseMatrix< T_EA > &  V 
)
inline

Set the block starting at ("RowOffset", "ColumnOffset") from the specified matrix "V"

◆ SetBlockAtDiagonal33()

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetBlockAtDiagonal33 ( const int32  RowOffset,
const int32  ColumnOffset,
const FReal  VDiag,
const FReal  VOffDiag 
)
inline

Set the specified 3x3 block to a diagonal matrix with the specified diagonal and off-diagonal values.

◆ SetColumnAt() [1/2]

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetColumnAt ( const int32  RowIndex,
const int32  ColumnIndex,
const FReal V,
const int32  NumV 
)
inline

Starting from element ("RowIndex", "ColumnIndex"), set the next "NumV" elements in the column to the values in "V".

◆ SetColumnAt() [2/2]

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetColumnAt ( const int32  RowIndex,
const int32  ColumnIndex,
const FVec3 V 
)
inline

◆ SetDiagonal()

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetDiagonal ( FReal  V)
inline

Set the diagonal elements to 'V'. Does not set off-diagonal elements. /see MakeDiagonal

◆ SetDiagonalAt()

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetDiagonalAt ( int32  Start,
int32  Num,
FReal  V 
)
inline

Set the "Num" diagonal elements starting from ("Start", "Start") to "V". Does not set off-diagonal elements.

◆ SetDimensions()

template<int32 T_MAXELEMENTS>
FORCEINLINE void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetDimensions ( const int32  InNumRows,
const int32  InNumColumns 
)
inline

Set the dimensions of the matrix, but do not initialize any values. This will invalidate any existing data.

◆ SetRowAt() [1/3]

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetRowAt ( const int32  RowIndex,
const int32  ColumnIndex,
const FReal V,
const int32  NumV 
)
inline

Starting from element ("RowIndex", "ColumnIndex"), set the next "NumV" elements in the row to the values in "V".

◆ SetRowAt() [2/3]

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetRowAt ( const int32  RowIndex,
const int32  ColumnIndex,
const FReal  V0,
const FReal  V1,
const FReal  V2 
)
inline

◆ SetRowAt() [3/3]

template<int32 T_MAXELEMENTS>
void Chaos::TDenseMatrix< T_MAXELEMENTS >::SetRowAt ( const int32  RowIndex,
const int32  ColumnIndex,
const FVec3 V 
)
inline

◆ Subtract()

template<int32 T_MAXELEMENTS>
template<int32 T_EA, int32 T_EB>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Subtract ( const TDenseMatrix< T_EA > &  A,
const TDenseMatrix< T_EB > &  B 
)
inlinestatic

Return C = A - B

◆ Transpose()

template<int32 T_MAXELEMENTS>
template<int32 T_EA>
static TDenseMatrix< MaxElements > Chaos::TDenseMatrix< T_MAXELEMENTS >::Transpose ( const TDenseMatrix< T_EA > &  A)
inlinestatic

Return the transpose of 'A'.

Member Data Documentation

◆ MaxElements

template<int32 T_MAXELEMENTS>
const int32 Chaos::TDenseMatrix< T_MAXELEMENTS >::MaxElements = T_MAXELEMENTS
static

The documentation for this class was generated from the following file: