![]() |
Kale
|
#include <Matrix.hpp>
Public Member Functions | |
Matrix () | |
Matrix (const std::array< T, w *h > &arr) | |
Matrix (std::array< T, w *h > &&arr) | |
size_t | width () const |
size_t | height () const |
T & | operator[] (size_t i) |
const T & | operator[] (size_t i) const |
T & | operator() (size_t col, size_t row) |
const T & | operator() (size_t col, size_t row) const |
T & | get (size_t i) |
const T & | get (size_t i) const |
T & | get (size_t col, size_t row) |
const T & | get (size_t col, size_t row) const |
Matrix< w, h, T > | operator+ (const Matrix< w, h, T > &other) const |
Matrix< w, h, T > | operator+ (Matrix< w, h, T > &&other) const |
void | operator+= (const Matrix< w, h, T > &other) |
Matrix< w, h, T > | operator- (const Matrix< w, h, T > &other) const |
Matrix< w, h, T > | operator- (Matrix< w, h, T > &&other) const |
void | operator-= (const Matrix< w, h, T > &other) |
Matrix< w, h, T > | operator* (T scalar) const |
void | operator*= (T scalar) |
template<size_t w2> | |
Matrix< w2, h, T > | operator* (const Matrix< w2, w, T > &other) const |
Matrix< h, w, T > | transpose () const |
void | swapRows (size_t row1, size_t row2) |
void | scaleRow (size_t row, T scalar) |
void | addScaledRow (size_t row1, size_t row2, T scalar) |
template<size_t W = w, size_t H = h> | |
std::enable_if< W==2 &&H==2, Vector2< T > >::type | operator* (const Vector2< T > &vec) const |
template<size_t W = w, size_t H = h> | |
std::enable_if< W==2 &&H==2, Vector2< T > >::type | operator* (Vector2< T > &&vec) const |
template<size_t W = w, size_t H = h> | |
std::enable_if< W==3 &&H==3, Vector3< T > >::type | operator* (const Vector3< T > &vec) const |
template<size_t W = w, size_t H = h> | |
std::enable_if< W==3 &&H==3, Vector3< T > >::type | operator* (Vector3< T > &&vec) const |
template<size_t W = w, size_t H = h> | |
std::enable_if< W==4 &&H==4, Vector4< T > >::type | operator* (const Vector4< T > &vec) const |
template<size_t W = w, size_t H = h> | |
std::enable_if< W==4 &&H==4, Vector4< T > >::type | operator* (Vector4< T > &&vec) const |
template<typename R , size_t W = w, size_t H = h> | |
std::enable_if< W==2 &&H==2, R >::type | det () const |
template<typename R , size_t W = w, size_t H = h> | |
std::enable_if< W==3 &&H==3, R >::type | det () const |
template<typename R , size_t W = w, size_t H = h> | |
std::enable_if< W==H &&(W >3)&&std::is_signed< R >::value, R >::type | det () const |
template<size_t W = w, size_t H = h> | |
std::enable_if< W==2 &&H==2, Matrix< W, H, T > >::type | inverse () |
template<size_t W = w, size_t H = h> | |
std::enable_if< W==3 &&H==3, Matrix< W, H, T > >::type | inverse () |
Public Attributes | |
std::array< T, w *h > | data |
Represents a single matrix
c | The width/columns of the matrix |
r | The height/rows of the matrix |
T | The number type stored within the matrix |
Definition at line 49 of file Matrix.hpp.
|
inline |
Creates a 0 initialized matrix
Definition at line 60 of file Matrix.hpp.
|
inline |
Creates a matrix from an array, the array must have a length of w*h and follow rows -> columns ie { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arr | The array |
Definition at line 74 of file Matrix.hpp.
|
inline |
Creates a matrix from an array, the array must have a length of w*h and follow rows -> columns ie { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
arr | The array |
Definition at line 88 of file Matrix.hpp.
|
inline |
Adds a row scaled to another row and saves it
row1 | The row to add to (this row is modified) |
row2 | The row to scale by and add from |
scalar | The scalar to scale row2 by |
In | debug mode only if the row is invalid, no release checks/throws are made. It will crash. |
Definition at line 344 of file Matrix.hpp.
|
inline |
Retrieves the determinant for any square matrix
R | the return type to use (larger matrices may require a large type for determinants) |
Definition at line 439 of file Matrix.hpp.
|
inline |
Retrieves the determinant for any square matrix
R | the return type to use (larger matrices may require a large type for determinants) |
Definition at line 450 of file Matrix.hpp.
|
inline |
Retrieves the determinant for any square matrix
R | the return type to use (larger matrices may require a large type for determinants) |
Definition at line 467 of file Matrix.hpp.
|
inline |
Returns an element given the column and row
col | The column |
row | The row |
Definition at line 190 of file Matrix.hpp.
|
inline |
Returns an element given the column and row
col | The column |
row | The row |
Definition at line 200 of file Matrix.hpp.
|
inline |
Returns an element directly from the data array of the matrix. Elements are stored by (col, row) => row * width + col
i | The element index |
Definition at line 170 of file Matrix.hpp.
|
inline |
Returns an element directly from the data array of the matrix. Elements are stored by (col, row) => row * width + col
i | The element index |
Definition at line 180 of file Matrix.hpp.
|
inline |
Returns the height of the matrix
Definition at line 104 of file Matrix.hpp.
|
inline |
Calculates the inverse of the matrix for a square matrix
Definition at line 476 of file Matrix.hpp.
|
inline |
Calculates the inverse of the matrix for a square matrix
Definition at line 488 of file Matrix.hpp.
|
inline |
Returns an element given the column and row
col | The column |
row | The row |
In | debug mode only if the col/row is invalid, no release checks/throws are made. It will crash. |
Definition at line 143 of file Matrix.hpp.
|
inline |
Returns an element given the column and row
col | The column |
row | The row |
In | debug mode only if the col/row is invalid, no release checks/throws are made. It will crash. |
Definition at line 157 of file Matrix.hpp.
|
inline |
Performs Matrix Multiplication (this * other).
other | The matrix to multiply with |
Definition at line 286 of file Matrix.hpp.
|
inline |
Transforms the vector by this matrix
vec | The vector to transform |
Definition at line 361 of file Matrix.hpp.
|
inline |
Transforms the vector by this matrix
vec | The vector to transform |
Definition at line 383 of file Matrix.hpp.
|
inline |
Transforms the vector by this matrix
vec | The vector to transform |
Definition at line 410 of file Matrix.hpp.
|
inline |
Scales the matrix by a scalar and returns the result
scalar | The scalar to scale by |
Definition at line 267 of file Matrix.hpp.
|
inline |
Transforms the vector by this matrix
vec | The vector to transform |
Definition at line 371 of file Matrix.hpp.
|
inline |
Transforms the vector by this matrix
vec | The vector to transform |
Definition at line 397 of file Matrix.hpp.
|
inline |
Transforms the vector by this matrix
vec | The vector to transform |
Definition at line 425 of file Matrix.hpp.
|
inline |
Scales the matrix by a scalar and stores the result in this matrix
scalar | The scalar to scale by |
Definition at line 277 of file Matrix.hpp.
|
inline |
Adds this matrix to another and returns the result
other | The matrix to add to |
Definition at line 209 of file Matrix.hpp.
|
inline |
Adds this matrix to another and returns the result
other | The matrix to add to |
Definition at line 220 of file Matrix.hpp.
|
inline |
Adds this matrix to another and saves the result in this matrix
other | The matrix to add to |
Definition at line 229 of file Matrix.hpp.
|
inline |
Subtracts another matrix from this matrix (this - other)
other | The matrix to subtract |
Definition at line 238 of file Matrix.hpp.
|
inline |
Subtracts another matrix from this matrix (this - other)
other | The matrix to subtract |
Definition at line 249 of file Matrix.hpp.
|
inline |
Subtracts another matrix from this matrix (this - other) and saves the result in this matrix
other | The matrix to subtract |
Definition at line 258 of file Matrix.hpp.
|
inline |
Returns an element directly from the data array of the matrix. Elements are stored by (col, row) => row * width + col
i | The element index |
In | debug mode only if the index is invalid, no release checks/throws are made. It will crash. |
Definition at line 115 of file Matrix.hpp.
|
inline |
Returns an element directly from the data array of the matrix. Elements are stored by (col, row) => row * width + col
i | The element index |
In | debug mode only if the index is invalid, no release checks/throws are made. It will crash. |
Definition at line 129 of file Matrix.hpp.
|
inline |
Scales a row within the matrix
row | The row to scale |
scalar | The scalar to scale by |
In | debug mode only if the row is invalid, no release checks/throws are made. It will crash. |
Definition at line 328 of file Matrix.hpp.
|
inline |
Swaps 2 rows within the matrix
row1 | The first row |
row2 | The second row |
In | debug mode only if the row is invalid, no release checks/throws are made. It will crash. |
Definition at line 315 of file Matrix.hpp.
|
inline |
Transposes the matrix and returns the result of the operation
Definition at line 299 of file Matrix.hpp.
|
inline |
Returns the width of the matrix
Definition at line 96 of file Matrix.hpp.
std::array<T, w*h> Kale::Matrix< w, h, T >::data |
The matrix internal data
Definition at line 55 of file Matrix.hpp.