philsupertramp/game-math
Loading...
Searching...
No Matches
Classes | Functions
Matrix.h File Reference
#include "Random.h"
#include "vec/vec3.h"
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <memory>
#include <type_traits>
#include <signal.h>

Go to the source code of this file.

Classes

struct  MatrixDimension
 
class  Matrix< T >
 

Functions

template<typename T >
Matrix< T > operator+ (const Matrix< T > &lhs, const Matrix< T > &rhs)
 
template<typename T >
Matrix< T > operator- (const Matrix< T > &lhs, const Matrix< T > &rhs)
 
template<typename T , typename U >
Matrix< T > operator/ (U lhs, const Matrix< T > &rhs)
 
template<typename T , typename U >
Matrix< T > operator/ (const Matrix< T > &lhs, const U &rhs)
 
template<typename T >
Matrix< T > operator/ (const Matrix< T > &lhs, const Matrix< T > &rhs)
 
template<typename T , typename U >
Matrix< T > operator* (const Matrix< T > &lhs, const U &rhs)
 
template<typename T , typename U >
Matrix< T > operator* (U lambda, const Matrix< T > &A)
 
template<typename T >
Matrix< T > operator* (const Matrix< T > &lhs, const Matrix< T > &rhs)
 

Function Documentation

◆ operator*() [1/3]

template<typename T >
Matrix< T > operator* ( const Matrix< T > &  lhs,
const Matrix< T > &  rhs 
)
inline

Regular Matrix-Matrix multiplication Calculates LHS * RHS

Parameters
lhs
rhs
Returns
Rows x C result matrix

◆ operator*() [2/3]

template<typename T , typename U >
Matrix< T > operator* ( const Matrix< T > &  lhs,
const U &  rhs 
)
inline

Simple Matrix scalar multiplication

Parameters
lhs
rhs
Returns
scaled matrix

◆ operator*() [3/3]

template<typename T , typename U >
Matrix< T > operator* ( lambda,
const Matrix< T > &  A 
)
inline

Simple Matrix scalar multiplication

Parameters
lambda
A
Returns
scaled matrix lambda * A = B with B(i, j) = lambda * A(i, j)

◆ operator+()

template<typename T >
Matrix< T > operator+ ( const Matrix< T > &  lhs,
const Matrix< T > &  rhs 
)
inline

Extra operators Matrix-Addition

Template Parameters
T
Parameters
lhs
rhs
Returns

◆ operator-()

template<typename T >
Matrix< T > operator- ( const Matrix< T > &  lhs,
const Matrix< T > &  rhs 
)
inline

Matrix-Subtraction

Template Parameters
T
Parameters
lhs
rhs
Returns

◆ operator/() [1/3]

template<typename T >
Matrix< T > operator/ ( const Matrix< T > &  lhs,
const Matrix< T > &  rhs 
)
inline

Matrix-Matrix division, element wise division if rhs is matrix. Row/Column-wise division for given rhs vector.

rhs matrix: lhs: N x M rhs: M x T result: N x T

rhs vector: lhs: N x M rhs: 1 x M or M x 1 result: N x M

Template Parameters
valuetype of matrix elements
Parameters
lhsmatrix divident
rhsmatrix divisor @retrun matrix in dimension of given

◆ operator/() [2/3]

template<typename T , typename U >
Matrix< T > operator/ ( const Matrix< T > &  lhs,
const U &  rhs 
)
inline

Element wise division of matrix elements with given scalar

Template Parameters
Tvalue type of elements inside given matrix
Parameters
lhsmatrix divident
rhsscalar divisor
Returns

◆ operator/() [3/3]

template<typename T , typename U >
Matrix< T > operator/ ( lhs,
const Matrix< T > &  rhs 
)
inline

Scalar Matrix-division

Template Parameters
Tvalue type of elements inside given matrix
Parameters
lhsscalar divident
rhsmatrix divisor
Returns