3.0.0
Freundlich's C++ toolkit
Classes | Typedefs | Functions
fcppt::math::matrix Namespace Reference

Contains matrix::object and helper functions, classes and types for it. More...

Classes

struct  has_dim
 Metafunction to check if a static matrix has the specified dimensions. More...
 
struct  has_dim< fcppt::math::matrix::object< T, R, C, S >, DR, DC >
 
struct  index
 A static matrix index. More...
 
struct  is_matrix
 Metafunction to test if a type is a matrix type. More...
 
class  object
 A class representing a static matrix. More...
 
struct  object< T, R, C, S >>
 

Typedefs

template<typename T , fcppt::math::size_type C>
using row_type = fcppt::math::vector::static_< T, C >
 The type of matrix row. More...
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C>
using static_ = fcppt::math::matrix::object< T, R, C, fcppt::math::matrix::detail::static_storage< T, R, C > >
 Typedef helper for static matrices. More...
 
template<typename Matrix >
using to_static = fcppt::math::matrix::static_< fcppt::type_traits::value_type< Matrix >, Matrix::static_rows::value, Matrix::static_columns::value >
 The static type of a matrix. More...
 

Functions

template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, N > adjugate (fcppt::math::matrix::object< T, N, N, S > const &_matrix)
 Calculates the adjugate matrix. More...
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left,+, Right), R, C > operator+ (fcppt::math::matrix::object< Left, R, C, S1 > const &_left, fcppt::math::matrix::object< Right, R, C, S2 > const &_right)
 Adds two matrices. More...
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left, -, Right), R, C > operator- (fcppt::math::matrix::object< Left, R, C, S1 > const &_left, fcppt::math::matrix::object< Right, R, C, S2 > const &_right)
 Subtracts one matrix from another. More...
 
template<typename L , typename R , fcppt::math::size_type N, fcppt::math::size_type M1, fcppt::math::size_type M2, typename S1 , typename S2 >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L, *, R), M1, M2 > operator* (fcppt::math::matrix::object< L, M1, N, S1 > const &_left, fcppt::math::matrix::object< R, N, M2, S2 > const &_right)
 Multiplies two matrices. More...
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left, *, Right), R, C > operator* (fcppt::math::matrix::object< Left, R, C, S > const &_left, Right const &_right)
 Multiplies a matrix by a scalar. More...
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left, *, Right), R, C > operator* (Left const &_left, fcppt::math::matrix::object< Right, R, C, S > const &_right)
 Multiplies a matrix by a scalar. More...
 
template<fcppt::math::size_type Index, typename Matrix >
fcppt::container::to_reference_type< std::remove_reference_t< Matrix >> at_r (Matrix &_value)
 Access a row using a compile-time constant. More...
 
template<fcppt::math::size_type R, fcppt::math::size_type C, typename Matrix >
fcppt::container::to_reference_type< fcppt::container::to_reference_type< std::remove_reference_t< Matrix > >> at_r_c (Matrix &_value)
 Access an element using compile-time constants for both row and column. More...
 
template<typename T1 , typename T2 , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 , typename Function >
fcppt::math::matrix::static_< std::result_of_t< Function(T1, T2) >, R, C > binary_map (fcppt::math::matrix::object< T1, R, C, S1 > const &_left, fcppt::math::matrix::object< T2, R, C, S2 > const &_right, Function const &_function)
 Maps over two matrixs. More...
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool operator== (fcppt::math::matrix::object< T, R, C, S1 > const &_m1, fcppt::math::matrix::object< T, R, C, S2 > const &_m2)
 Compares two matrices component-wise. More...
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool operator!= (fcppt::math::matrix::object< T, R, C, S1 > const &_m1, fcppt::math::matrix::object< T, R, C, S2 > const &_m2)
 Compares two matrices component-wise. More...
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
bool componentwise_equal (fcppt::math::matrix::object< T, R, C, S1 > const &_m1, fcppt::math::matrix::object< T, R, C, S2 > const &_m2, T const _epsilon)
 Compares two floating point matrices componentwise using an epsilon. More...
 
template<fcppt::math::size_type DR, fcppt::math::size_type DC, typename T , typename S , fcppt::math::size_type R, fcppt::math::size_type C>
fcppt::math::matrix::static_< T, R - 1u, C - 1u > delete_row_and_column (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
 Deletes a specific row and rolumn (a cross) from the matrix. More...
 
template<typename T , fcppt::math::size_type N, typename S >
determinant (fcppt::math::matrix::object< T, N, N, S > const &_matrix)
 Calculates the determinant of a matrix. More...
 
template<typename T , fcppt::math::size_type DN, typename S >
fcppt::math::matrix::static_< T, DN, DN > exponential_pade (fcppt::math::matrix::object< T, DN, DN, S > const &_matrix)
 Calculates the matrix exponential e^A using a Pade approximation. More...
 
template<typename Matrix >
fcppt::math::matrix::to_static< Matrix > identity ()
 Returns the identity matrix;. More...
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
infinity_norm (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
 Calculates the infinity norm. More...
 
template<typename Matrix , typename Function >
Matrix init (Function const &_function)
 Initializes a matrix. More...
 
template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, N > inverse (fcppt::math::matrix::object< T, N, N, S > const &_matrix)
 Calculates the inverse matrix, uses fcppt::math::matrix::adjugate and fcppt::math::matrix::determinant. More...
 
template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, N > logarithm (fcppt::math::matrix::object< T, N, N, S > A, T const e1, T const e2, T const e3)
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S , typename Function >
fcppt::math::matrix::static_< std::result_of_t< Function(T) >, R, C > map (fcppt::math::matrix::object< T, R, C, S > const &_value, Function const &_function)
 Maps over the elements of a matrix. More...
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S , typename Ch , typename Traits >
std::basic_ostream< Ch, Traits > & operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::math::matrix::object< T, R, C, S > const &_matrix)
 Outputs the matrix to a basic_ostream More...
 
template<typename T >
fcppt::math::matrix::static_< T, 2, 2 > rotation_2d (T const _angle)
 Calculates a two dimensional rotation matrix. More...
 
template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > rotation_axis (T const _angle, fcppt::math::vector::object< T, 3, S > const &_vector)
 Calculates a 4x4 rotation matrix around an arbitrary axis given as a unit vector. More...
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > rotation_x (T const _angle)
 Calculates a 4x4 rotation matrix around the x axis. More...
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > rotation_y (T const _angle)
 Calculates a 4x4 rotation matrix around the y axis. More...
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > rotation_z (T const _angle)
 Calculates a 4x4 rotation matrix around the z axis. More...
 
template<typename Type , typename ... Args>
auto row (Type const &_value, Args const &..._args)
 Creates a matrix row for initialization. More...
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > scaling (T const _x, T const _y, T const _z)
 Calculates a 4x4 scaling matrix. More...
 
template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > scaling (fcppt::math::vector::object< T, 3, S > const &_vec)
 Calculates a scaling matrix from a three dimensional vector. More...
 
template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, N > sqrt (fcppt::math::matrix::object< T, N, N, S > const &_matrix, T const _epsilon)
 
template<typename Dest , typename Conv , typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
Dest structure_cast (fcppt::math::matrix::object< T, R, C, S > const &src)
 Converts a matrix into a different matrix of the same dimension using Conv. More...
 
template<typename T , typename S1 , typename S2 >
fcppt::math::vector::static_< T, 3 > transform_direction (fcppt::math::matrix::object< T, 4, 4, S1 > const &_matrix, fcppt::math::vector::object< T, 3, S2 > const &_vector)
 Multiplies a 4x4 matrix by a 3D vector, adding 0 for w, returns a 3D vector. More...
 
template<typename T , typename S1 , typename S2 >
fcppt::math::vector::static_< T, 3 > transform_point (fcppt::math::matrix::object< T, 4, 4, S1 > const &_matrix, fcppt::math::vector::object< T, 3, S2 > const &_vector)
 Multiplies a 4x4 matrix by a 3D vector, adding 1 for w, returns a 3D vector. More...
 
template<typename T >
fcppt::math::matrix::static_< T, 4, 4 > translation (T const _x, T const _y, T const _z)
 Calculates a 4x4 translation matrix from three coordinates. More...
 
template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4 > translation (fcppt::math::vector::object< T, 3, S > const &_vec)
 Calculates a 4x4 translation matrix from a three-dimensional vector. More...
 
template<typename T , fcppt::math::size_type R, fcppt::math::size_type C, typename S >
fcppt::math::matrix::static_< T, C, R > transpose (fcppt::math::matrix::object< T, R, C, S > const &_matrix)
 Calculates a transposed matrix. More...
 
template<typename Left , typename Right , fcppt::math::size_type R, fcppt::math::size_type C, typename S1 , typename S2 >
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(Left, *, Right), R > operator* (fcppt::math::matrix::object< Left, R, C, S1 > const &_left, fcppt::math::vector::object< Right, C, S2 > const &_right)
 Multiplies a matrix by a vector. More...
 

Detailed Description

Contains matrix::object and helper functions, classes and types for it.

Function Documentation

◆ logarithm()

template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, N> fcppt::math::matrix::logarithm ( fcppt::math::matrix::object< T, N, N, S >  A,
T const  e1,
T const  e2,
T const  e3 
)

◆ scaling()

template<typename T , typename S >
fcppt::math::matrix::static_< T, 4, 4> fcppt::math::matrix::scaling ( fcppt::math::vector::object< T, 3, S > const &  _vec)
inline

Calculates a scaling matrix from a three dimensional vector.

◆ sqrt()

template<typename T , fcppt::math::size_type N, typename S >
fcppt::math::matrix::static_< T, N, N> fcppt::math::matrix::sqrt ( fcppt::math::matrix::object< T, N, N, S > const &  _matrix,
T const  _epsilon 
)