OGLplus  (0.59.0) a C++ wrapper for rendering APIs

matrix.hpp File Reference
#include "../assert.hpp"
#include "../maybe_unused.hpp"
#include "vector.hpp"
#include <utility>

Go to the source code of this file.

Classes

struct  eagine::math::matrix< T, C, R, RM, V >
 Basic RxC matrix implementation template. More...
 
struct  eagine::math::is_row_major< matrix< T, C, R, RM, V > >
 Class testing if a matrix type is row-major. More...
 
struct  eagine::math::reordered_matrix< matrix< T, C, R, RM, V > >
 Implementation of reordered_matrix_t. More...
 
struct  eagine::math::is_matrix_constructor< X >
 Indicates if the specified type X is a matrix constructor. More...
 
struct  eagine::math::constructed_matrix< X >
 Gets the constructed matrix type for a matrix constructor type. More...
 

Namespaces

 eagine
 Common code is placed in this namespace.
 
 eagine::math
 Math-related code is placed in this namespace.
 

Typedefs

template<typename X >
using eagine::math::reordered_matrix_t = typename reordered_matrix< X >::type
 Trait returns a reordered (switch row/column-major) type for a matrix type.
 
template<typename X >
using eagine::math::constructed_matrix_t = typename constructed_matrix< X >::type
 Trait returning the matrix type constructed by constructor type X.
 

Functions

template<typename T , int C, int R, bool RM, bool V>
static constexpr auto eagine::math::rows (const matrix< T, C, R, RM, V > &) noexcept
 Returns then number of matrix rows.
 
template<typename T , int C, int R, bool RM, bool V>
static constexpr auto eagine::math::columns (const matrix< T, C, R, RM, V > &) noexcept
 Returns then number of matrix columns.
 
template<typename T , int C, int R, bool RM, bool V>
static constexpr auto eagine::math::row_major (const matrix< T, C, R, RM, V > &) noexcept
 Indicates if a matrix is row-major.
 
template<typename T , int N, bool RM, bool V>
static constexpr auto eagine::math::dimension (const matrix< T, N, N, RM, V > &) noexcept
 Returns the dimension of a square matrix.
 
template<int CI, int RI, typename T , int C, int R, bool V>
static constexpr auto eagine::math::get_cm (const matrix< T, C, R, false, V > &m) noexcept -> std::enable_if_t<(CI< C &&RI< R), T >
 Returns the matrix element at [CI, RI]. Column-major implementation.
 
template<int CI, int RI, typename T , int C, int R, bool V>
static constexpr auto eagine::math::get_cm (const matrix< T, C, R, true, V > &m) noexcept -> std::enable_if_t<(CI< C &&RI< R), T >
 Returns the matrix element at [CI, RI]. Row-major implementation.
 
template<typename T , int C, int R, bool V>
static constexpr auto eagine::math::get_cm (const matrix< T, C, R, false, V > &m, int ci, int ri) noexcept -> T
 Returns the matrix element at [ci, ri]. Column-major implementation.
 
template<typename T , int C, int R, bool V>
static constexpr auto eagine::math::get_cm (const matrix< T, C, R, true, V > &m, int ci, int ri) noexcept -> T
 Returns the matrix element at [ci, ri]. Row-major implementation.
 
template<int RI, int CI, typename T , int C, int R, bool V>
static constexpr auto eagine::math::get_rm (const matrix< T, C, R, false, V > &m) noexcept -> std::enable_if_t<(CI< C &&RI< R), T >
 Returns the matrix element at [RI, CI]. Column-major implementation.
 
template<int RI, int CI, typename T , int C, int R, bool V>
static constexpr auto eagine::math::get_rm (const matrix< T, C, R, true, V > &m) noexcept -> std::enable_if_t<(CI< C &&RI< R), T >
 Returns the matrix element at [RI, CI]. Row-major implementation.
 
template<typename T , int C, int R, bool V>
static constexpr auto eagine::math::get_rm (const matrix< T, C, R, false, V > &m, int ri, int ci) noexcept -> T
 Returns the matrix element at [ri, ci]. Column-major implementation.
 
template<typename T , int C, int R, bool V>
static constexpr auto eagine::math::get_rm (const matrix< T, C, R, true, V > &m, int ri, int ci) noexcept -> T
 Returns the matrix element at [ri, ci]. Row-major implementation.
 
template<int CI, int RI, typename T , int C, int R, bool V>
static auto eagine::math::set_cm (matrix< T, C, R, false, V > &m, T v) noexcept -> std::enable_if_t<(CI< C &&RI< R)>
 Sets the matrix element at [CI, RI]. Column-major implementation.
 
template<int CI, int RI, typename T , int C, int R, bool V>
static auto eagine::math::set_cm (matrix< T, C, R, true, V > &m, T v) noexcept -> std::enable_if_t<(CI< C &&RI< R)>
 Sets the matrix element at [CI, RI]. Row-major implementation.
 
template<typename T , int C, int R, bool V>
static void eagine::math::set_cm (matrix< T, C, R, false, V > &m, int ci, int ri, T v) noexcept
 Sets the matrix element at [ci, ri]. Column-major implementation.
 
template<typename T , int C, int R, bool V>
static void eagine::math::set_cm (matrix< T, C, R, true, V > &m, int ci, int ri, T v) noexcept
 Sets the matrix element at [ci, ri]. Row-major implementation.
 
template<int RI, int CI, typename T , int C, int R, bool V>
static auto eagine::math::set_rm (matrix< T, C, R, false, V > &m, T v) noexcept -> std::enable_if_t<(CI< C &&RI< R)>
 Sets the matrix element at [RI, CI]. Column-major implementation.
 
template<int RI, int CI, typename T , int C, int R, bool V>
static auto eagine::math::set_rm (matrix< T, C, R, true, V > &m, T v) noexcept -> std::enable_if_t<(CI< C &&RI< R)>
 Sets the matrix element at [RI, CI]. Row-major implementation.
 
template<typename T , int C, int R, bool V>
static void eagine::math::set_rm (matrix< T, C, R, false, V > &m, int ri, int ci, T v) noexcept
 Sets the matrix element at [ri, ci]. Column-major implementation.
 
template<typename T , int C, int R, bool V>
static void eagine::math::set_rm (matrix< T, C, R, true, V > &m, int ri, int ci, T v) noexcept
 Sets the matrix element at [ri, ci]. Row-major implementation.
 
template<typename T , int C, int R, bool RM, bool V>
static auto eagine::math::transpose (const matrix< T, C, R, RM, V > &m) noexcept -> matrix< T, R, C, RM, V >
 Transposes a matrix.
 
template<typename T , int C, int R, bool RM, bool V>
static auto eagine::math::reorder (const matrix< T, C, R, RM, V > &m) noexcept -> matrix< T, C, R, !RM, V >
 Returns a matrix reordered (switches row/column major).
 
template<typename T , int C, int R, bool V>
static constexpr auto eagine::math::make_row_major (matrix< T, C, R, true, V > m) noexcept -> matrix< T, C, R, true, V >
 Returns a matrix ordered as row-major.
 
template<typename T , int C, int R, bool V>
static auto eagine::math::make_row_major (const matrix< T, C, R, false, V > &m) noexcept -> matrix< T, C, R, true, V >
 Returns a matrix ordered as row-major.
 
template<typename T , int C, int R, bool V>
static constexpr auto eagine::math::make_column_major (matrix< T, C, R, false, V > m) noexcept -> matrix< T, C, R, false, V >
 Returns a matrix ordered as column-major.
 
template<typename T , int C, int R, bool V>
static auto eagine::math::make_column_major (const matrix< T, C, R, true, V > &m) noexcept -> matrix< T, C, R, false, V >
 Returns a matrix ordered as column-major.
 
template<int I, typename T , int C, int R, bool RM, bool V>
static constexpr auto eagine::math::major_vector (const matrix< T, C, R, RM, V > &m) noexcept -> std::enable_if_t<(I<(RM ? R :C)), vector< T,(RM ? C :R), V >>
 Returns the I-th major vector of a matrix.
 
template<int I, typename T , int C, int R, bool RM, bool V>
static auto eagine::math::minor_vector (const matrix< T, C, R, RM, V > &m) noexcept -> std::enable_if_t<(I<(RM ? C :R)), vector< T,(RM ? R :C), V >>
 Returns the I-th minor vector of a matrix.
 
template<int I, typename T , int C, int R, bool V>
static constexpr auto eagine::math::row (const matrix< T, C, R, true, V > &m) noexcept -> vector< T, C, V >
 Returns the I-th row vector of a matrix. Row-major implementation.
 
template<int I, typename T , int C, int R, bool V>
static auto eagine::math::row (const matrix< T, C, R, false, V > &m) noexcept -> vector< T, C, V >
 Returns the I-th row vector of a matrix. Column-major implementation.
 
template<typename T , int R, int C, bool RM, bool V>
static auto eagine::math::row (const matrix< T, C, R, RM, V > &m, int i) noexcept -> vector< T, C, V >
 Returns the i-th row vector of a matrix.
 
template<int I, typename T , int C, int R, bool V>
static constexpr auto eagine::math::column (const matrix< T, C, R, false, V > &m) noexcept -> vector< T, R, V >
 Returns the I-th column vector of a matrix. Column-major implementation.
 
template<int I, typename T , int C, int R, bool V>
static auto eagine::math::column (const matrix< T, C, R, true, V > &m) noexcept -> vector< T, R, V >
 Returns the I-th column vector of a matrix. Row-major implementation.
 
template<typename T , int R, int C, bool RM, bool V>
static auto eagine::math::column (const matrix< T, C, R, RM, V > &m, int i) noexcept -> vector< T, R, V >
 Returns the i-th column vector of a matrix.
 
template<typename T , int M, int N, int K, bool RM1, bool RM2, bool V>
static auto eagine::math::multiply (const matrix< T, K, M, RM1, V > &m1, const matrix< T, N, K, RM2, V > &m2) noexcept -> matrix< T, N, M, RM1, V >
 Matrix multiplication function.
 
template<typename T , int C, int R, bool RM, bool V>
static auto eagine::math::multiply (const matrix< T, C, R, RM, V > &m, const vector< T, C, V > &v) noexcept -> vector< T, R, V >
 Matrix-vector multiplication function.
 
template<typename MC1 , typename MC2 , typename = std::enable_if_t< is_matrix_constructor<MC1>::value && is_matrix_constructor<MC2>::value && are_multiplicable<constructed_matrix_t<MC1>, constructed_matrix_t<MC2>>::value>>
static auto eagine::math::operator* (const MC1 &mc1, const MC2 &mc2) noexcept
 Multiplication operator for matrix constructors. More...
 

Variables

template<typename X >
const auto eagine::math::is_row_major_v
 Trait indicating if a matrix type is row-major.
 
template<typename X >
constexpr auto eagine::math::is_matrix_constructor_v
 Trait indicating if a type X is a matrix constructor. More...
 

Detailed Description

Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt


Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).