HDK
|
#include <UT_Matrix2.h>
Public Types | |
typedef T | value_type |
Public Member Functions | |
SYS_FORCE_INLINE | UT_Matrix2T ()=default |
Construct uninitialized matrix. More... | |
constexpr | UT_Matrix2T (const UT_Matrix2T &)=default |
Default copy constructor. More... | |
constexpr | UT_Matrix2T (UT_Matrix2T &&)=default |
Default move constructor. More... | |
constexpr | UT_Matrix2T (T val) noexcept |
Construct identity matrix, multipled by scalar. More... | |
T (0) | |
UT_Matrix2T< T > & | operator= (UT_Matrix2T< T > &&m)=default |
Default move assignment operator. More... | |
template<typename S > | |
UT_Matrix2T< T > & | operator= (const UT_Matrix3T< S > &m) |
UT_Matrix2T< T > | operator- () const |
UT_Matrix2T< T > & | operator+= (const UT_Matrix2T< T > &m) |
UT_Matrix2T< T > & | operator-= (const UT_Matrix2T< T > &m) |
UT_Matrix2T< T > & | operator*= (const UT_Matrix2T< T > &m) |
constexpr bool | operator== (const UT_Matrix2T< T > &m) const noexcept |
constexpr bool | operator!= (const UT_Matrix2T< T > &m) const noexcept |
UT_Matrix2T< T > & | operator= (T val) |
UT_Matrix2T< T > & | operator+= (T scalar) |
UT_Matrix2T< T > & | operator-= (T scalar) |
UT_Matrix2T< T > & | operator*= (T scalar) |
UT_Matrix2T< T > & | operator/= (T scalar) |
template<typename S > | |
UT_Matrix2T< T > & | operator= (const UT_Vector2T< S > &vec) |
template<typename S > | |
UT_Matrix2T< T > & | operator+= (const UT_Vector2T< S > &vec) |
template<typename S > | |
UT_Matrix2T< T > & | operator-= (const UT_Vector2T< S > &vec) |
constexpr T | determinant () const noexcept |
constexpr T | trace () const noexcept |
template<typename S > | |
int | eigenvalues (UT_Vector2T< S > &r, UT_Vector2T< S > &i) const |
Returns eigenvalues of this matrix. More... | |
int | invert () |
int | invert (UT_Matrix2T< T > &m) const |
T | tolerance () const |
Returns the tolerance of our class. More... | |
template<typename S > | |
int | solve (const UT_Vector2T< S > &b, UT_Vector2T< S > &x) const |
template<typename S > | |
int | solveTranspose (const UT_Vector2T< S > &b, UT_Vector2T< S > &x) const |
void | diagonalizeSymmetric (UT_Matrix2T< T > &R, UT_Matrix2T< T > &D, T tol=1e-6f) const |
void | svdDecomposition (UT_Matrix2T< T > &U, UT_Matrix2T< T > &S, UT_Matrix2T< T > &V, T tol=1e-6f) const |
bool | isSymmetric (T tolerance=T(SYS_FTOLERANCE)) const |
Check if symmetric up to a tolerance level to 0. More... | |
void | transpose () |
UT_Matrix2T< T > | transpose () const |
bool | isEqual (const UT_Matrix2T< T > &m, T tolerance=T(SYS_FTOLERANCE)) const |
template<typename S > | |
void | outerproductUpdate (T b, const UT_Vector2T< S > &v1, const UT_Vector2T< S > &v2) |
void | identity () |
Set the matrix to identity. More... | |
void | zero () |
Set the matrix to zero. More... | |
bool | isIdentity () const |
bool | isZero () const |
void | rotate (T theta) |
Rotate by theta radians. More... | |
void | initialize () |
Initialize this matrix to zero. More... | |
unsigned | hash () const |
Compute a hash. More... | |
T | dot (const UT_Matrix2T< T > &m) const |
T | getEuclideanNorm () const |
T | getEuclideanNorm2 () const |
Euclidean norm squared. More... | |
T | getNorm1 () const |
T | getNormInf () const |
T | getNormMax () const |
T | getNormSpectral () const |
int | save (std::ostream &os, int binary) const |
bool | load (UT_IStream &is) |
void | outAsciiNoName (std::ostream &os) const |
template<> | |
float | tolerance () const |
template<> | |
int32 | tolerance () const |
template<> | |
int64 | tolerance () const |
constexpr | UT_Matrix2T (const fpreal32 m[2][2]) noexcept |
void | scale (T sx, T sy) |
void | scale (const UT_Vector2T< T > &s) |
SYS_FORCE_INLINE T & | operator() (unsigned row, unsigned col) noexcept |
Return a matrix entry. No bounds checking on subscripts. More... | |
SYS_FORCE_INLINE T | operator() (unsigned row, unsigned col) const noexcept |
Return a matrix entry. No bounds checking on subscripts. More... | |
const T * | data () const |
Return the raw matrix data. More... | |
T * | data () |
Return the raw matrix data. More... | |
T * | operator() (unsigned row) |
Return a matrix row. No bounds checking on subscript. More... | |
const T * | operator() (unsigned row) const |
Return a matrix row. No bounds checking on subscript. More... | |
const UT_Vector2T< T > & | operator[] (unsigned row) const |
Return a matrix row. No bounds checking on subscript. More... | |
UT_Vector2T< T > & | operator[] (unsigned row) |
Return a matrix row. No bounds checking on subscript. More... | |
bool | save (UT_JSONWriter &w) const |
bool | save (UT_JSONValue &v) const |
bool | load (UT_JSONParser &p) |
Static Public Member Functions | |
static UT_Matrix2T< T > | rotationMat (T theta) |
Create a rotation matrix for the given angle in radians. More... | |
static int | entries () |
Returns the vector size. More... | |
Public Attributes | |
val | |
T | matx [2][2] |
T | myFloats [tuple_size] |
Static Public Attributes | |
static constexpr int | tuple_size = 4 |
Friends | |
std::ostream & | operator<< (std::ostream &os, const UT_Matrix2T< T > &v) |
This class implements a 2x2 matrix in row-major order.
Most of Houdini operates with row vectors that are left-multiplied with matrices. e.g., z = v * M
Definition at line 89 of file UT_Matrix2.h.
typedef T UT_Matrix2T< T >::value_type |
Definition at line 93 of file UT_Matrix2.h.
|
default |
Construct uninitialized matrix.
|
default |
Default copy constructor.
|
default |
Default move constructor.
|
inlineexplicitnoexcept |
Construct identity matrix, multipled by scalar.
Definition at line 106 of file UT_Matrix2.h.
|
inlineexplicitnoexcept |
Construct a deep copy of the input row-major data.
Definition at line 113 of file UT_Matrix2.h.
|
inline |
Return the raw matrix data.
Definition at line 442 of file UT_Matrix2.h.
|
inline |
Return the raw matrix data.
Definition at line 443 of file UT_Matrix2.h.
|
inlinenoexcept |
Definition at line 220 of file UT_Matrix2.h.
void UT_Matrix2T< T >::diagonalizeSymmetric | ( | UT_Matrix2T< T > & | R, |
UT_Matrix2T< T > & | D, | ||
T | tol = 1e-6f |
||
) | const |
T UT_Matrix2T< T >::dot | ( | const UT_Matrix2T< T > & | m | ) | const |
Dot product with another matrix Does dot(a,b) = sum_ij a_ij * b_ij
int UT_Matrix2T< T >::eigenvalues | ( | UT_Vector2T< S > & | r, |
UT_Vector2T< S > & | i | ||
) | const |
Returns eigenvalues of this matrix.
|
inlinestatic |
Returns the vector size.
Definition at line 517 of file UT_Matrix2.h.
|
inline |
Euclidean or Frobenius norm of a matrix. Does sqrt(sum(a_ij ^2))
Definition at line 473 of file UT_Matrix2.h.
T UT_Matrix2T< T >::getEuclideanNorm2 | ( | ) | const |
Euclidean norm squared.
T UT_Matrix2T< T >::getNorm1 | ( | ) | const |
Get the 1-norm of this matrix, assuming a row vector convention. Returns the maximum absolute row sum. ie. max_i(sum_j(abs(a_ij)))
T UT_Matrix2T< T >::getNormInf | ( | ) | const |
Get the inf-norm of this matrix, assuming a row vector convention. Returns the maximum absolute column sum. ie. max_j(sum_i(abs(a_ij)))
T UT_Matrix2T< T >::getNormMax | ( | ) | const |
Get the max-norm of this matrix Returns the maximum absolute entry. ie. max_j(max_i(abs(a_ij)))
T UT_Matrix2T< T >::getNormSpectral | ( | ) | const |
Get the spectral norm of this matrix Returns the maximum singular value.
|
inline |
Compute a hash.
Definition at line 447 of file UT_Matrix2.h.
|
inline |
Set the matrix to identity.
Definition at line 378 of file UT_Matrix2.h.
|
inline |
Initialize this matrix to zero.
Definition at line 420 of file UT_Matrix2.h.
|
inline |
Invert this matrix and return 0 if OK, 1 if singular. If singular, the matrix will be unchanged.
Definition at line 233 of file UT_Matrix2.h.
|
inline |
Invert the matrix and return 0 if OK, 1 if singular. Puts the inverted matrix in m, and leaves this matrix unchanged. If singular, the matrix will be unchanged.
Definition at line 243 of file UT_Matrix2.h.
|
inline |
Definition at line 352 of file UT_Matrix2.h.
|
inline |
Definition at line 386 of file UT_Matrix2.h.
|
inline |
Check if symmetric up to a tolerance level to 0.
Definition at line 338 of file UT_Matrix2.h.
|
inline |
Definition at line 393 of file UT_Matrix2.h.
bool UT_Matrix2T< T >::load | ( | UT_IStream & | is | ) |
bool UT_Matrix2T< T >::load | ( | UT_JSONParser & | p | ) |
Methods to serialize to a JSON stream. The matrix is stored as an array of 4 reals.
|
inlinenoexcept |
Definition at line 177 of file UT_Matrix2.h.
|
inlinenoexcept |
Return a matrix entry. No bounds checking on subscripts.
Definition at line 428 of file UT_Matrix2.h.
|
inlinenoexcept |
Return a matrix entry. No bounds checking on subscripts.
Definition at line 433 of file UT_Matrix2.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 451 of file UT_Matrix2.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 456 of file UT_Matrix2.h.
UT_Matrix2T<T>& UT_Matrix2T< T >::operator*= | ( | const UT_Matrix2T< T > & | m | ) |
|
inline |
Definition at line 198 of file UT_Matrix2.h.
|
inline |
Definition at line 157 of file UT_Matrix2.h.
|
inline |
Definition at line 188 of file UT_Matrix2.h.
|
inline |
Definition at line 573 of file UT_Matrix2.h.
|
inline |
Definition at line 150 of file UT_Matrix2.h.
|
inline |
Definition at line 163 of file UT_Matrix2.h.
|
inline |
Definition at line 194 of file UT_Matrix2.h.
|
inline |
Definition at line 583 of file UT_Matrix2.h.
|
inline |
Definition at line 204 of file UT_Matrix2.h.
|
default |
Default move assignment operator.
UT_Matrix2T<T>& UT_Matrix2T< T >::operator= | ( | const UT_Matrix3T< S > & | m | ) |
Conversion operator that returns a 2x2 from a 3x3 matrix by ignoring the last row and last column.
|
inline |
Definition at line 182 of file UT_Matrix2.h.
|
inline |
Definition at line 563 of file UT_Matrix2.h.
|
inlinenoexcept |
Definition at line 171 of file UT_Matrix2.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 592 of file UT_Matrix2.h.
|
inline |
Return a matrix row. No bounds checking on subscript.
Definition at line 600 of file UT_Matrix2.h.
void UT_Matrix2T< T >::outAsciiNoName | ( | std::ostream & | os | ) | const |
|
inline |
Definition at line 365 of file UT_Matrix2.h.
|
inline |
Rotate by theta radians.
Definition at line 405 of file UT_Matrix2.h.
|
static |
Create a rotation matrix for the given angle in radians.
int UT_Matrix2T< T >::save | ( | std::ostream & | os, |
int | binary | ||
) | const |
bool UT_Matrix2T< T >::save | ( | UT_JSONWriter & | w | ) | const |
Methods to serialize to a JSON stream. The matrix is stored as an array of 4 reals.
bool UT_Matrix2T< T >::save | ( | UT_JSONValue & | v | ) | const |
Methods to serialize to a JSON stream. The matrix is stored as an array of 4 reals.
|
inline |
Multiply this matrix by a scale matrix with diagonal (sx, sy):
Definition at line 410 of file UT_Matrix2.h.
|
inline |
Multiply this matrix by a scale matrix with diagonal (sx, sy):
Definition at line 415 of file UT_Matrix2.h.
|
inline |
Definition at line 273 of file UT_Matrix2.h.
|
inline |
Definition at line 298 of file UT_Matrix2.h.
void UT_Matrix2T< T >::svdDecomposition | ( | UT_Matrix2T< T > & | U, |
UT_Matrix2T< T > & | S, | ||
UT_Matrix2T< T > & | V, | ||
T | tol = 1e-6f |
||
) | const |
UT_Matrix2T< T >::T | ( | 0 | ) |
T UT_Matrix2T< T >::tolerance | ( | ) | const |
Returns the tolerance of our class.
|
inline |
Definition at line 533 of file UT_Matrix2.h.
|
inline |
Definition at line 548 of file UT_Matrix2.h.
|
inline |
Definition at line 555 of file UT_Matrix2.h.
|
inlinenoexcept |
Definition at line 224 of file UT_Matrix2.h.
|
inline |
Definition at line 344 of file UT_Matrix2.h.
UT_Matrix2T<T> UT_Matrix2T< T >::transpose | ( | ) | const |
|
inline |
Set the matrix to zero.
Definition at line 384 of file UT_Matrix2.h.
|
friend |
Definition at line 509 of file UT_Matrix2.h.
T UT_Matrix2T< T >::matx[2][2] |
Definition at line 524 of file UT_Matrix2.h.
T UT_Matrix2T< T >::myFloats[tuple_size] |
Definition at line 525 of file UT_Matrix2.h.
|
static |
Definition at line 94 of file UT_Matrix2.h.
UT_Matrix2T< T >::val |
Definition at line 108 of file UT_Matrix2.h.