OGLplus (0.52.0) a C++ wrapper for OpenGL

oglplus::Matrix< T, Rows, Cols > Class Template Reference

Base template for Matrix. More...

#include </home/chochlik/devel/oglplus/include/oglplus/math/matrix.hpp>

Public Member Functions

 Matrix (void)
 Default construction (identity matrix)
 
 Matrix (const T *data, std::size_t n)
 Constructuion from raw data.
 
 Matrix (const T(&data)[Rows *Cols])
 Constructuion from static array.
 
template<typename... P>
 Matrix (P...p)
 Initializing constructor. More...
 
template<typename... C>
 Matrix (const Vector< T, C >...row)
 Initialization from row vectors. More...
 
const TData (void) const
 Returns a pointer to the matrix elements in row major order.
 
std::size_t Size (void) const
 Returns the number of elements of the matrix.
 
T At (std::size_t i, std::size_t j) const
 Returns the value of the element at position i, j. More...
 
void Set (std::size_t i, std::size_t j, T v)
 Sets the value of the element at position i, j. More...
 
Vector< T, ColsRow (std::size_t i) const
 Returns the i-th row of this matrix. More...
 
Vector< T, RowsCol (std::size_t j) const
 Return the j-th column of this matrix. More...
 
template<std::size_t I, std::size_t J, std::size_t R, std::size_t C>
Matrix< T, R, C > Submatrix (void) const
 Submatrix extraction.
 

Friends

const TData (const Matrix &matrix)
 Returns apointer to the matrix elements in row major order.
 
std::size_t Size (const Matrix &matrix)
 Returns the number of elements of the matrix.
 
std::size_t Rows (const Matrix &matrix)
 Returns the number of rows of the matrix.
 
std::size_t Cols (const Matrix &matrix)
 Returns the number of columns of the matrix.
 
bool Equal (const Matrix &a, const Matrix &b)
 Equality comparison function.
 
bool operator== (const Matrix &a, const Matrix &b)
 Equality comparison operator.
 
bool operator!= (const Matrix &a, const Matrix &b)
 Unequality comparison operator.
 
Matrix Negated (const Matrix &a)
 Element negation function.
 
Matrix operator- (const Matrix &a)
 Element negation operator.
 
Matrix Added (const Matrix &a, const Matrix &b)
 Matrix addition.
 
Matrix operator+ (const Matrix &a, const Matrix &b)
 Matrix addition operator.
 
Matrix Subtracted (const Matrix &a, const Matrix &b)
 Matrix subtraction.
 
Matrix operator- (const Matrix &a, const Matrix &b)
 Matrix subtraction operator.
 
template<std::size_t N>
Matrix Multiplied (const Matrix< T, Rows, N > &a, const Matrix< T, N, Cols > &b)
 Matrix multiplication.
 
template<std::size_t N>
Matrix operator* (const Matrix< T, Rows, N > &a, const Matrix< T, N, Cols > &b)
 Matrix multiplication operator.
 
Matrix Multiplied (const Matrix &a, T m)
 Multiplication by scalar value.
 
Matrix operator* (const Matrix &a, T m)
 Multiplication by scalar value operator.
 
Matrix operator* (T m, const Matrix &a)
 Multiplication by scalar value operator.
 
Matrix Transposed (const Matrix< T, Cols, Rows > &a)
 Matrix transposition.
 
Matrix< T, 2, 2 > Sub2x2 (const Matrix &a)
 2x2 submatrix extraction
 
Matrix< T, 3, 3 > Sub3x3 (const Matrix &a)
 3x3 submatrix extraction
 
void RowSwap (Matrix &m, std::size_t a, std::size_t b)
 Swaps two rows of the Matrix.
 
void RowMultiply (Matrix &m, std::size_t i, T k)
 Multiplies row i with coeficient k.
 
void RowAdd (Matrix &m, std::size_t a, std::size_t b, T k)
 Adds row b multipled by coeficient k to row a.
 
template<std::size_t C>
bool Gauss (Matrix &a, Matrix< T, Rows, C > &b)
 The gaussian matrix elimination.
 
template<std::size_t C>
bool GaussJordan (Matrix &a, Matrix< T, Rows, C > &b)
 The Gauss-Jordan matrix elimination.
 

Detailed Description

template<typename T, std::size_t Rows, std::size_t Cols>
class oglplus::Matrix< T, Rows, Cols >

Base template for Matrix.

Examples:
standalone/029_mandelbrot_glfw3.cpp.

Constructor & Destructor Documentation

template<typename T, std::size_t Rows, std::size_t Cols>
template<typename... P>
oglplus::Matrix< T, Rows, Cols >::Matrix ( P...  p)
explicit

Initializing constructor.

Allows to explicitly initialize all elements of the matrix. The number of parameters of this constructor must be Rows * Cols.

Precondition
(sizeof...(P) == Rows*Cols)
template<typename T, std::size_t Rows, std::size_t Cols>
template<typename... C>
oglplus::Matrix< T, Rows, Cols >::Matrix ( const Vector< T, C >...  row)
explicit

Initialization from row vectors.

Allows to initialize the matrix from row vectors The number of vectors must be Rows, each vector must have Cols components.

Precondition
(sizeof...(C) == Rows) && (C == Cols)...

Member Function Documentation

template<typename T, std::size_t Rows, std::size_t Cols>
T oglplus::Matrix< T, Rows, Cols >::At ( std::size_t  i,
std::size_t  j 
) const

Returns the value of the element at position i, j.

Precondition
(i < Rows) && (j < Cols)
template<typename T, std::size_t Rows, std::size_t Cols>
Vector<T, Rows> oglplus::Matrix< T, Rows, Cols >::Col ( std::size_t  j) const

Return the j-th column of this matrix.

Precondition
(j < Cols)
template<typename T, std::size_t Rows, std::size_t Cols>
Vector<T, Cols> oglplus::Matrix< T, Rows, Cols >::Row ( std::size_t  i) const

Returns the i-th row of this matrix.

Precondition
(i < Rows)
template<typename T, std::size_t Rows, std::size_t Cols>
void oglplus::Matrix< T, Rows, Cols >::Set ( std::size_t  i,
std::size_t  j,
T  v 
)

Sets the value of the element at position i, j.

Precondition
(i < Rows) && (j < Cols)

The documentation for this class was generated from the following files:
  • /home/chochlik/devel/oglplus/include/oglplus/fwd.hpp
  • /home/chochlik/devel/oglplus/include/oglplus/math/matrix.hpp

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).