Math API nvidia_logo_transpbg.gif Up
matrix.h File Reference

A NxM-dimensional matrix class template of fixed dimensions with supporting functions. More...

Go to the source code of this file.

Classes

struct  mi::math::Matrix_struct<T, ROW, COL>
 Storage class for a NxM-dimensional matrix class template of fixed dimensions. More...
 
struct  mi::math::Matrix_struct<T, 1, 1>
 Specialization for 1x1-matrix. More...
 
struct  mi::math::Matrix_struct<T, 2, 1>
 Specialization for 2x1-matrix. More...
 
struct  mi::math::Matrix_struct<T, 3, 1>
 Specialization for 3x1-matrix. More...
 
struct  mi::math::Matrix_struct<T, 4, 1>
 Specialization for 4x1-matrix. More...
 
struct  mi::math::Matrix_struct<T, 1, 2>
 Specialization for 1x2-matrix. More...
 
struct  mi::math::Matrix_struct<T, 2, 2>
 Specialization for 2x2-matrix. More...
 
struct  mi::math::Matrix_struct<T, 3, 2>
 Specialization for 3x2-matrix. More...
 
struct  mi::math::Matrix_struct<T, 4, 2>
 Specialization for 4x2-matrix. More...
 
struct  mi::math::Matrix_struct<T, 1, 3>
 Specialization for 1x3-matrix. More...
 
struct  mi::math::Matrix_struct<T, 2, 3>
 Specialization for 2x3-matrix. More...
 
struct  mi::math::Matrix_struct<T, 3, 3>
 Specialization for 3x3-matrix. More...
 
struct  mi::math::Matrix_struct<T, 4, 3>
 Specialization for 4x3-matrix. More...
 
struct  mi::math::Matrix_struct<T, 1, 4>
 Specialization for 1x4-matrix. More...
 
struct  mi::math::Matrix_struct<T, 2, 4>
 Specialization for 2x4-matrix. More...
 
struct  mi::math::Matrix_struct<T, 3, 4>
 Specialization for 3x4-matrix. More...
 
struct  mi::math::Matrix_struct<T, 4, 4>
 Specialization for 4x4-matrix. More...
 
class  mi::math::Matrix<T, ROW, COL>
 NxM-dimensional matrix class template of fixed dimensions. More...
 

Namespaces

namespace  mi
 Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
 
namespace  mi::math
 Namespace for the Math API.
 

Functions

template<typename T , Size ROW, Size COL>
T * mi::math::matrix_base_ptr (Matrix_struct<T, ROW, COL> &mat)
 Returns the base pointer to the matrix data. More...
 
template<typename T , Size ROW, Size COL>
const T * mi::math::matrix_base_ptr (const Matrix_struct<T, ROW, COL> &mat)
 Returns the base pointer to the matrix data. More...
 
template<typename T , Size ROW, Size COL>
bool mi::math::operator== (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Returns true if lhs is elementwise equal to rhs. More...
 
template<typename T , Size ROW, Size COL>
bool mi::math::operator!= (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Returns true if lhs is elementwise not equal to rhs. More...
 
template<typename T , Size ROW, Size COL>
bool mi::math::operator< (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Returns true if lhs is lexicographically less than rhs. More...
 
template<typename T , Size ROW, Size COL>
bool mi::math::operator<= (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Returns true if lhs is lexicographically less than or equal to rhs. More...
 
template<typename T , Size ROW, Size COL>
bool mi::math::operator> (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Returns true if lhs is lexicographically greater than rhs. More...
 
template<typename T , Size ROW, Size COL>
bool mi::math::operator>= (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Returns true if lhs is lexicographically greater than or equal to rhs. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> & mi::math::operator+= (Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Adds rhs elementwise to lhs and returns the modified lhs. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> & mi::math::operator-= (Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Subtracts rhs elementwise from lhs and returns the modified lhs. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> mi::math::operator+ (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Adds lhs and rhs elementwise and returns the new result. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> mi::math::operator- (const Matrix<T, ROW, COL> &lhs, const Matrix<T, ROW, COL> &rhs)
 Subtracts rhs elementwise from lhs and returns the new result. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> mi::math::operator- (const Matrix<T, ROW, COL> &mat)
 Negates the matrix mat elementwise and returns the new result. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> & mi::math::operator*= (Matrix<T, ROW, COL> &lhs, const Matrix<T, COL, COL> &rhs)
 Performs matrix multiplication, lhs times rhs, assigns it to lhs, and returns the modified lhs. More...
 
template<typename T , Size ROW1, Size COL1, Size ROW2, Size COL2>
Matrix<T, ROW1, COL2> mi::math::operator* (const Matrix<T, ROW1, COL1> &lhs, const Matrix<T, ROW2, COL2> &rhs)
 Performs matrix multiplication, lhs times rhs, and returns the new result. More...
 
template<typename T , Size ROW, Size COL, Size DIM>
Vector<T, ROW> mi::math::operator* (const Matrix<T, ROW, COL> &mat, const Vector<T, DIM> &vec)
 Multiplies the (column) vector vec from the right with the matrix mat and returns the resulting vector. More...
 
template<Size DIM, typename T , Size ROW, Size COL>
Vector<T, COL> mi::math::operator* (const Vector<T, DIM> &vec, const Matrix<T, ROW, COL> &mat)
 Multiplies the (row) vector vec from the left with the matrix mat and returns the resulting vector. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> & mi::math::operator*= (Matrix<T, ROW, COL> &mat, T factor)
 Multiplies the matrix mat elementwise with the scalar factor and returns the modified matrix mat. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> mi::math::operator* (const Matrix<T, ROW, COL> &mat, T factor)
 Multiplies the matrix mat elementwise with the scalar factor and returns the new result. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, ROW, COL> mi::math::operator* (T factor, const Matrix<T, ROW, COL> &mat)
 Multiplies the matrix mat elementwise with the scalar factor and returns the new result. More...
 
template<Size NEW_ROW, Size NEW_COL, typename T , Size ROW, Size COL>
Matrix< T, NEW_ROW, NEW_COLmi::math::sub_matrix (const Matrix<T, ROW, COL> &mat)
 Returns the upper-left sub-matrix of size NEW_ROW times NEW_COL. More...
 
template<typename T , Size ROW, Size COL>
Matrix<T, COL, ROW> mi::math::transpose (const Matrix<T, ROW, COL> &mat)
 Returns the transpose of the matrix mat by exchanging rows and columns. More...
 
template<typename T , typename U>
mi::math::transform_point (const Matrix<T, 4, 4> &mat, const U &point)
 Returns a transformed 1D point by applying the full transformation in the 4x4 matrix mat on the 1D point point, which includes the translation. More...
 
template<typename T , typename U>
Vector<U, 2> mi::math::transform_point (const Matrix<T, 4, 4> &mat, const Vector<U, 2> &point)
 Returns a transformed 2D point by applying the full transformation in the 4x4 matrix mat on the 2D point point, which includes the translation. More...
 
template<typename T , typename U>
Vector<U, 3> mi::math::transform_point (const Matrix<T, 4, 3> &mat, const Vector<U, 3> &point)
 Returns a transformed 3D point by applying the full transformation in the 4x3 matrix mat on the 3D point point, which includes the translation. More...
 
template<typename T , typename U>
Vector<U, 3> mi::math::transform_point (const Matrix<T, 4, 4> &mat, const Vector<U, 3> &point)
 Returns a transformed 3D point by applying the full transformation in the 4x4 matrix mat on the 3D point point, which includes the translation. More...
 
template<typename T , typename U>
Vector<U, 4> mi::math::transform_point (const Matrix<T, 4, 4> &mat, const Vector<U, 4> &point)
 Returns a transformed 4D point by applying the full transformation in the 4x4 matrix mat on the 4D point point, which includes the translation. More...
 
template<typename T , typename U>
mi::math::transform_vector (const Matrix<T, 4, 4> &mat, const U &vector)
 Returns a transformed 1D vector by applying the 1x1 linear sub-transformation in the 4x4 matrix mat on the 1D vector vector, which excludes the translation. More...
 
template<typename T , typename U>
Vector<U, 2> mi::math::transform_vector (const Matrix<T, 4, 4> &mat, const Vector<U, 2> &vector)
 Returns a transformed 2D vector by applying the 2x2 linear sub-transformation in the 4x4 matrix mat on the 2D vector vector, which excludes the translation. More...
 
template<typename T , typename U>
Vector<U, 3> mi::math::transform_vector (const Matrix<T, 3, 3> &mat, const Vector<U, 3> &vector)
 Returns a transformed 3D vector by applying the 3x3 matrix mat transformation on the 3D vector vector. More...
 
template<typename T , typename U>
Vector<U, 3> mi::math::transform_vector (const Matrix<T, 4, 3> &mat, const Vector<U, 3> &vector)
 Returns a transformed 3D vector by applying the 3x3 linear sub-transformation in the 4x3 matrix mat on the 3D vector vector, which excludes the translation. More...
 
template<typename T , typename U>
Vector<U, 3> mi::math::transform_vector (const Matrix<T, 4, 4> &mat, const Vector<U, 3> &vector)
 Returns a transformed 3D vector by applying the 3x3 linear sub-transformation in the 4x4 matrix mat on the 3D vector vector, which excludes the translation. More...
 
template<typename T , typename U>
Vector<U, 3> mi::math::transform_normal_inv (const Matrix<T, 3, 3> &inv_mat, const Vector<U, 3> &normal)
 Returns an inverse transformed 3D normal vector by applying the 3x3 transposed linear transformation in the matrix inv_mat on the 3D normal vector normal. More...
 
template<typename T , typename U>
Vector<U, 3> mi::math::transform_normal_inv (const Matrix<T, 4, 4> &inv_mat, const Vector<U, 3> &normal)
 Returns an inverse transformed 3D normal vector by applying the 3x3 transposed linear sub-transformation in the 4x4 matrix inv_mat on the 3D normal vector normal. More...
 
template<typename T , typename U>
Vector<U, 3> mi::math::transform_normal (const Matrix<T, 4, 4> &mat, const Vector<U, 3> &normal)
 Returns a transformed 3D normal vector by applying the 3x3 transposed linear sub-transformation in the inverse of the 4x4 matrix mat on the 3D normal vector normal. More...
 

Detailed Description

A NxM-dimensional matrix class template of fixed dimensions with supporting functions.

See Matrix Class.