nil::crypto3::algebra::matrix< T, N, M > Struct Template Reference

A container representing a matrix. More...

#include <matrix.hpp>

+ Collaboration diagram for nil::crypto3::algebra::matrix< T, N, M >:

Public Types

using size_type = std::size_t
 
using value_type = T
 

Public Member Functions

Element access
constexpr vector< T, M > row (std::size_t i) const
 access specified row More...
 
constexpr vector< T, N > column (std::size_t i) const
 access specified column More...
 
constexpr T * operator[] (std::size_t i)
 access specified element More...
 
constexpr T const * operator[] (std::size_t i) const
 access specified element More...
 

Static Public Attributes

static constexpr size_type column_size = N
 Number of rows. More...
 
static constexpr size_type row_size = M
 Number of columns. More...
 

Related Functions

(Note that these are not member functions.)

matrix deduction guides
template<typename T , std::size_t M, std::size_t N>
 matrix (const T(&)[M][N]) -> matrix< T, M, N >
 deduction guide for aggregate initialization More...
 

Detailed Description

template<typename T, std::size_t N, std::size_t M>
struct nil::crypto3::algebra::matrix< T, N, M >

A container representing a matrix.

Template Parameters
Tscalar type to contain
Nnumber of rows
Mnumber of columns

matrix is a container representing a matrix. It is an aggregate type containing a single member array of type T[N][M] which can be initialized with aggregate initialization.

Member Typedef Documentation

◆ size_type

template<typename T , std::size_t N, std::size_t M>
using nil::crypto3::algebra::matrix< T, N, M >::size_type = std::size_t

◆ value_type

template<typename T , std::size_t N, std::size_t M>
using nil::crypto3::algebra::matrix< T, N, M >::value_type = T

Member Function Documentation

◆ column()

template<typename T , std::size_t N, std::size_t M>
constexpr vector<T, N> nil::crypto3::algebra::matrix< T, N, M >::column ( std::size_t  i) const
inlineconstexpr

access specified column

Parameters
iindex of the column to extract
Returns
the selected row

Extracts a column from the matrix

◆ operator[]() [1/2]

template<typename T , std::size_t N, std::size_t M>
constexpr T* nil::crypto3::algebra::matrix< T, N, M >::operator[] ( std::size_t  i)
inlineconstexpr

access specified element

Parameters
iindex of the row
Returns
pointer to the specified row

This function returns a pointer to the specified row. The intention of this function is to then access the specified element from the row pointer. For a matrix m, accessing the element in the 5th row and 3rd column can be done with m[5][3].

◆ operator[]() [2/2]

template<typename T , std::size_t N, std::size_t M>
constexpr T const* nil::crypto3::algebra::matrix< T, N, M >::operator[] ( std::size_t  i) const
inlineconstexpr

access specified element

Parameters
iindex of the row
Returns
pointer to the specified row

This function returns a pointer to the specified row. The intention of this function is to then access the specified element from the row pointer. For a matrix m, accessing the element in the 5th row and 3rd column can be done with m[5][3].

◆ row()

template<typename T , std::size_t N, std::size_t M>
constexpr vector<T, M> nil::crypto3::algebra::matrix< T, N, M >::row ( std::size_t  i) const
inlineconstexpr

access specified row

Parameters
iindex of the row to extract
Returns
the selected row

Extracts a row from the matrix.

Member Data Documentation

◆ column_size

template<typename T , std::size_t N, std::size_t M>
constexpr size_type nil::crypto3::algebra::matrix< T, N, M >::column_size = N
staticconstexpr

Number of rows.

◆ row_size

template<typename T , std::size_t N, std::size_t M>
constexpr size_type nil::crypto3::algebra::matrix< T, N, M >::row_size = M
staticconstexpr

Number of columns.


The documentation for this struct was generated from the following file: