Go to the documentation of this file.
7 #ifndef INCLUDE_JET_MATRIX3X3_H_
8 #define INCLUDE_JET_MATRIX3X3_H_
30 static_assert(std::is_floating_point<T>::value,
31 "Matrix only can be instantiated with floating point types");
43 Matrix(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22);
64 Matrix(
const std::initializer_list<std::initializer_list<U>>& lst);
80 void set(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22);
101 template <
typename U>
102 void set(
const std::initializer_list<std::initializer_list<U>>& lst);
128 double tol = std::numeric_limits<double>::epsilon())
const;
273 template <
typename U>
338 std::array<T, 9> _elements;
342 template <
typename T>
347 template <
typename T>
351 template <
typename T>
355 template <
typename T>
359 template <
typename T>
363 template <
typename T>
367 template <
typename T>
371 template <
typename T>
375 template <
typename T>
379 template <
typename T>
383 template <
typename T>
387 template <
typename T>
391 template <
typename T>
395 template <
typename T>
406 #include "detail/matrix3x3-inl.h"
408 #endif // INCLUDE_JET_MATRIX3X3_H_
const T * data() const
Returns constant pointer of this matrix.
T frobeniusNorm() const
Returns Frobenius norm.
Matrix radd(T s) const
Returns input scalar + this matrix.
Matrix diagonal() const
Returns diagonal part of this matrix.
Matrix & operator-=(T s)
Subtraction assignment with input scalar.
bool isSimilar(const Matrix &m, double tol=std::numeric_limits< double >::epsilon()) const
Matrix & operator+=(T s)
Addition assignment with input scalar.
void transpose()
Transposes this matrix.
static Matrix makeRotationMatrix(const Vector3< T > &axis, T rad)
T max() const
Returns maximum among all elements.
static Matrix makeScaleMatrix(const Vector3< T > &s)
Makes scale matrix.
Matrix transposed() const
Returns transposed matrix.
Matrix lowerTri() const
Returns lower triangle part of this matrix (including the diagonal).
Matrix add(T s) const
Returns this matrix + input scalar.
size_t rows() const
Returns number of rows of this matrix.
Matrix offDiagonal() const
Returns off-diagonal part of this matrix.
void invert()
Inverts this matrix.
T min() const
Returns minimum among all elements.
void isub(const Matrix &m)
Subtracts input matrix from this matrix (element-wise).
Matrix(const std::initializer_list< std::initializer_list< U >> &lst)
Constructs a matrix with given initializer list lst.
size_t cols() const
Returns number of columns of this matrix.
Static-sized M x N matrix class.
Definition: matrix.h:29
T sum() const
Returns sum of all elements.
Matrix sub(T s) const
Returns this matrix - input scalar.
void set(const Matrix &m)
Copies from input matrix.
void setRow(size_t i, const Vector3< T > &row)
Sets i-th row with input vector.
Matrix(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22)
void iadd(const Matrix &m)
Adds input matrix to this matrix (element-wise).
void set(T s)
Sets whole matrix with input scalar.
Matrix & operator-=(const Matrix &m)
Subtraction assignment with input matrix (element-wise).
void isub(T s)
Subtracts input scalar from this matrix.
T absmax() const
Returns absolute maximum among all elements.
void setDiagonal(T s)
Sets diagonal elements with input scalar.
Vector3< T > mul(const Vector3< T > &v) const
Returns this matrix * input vector.
bool isSquare() const
Returns true if this matrix is a square matrix.
Matrix()
Constructs identity matrix.
3-D matrix class.
Definition: matrix3x3.h:28
void setColumn(size_t i, const Vector3< T > &col)
Sets i-th column with input vector.
Matrix radd(const Matrix &m) const
Returns input matrix + this matrix (element-wise).
T * data()
Returns data pointer of this matrix.
Matrix & operator=(const Matrix &m)
Assigns input matrix.
Matrix mul(const Matrix &m) const
Returns this matrix * input matrix.
Matrix rsub(const Matrix &m) const
Returns input matrix - this matrix (element-wise).
Definition: advection_solver2.h:18
Matrix strictLowerTri() const
Returns strictly lower triangle part of this matrix.
void imul(const Matrix &m)
Multiplies input matrix to this matrix.
void iadd(T s)
Adds input scalar to this matrix.
const T & operator()(size_t i, size_t j) const
Returns constant reference of (i,j) element.
T trace() const
Returns sum of all diagonal elements.
Matrix & operator+=(const Matrix &m)
Addition assignment with input matrix (element-wise).
Matrix & operator*=(const Matrix &m)
Multiplication assignment with input matrix.
void setOffDiagonal(T s)
Sets off-diagonal elements with input scalar.
bool operator!=(const Matrix &m) const
Returns true if is not equal to m.
Matrix add(const Matrix &m) const
Returns this matrix + input matrix (element-wise).
Matrix2x2< T > operator+(const Matrix2x2< T > &a, const Matrix2x2< T > &b)
Returns a + b (element-size).
Matrix & operator/=(T s)
Division assignment with input scalar.
Matrix sub(const Matrix &m) const
Returns this matrix - input matrix (element-wise).
Matrix(const Matrix &m)
Constructs a matrix with input matrix.
Matrix mul(T s) const
Returns this matrix * input scalar.
Matrix(T s)
Constructs constant value matrix.
bool operator==(const Matrix &m) const
Returns true if is equal to m.
Matrix3x3< float > Matrix3x3F
Float-type 3x3 matrix.
Definition: matrix3x3.h:399
Matrix3x3< double > Matrix3x3D
Double-type 3x3 matrix.
Definition: matrix3x3.h:402
T determinant() const
Returns determinant of this matrix.
void set(const std::initializer_list< std::initializer_list< U >> &lst)
Sets a matrix with given initializer list lst.
static Matrix makeIdentity()
Makes all diagonal elements to 1, and other elements to 0.
Matrix rdiv(T s) const
Returns input scalar / this matrix.
void imul(T s)
Multiplies input scalar to this matrix.
void set(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22)
T & operator()(size_t i, size_t j)
Returns reference of (i,j) element.
T absmin() const
Returns absolute minimum among all elements.
Matrix div(T s) const
Returns this matrix / input scalar.
Matrix rmul(const Matrix &m) const
Returns input matrix * this matrix.
void idiv(T s)
Divides this matrix with input scalar.
Matrix rsub(T s) const
Returns input scalar - this matrix.
3-D vector class.
Definition: vector3.h:25
Matrix strictUpperTri() const
Returns strictly upper triangle part of this matrix.
Matrix inverse() const
Returns inverse matrix.
Matrix2x2< T > operator/(const Matrix2x2< T > &a, T b)
Returns a' / b, where every element of matrix a' is a.
const T & operator[](size_t i) const
Returns constant reference of i-th element.
Matrix upperTri() const
Returns upper triangle part of this matrix (including the diagonal).
Matrix2x2< T > operator-(const Matrix2x2< T > &a)
Returns a matrix with opposite sign.
Matrix rmul(T s) const
Returns input scalar * this matrix.
Matrix & operator*=(T s)
Multiplication assignment with input scalar.
T avg() const
Returns average of all elements.
Matrix2x2< T > operator*(const Matrix2x2< T > &a, T b)
Returns a * b', where every element of matrix b' is b.
static Matrix makeScaleMatrix(T sx, T sy, T sz)
Makes scale matrix.
T & operator[](size_t i)
Returns reference of i-th element.
Matrix< U, 3, 3 > castTo() const
static Matrix makeZero()
Sets all matrix entries to zero.