FLAMES 0.1.0
Matrix-Empowered HLS Library
flames Namespace Reference

Namespace for the FLAMES library. More...

Classes

class  Mat
 Matrix. More...
 
class  MatRef
 
class  MatRefCol
 
class  MatRefRow
 
class  MatView
 Read only view version of a matrix. More...
 
class  MatViewCol
 Read only view version of a certain column as colunm vector. More...
 
class  MatViewCols
 Read only view version of successive columns. More...
 
class  MatViewDiagMat
 Read only view version of a diagonal matrix. More...
 
class  MatViewDiagRowVec
 Read only view version of a diagonal matrix as row vector. More...
 
class  MatViewDiagVec
 Read only view version of a diagonal matrix as vector. More...
 
class  MatViewOffDiag
 Read only view version of a off diagonal. More...
 
class  MatViewOpp
 Read only view version of the opposite of a matrix. More...
 
class  MatViewRow
 Read only view version of a certain row as row vector. More...
 
class  MatViewRows
 Read only view version of successive rows. More...
 
class  MatViewT
 Read only view version of a transposed matrix. More...
 
class  Tensor
 

Typedefs

using MATTYPE_NORMAL = std::integral_constant< int, MatType::NORMAL >
 Normal matrix as a class type. More...
 
using MATTYPE_DIAGONAL = std::integral_constant< int, MatType::DIAGONAL >
 Diagonal matrix as a class type. More...
 
using MATTYPE_SCALAR = std::integral_constant< int, MatType::SCALAR >
 Scalar matrix matrix as a class type. More...
 
using MATTYPE_UPPER = std::integral_constant< int, MatType::UPPER >
 Upper triangular matrix as a class type. More...
 
using MATTYPE_LOWER = std::integral_constant< int, MatType::LOWER >
 Lower triangular matrix as a class type. More...
 
using MATTYPE_SUPPER = std::integral_constant< int, MatType::SUPPER >
 Strict upper triangular matrix as a class type. More...
 
using MATTYPE_SLOWER = std::integral_constant< int, MatType::SLOWER >
 Strict lower triangular matrix as a class type. More...
 
using MATTYPE_SYM = std::integral_constant< int, MatType::SYM >
 Symmetrical matrix as a class type. More...
 
using MATTYPE_ASYM = std::integral_constant< int, MatType::ASYM >
 Antisymmetrical matrix as a class type. More...
 
template<int type>
using MType = std::integral_constant< int, type >
 Get the class form of MatType. More...
 
template<typename T , size_t N>
using Vec = Mat< T, N, 1 >
 Column vector. More...
 
template<typename T , size_t N>
using RowVec = Mat< T, 1, N >
 Row vector. More...
 
template<int I, int D>
using FxP_s = ap_fixed< I+D+1, I >
 
template<int I, int D>
using FxP = FxP_s< I, D >
 
template<int I, int D>
using FxP_u = ap_ufixed< I+D, I >
 

Enumerations

enum  MatType {
  NORMAL , DIAGONAL , SCALAR , UPPER ,
  LOWER , SUPPER , SLOWER , SYM ,
  ASYM
}
 Matrix type for storage. More...
 
enum class  InitAfterwards { NONE , OPP , TR }
 Afterwards action with initialization. More...
 
enum class  Init { NONE , ZEROS , ONES }
 

Functions

template<typename T >
constexpr MatType matType ()
 Get the MatType value from the class form. More...
 
constexpr MatType sumType (MatType type1, MatType type2) noexcept
 Summation type of two matrices. More...
 
constexpr MatType mulType (MatType type1, MatType type2, size_t n_rows, size_t comm, size_t n_cols) noexcept
 Multiplication type of two matrices. More...
 
constexpr MatType tType (MatType type) noexcept
 Transpose type of a matrix. More...
 
constexpr size_t upperRow (size_t index, size_t N)
 Calculate the row index of a upper triangular matrix. More...
 
constexpr size_t lowerRow (size_t index, size_t N)
 Calculate the row index of a lower triangular matrix. More...
 
constexpr size_t supperRow (size_t index, size_t N)
 Calculate the row index of a strict upper triangular matrix. More...
 
constexpr size_t slowerRow (size_t index, size_t N)
 Calculate the row index of a strict lower triangular matrix. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2>
static Mat< T1, n_rows, n_cols, sumType(type1, type2)> operator+ (const M1< T1, n_rows, n_cols, type1, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type2, _unused2... > &mat_R)
 Add two matrices and make a copy. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2>
static Mat< T1, n_rows, n_cols, type1 > & operator+= (Mat< T1, n_rows, n_cols, type1 > &mat_L, const M< T2, n_rows, n_cols, type2, _unused... > &mat_R)
 Matrix self plus a matrix. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2>
static Mat< T1, n_rows, n_cols, sumType(type1, type2)> operator- (const M1< T1, n_rows, n_cols, type1, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type2, _unused2... > &mat_R)
 Minus two matrices and make a copy. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2>
static M1< T1, n_rows, n_cols, type1 > & operator-= (M1< T1, n_rows, n_cols, type1, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type2, _unused2... > &mat_R)
 Matrix self minus a matrix. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2, std::enable_if_t<(std::is_same< T1, bool >::value), bool > = true>
static Mat< T1, n_rows, n_cols, mulType(type1, type2, n_rows, n_cols, n_cols)> operator*= (Mat< T1, n_rows, n_cols, type1 > &mat, const M< T2, n_cols, n_cols, type2, _unused... > &mat_R)
 Matrix self times a matrix. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , typename ScalarT , size_t n_rows, size_t n_cols, MatType type, std::enable_if_t< std::is_arithmetic< std::remove_reference_t< ScalarT > >::value, bool > = true>
static Mat< T, n_rows, n_cols, type > & operator*= (const M< T, n_rows, n_cols, type, _unused... > &mat, ScalarT s)
 Matrix self times a scalar. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , typename ScalarT , size_t n_rows, size_t n_cols, MatType type, std::enable_if_t< std::is_arithmetic< std::remove_reference_t< ScalarT > >::value, bool > = true>
static Mat< T, n_rows, n_cols, type > operator* (const M< T, n_rows, n_cols, type, _unused... > &mat_L, ScalarT s)
 Matrix times a scalar. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , size_t n_rows, size_t n_cols, MatType type, int AP_W, int AP_I, ap_q_mode AP_Q, ap_o_mode AP_O, int AP_N>
static Mat< T, n_rows, n_cols, type > operator* (const M< T, n_rows, n_cols, type, _unused... > &mat_L, ap_fixed< AP_W, AP_I, AP_Q, AP_O, AP_N > s)
 Matrix times an ap_fixed scalar. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , typename ScalarT , size_t n_rows, size_t n_cols, MatType type, std::enable_if_t< std::is_arithmetic< std::remove_reference_t< ScalarT > >::value, bool > = true>
static Mat< T, n_rows, n_cols, type > operator* (ScalarT s, const M< T, n_rows, n_cols, type, _unused... > &mat_R)
 Matrix times a scalar. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , size_t n_rows, size_t n_cols, MatType type, int AP_W, int AP_I, ap_q_mode AP_Q, ap_o_mode AP_O, int AP_N>
static Mat< T, n_rows, n_cols, type > operator* (ap_fixed< AP_W, AP_I, AP_Q, AP_O, AP_N > s, const M< T, n_rows, n_cols, type, _unused... > &mat_R)
 Matrix times an ap_fixed scalar. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t comm, size_t n_cols, MatType type1, MatType type2, std::enable_if_t<(std::is_same< T1, bool >::value), bool > = true>
static Mat< T2, n_rows, n_cols, mulType(type1, type2, n_rows, comm, n_cols)> operator* (const M1< T1, n_rows, comm, type1, _unused1... > &mat_L, const M2< T2, comm, n_cols, type2, _unused2... > &mat_R)
 Matrix multiplication. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t comm, size_t n_cols, MatType type1, MatType type2, std::enable_if_t<!(std::is_same< T1, bool >::value), bool > = true>
static Mat< T1, n_rows, n_cols, mulType(type1, type2, n_rows, comm, n_cols)> operator* (const M1< T1, n_rows, comm, type1, _unused1... > &mat_L, const M2< T2, comm, n_cols, type2, _unused2... > &mat_R)
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< T1, n_rows, n_cols, type > operator% (const M1< T1, n_rows, n_cols, type, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type, _unused2... > &mat_R)
 Element-wise product of two matrices. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > operator== (const M1< T1, n_rows, n_cols, type, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type, _unused2... > &mat_R)
 Element-wise equal comparison. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > operator!= (const M1< T1, n_rows, n_cols, type, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type, _unused2... > &mat_R)
 Element-wise unequal comparison. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > operator> (const M1< T1, n_rows, n_cols, type, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type, _unused2... > &mat_R)
 Element-wise greater comparison. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > operator< (const M1< T1, n_rows, n_cols, type, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type, _unused2... > &mat_R)
 Element-wise less comparison. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > operator>= (const M1< T1, n_rows, n_cols, type, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type, _unused2... > &mat_R)
 Element-wise greater or equal comparison. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > operator<= (const M1< T1, n_rows, n_cols, type, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type, _unused2... > &mat_R)
 Element-wise less or equal comparison. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< T1, n_rows, n_cols, type > mod (const M1< T1, n_rows, n_cols, type, _unused1... > &mat_L, const M2< T2, n_rows, n_cols, type, _unused2... > &mat_R)
 Element-wise modulus. More...
 
template<typename Tp = double, template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t L_rows, size_t L_cols, size_t R_rows, size_t R_cols, MatType type, std::enable_if_t< L_rows *L_cols==R_rows *R_cols, bool > = true>
Tp innerProd (const M1< T1, L_rows, L_cols, type, _unused1... > &mat_L, const M2< T2, R_rows, R_cols, type, _unused2... > &mat_R)
 
template<typename T , size_t n_rows, size_t n_cols, MatType type>
static std::ostream & operator<< (std::ostream &os, const Mat< T, n_rows, n_cols, type > &mat)
 Print matrix in a out stream. More...
 
template<typename V >
static void mergeSort (V &vec)
 
template<typename V1 , typename V2 >
static void mergeSort (const V1 &in, V2 &out)
 
template<typename V >
static void sort (V &vec)
 
template<typename V1 , typename V2 >
static void sort (const V1 &in, V2 &out)
 
template<typename T , typename I >
static void argmax_4_2 (T in1, T in2, T in3, T in4, I i_in1, I i_in2, I i_in3, I i_in4, T &out1, T &out2, I &i_out1, I &i_out2, bool sorted=false)
 

Detailed Description

Namespace for the FLAMES library.

When you include 'flames.hpp', this namespace is automatically used.

Typedef Documentation

◆ FxP

template<int I, int D>
using flames::FxP = typedef FxP_s<I, D>

◆ FxP_s

template<int I, int D>
using flames::FxP_s = typedef ap_fixed<I + D + 1, I>

◆ FxP_u

template<int I, int D>
using flames::FxP_u = typedef ap_ufixed<I + D, I>

◆ MATTYPE_ASYM

using flames::MATTYPE_ASYM = typedef std::integral_constant<int, MatType::ASYM>

Antisymmetrical matrix as a class type.

◆ MATTYPE_DIAGONAL

using flames::MATTYPE_DIAGONAL = typedef std::integral_constant<int, MatType::DIAGONAL>

Diagonal matrix as a class type.

◆ MATTYPE_LOWER

using flames::MATTYPE_LOWER = typedef std::integral_constant<int, MatType::LOWER>

Lower triangular matrix as a class type.

◆ MATTYPE_NORMAL

using flames::MATTYPE_NORMAL = typedef std::integral_constant<int, MatType::NORMAL>

Normal matrix as a class type.

◆ MATTYPE_SCALAR

using flames::MATTYPE_SCALAR = typedef std::integral_constant<int, MatType::SCALAR>

Scalar matrix matrix as a class type.

◆ MATTYPE_SLOWER

using flames::MATTYPE_SLOWER = typedef std::integral_constant<int, MatType::SLOWER>

Strict lower triangular matrix as a class type.

◆ MATTYPE_SUPPER

using flames::MATTYPE_SUPPER = typedef std::integral_constant<int, MatType::SUPPER>

Strict upper triangular matrix as a class type.

◆ MATTYPE_SYM

using flames::MATTYPE_SYM = typedef std::integral_constant<int, MatType::SYM>

Symmetrical matrix as a class type.

◆ MATTYPE_UPPER

using flames::MATTYPE_UPPER = typedef std::integral_constant<int, MatType::UPPER>

Upper triangular matrix as a class type.

◆ MType

template<int type>
using flames::MType = typedef std::integral_constant<int, type>

Get the class form of MatType.

Template Parameters
typeThe MatType enum item value.

◆ RowVec

template<typename T , size_t N>
using flames::RowVec = typedef Mat<T, 1, N>

Row vector.

This is the type alias of Mat and the number of row is set to 1.

Template Parameters
TElement type.
NThe vector dimension.

◆ Vec

template<typename T , size_t N>
using flames::Vec = typedef Mat<T, N, 1>

Column vector.

This is the type alias of Mat and the number of columns is set to 1.

Template Parameters
TElement type.
NThe vector dimension.

Enumeration Type Documentation

◆ Init

enum class flames::Init
strong
Enumerator
NONE 
ZEROS 
ONES 

◆ InitAfterwards

enum class flames::InitAfterwards
strong

Afterwards action with initialization.

Note
This should only be used for view classes.
Enumerator
NONE 

none

OPP 

opposite

TR 

transpose

◆ MatType

Matrix type for storage.

Enumerator
NORMAL 

Normal matrix

DIAGONAL 

Diagonal matrix

SCALAR 

Scalar matrix

UPPER 

Upper triangular matrix

LOWER 

Lower triangular matrix

SUPPER 

Strict Upper triangular matrix

SLOWER 

Strict Lower triangular matrix

SYM 

Symmetrical matrix

ASYM 

Antisymmetrical matrix

Function Documentation

◆ argmax_4_2()

template<typename T , typename I >
static void flames::argmax_4_2 ( in1,
in2,
in3,
in4,
i_in1,
i_in2,
i_in3,
i_in4,
T &  out1,
T &  out2,
I &  i_out1,
I &  i_out2,
bool  sorted = false 
)
inlinestatic

◆ innerProd()

template<typename Tp = double, template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t L_rows, size_t L_cols, size_t R_rows, size_t R_cols, MatType type, std::enable_if_t< L_rows *L_cols==R_rows *R_cols, bool > = true>
Tp flames::innerProd ( const M1< T1, L_rows, L_cols, type, _unused1... > &  mat_L,
const M2< T2, R_rows, R_cols, type, _unused2... > &  mat_R 
)

◆ lowerRow()

constexpr size_t flames::lowerRow ( size_t  index,
size_t  N 
)
inlineconstexpr

Calculate the row index of a lower triangular matrix.

Parameters
indexThe data index.
NThe matrix dimension.
Returns
(constexpr size_t) The row index.
Here is the caller graph for this function:

◆ matType()

template<typename T >
constexpr MatType flames::matType ( )
inlineconstexpr

Get the MatType value from the class form.

Template Parameters
TThe MatType class form.
Returns
(constexpr MatType) The MatType value (as an enum item).

◆ mergeSort() [1/2]

template<typename V1 , typename V2 >
static void flames::mergeSort ( const V1 &  in,
V2 &  out 
)
static

◆ mergeSort() [2/2]

template<typename V >
static void flames::mergeSort ( V vec)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mod()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< T1, n_rows, n_cols, type > flames::mod ( const M1< T1, n_rows, n_cols, type, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type, _unused2... > &  mat_R 
)

Element-wise modulus.

This requires the operator % is defined between both matrix elements.

Note
This should not be misued with operator%, which is the element-wise multiplication.
Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<T1, n_rows, n_cols, type>) The modulus result matrix.

◆ mulType()

constexpr MatType flames::mulType ( MatType  type1,
MatType  type2,
size_t  n_rows,
size_t  comm,
size_t  n_cols 
)
inlineconstexprnoexcept

Multiplication type of two matrices.

Parameters
type1The MatType of the left matrix.
type2The MatType of the right matrix.
n_rowsThe number of rows of the left matrix.
commThe number of columns of the left matrix and the number of rows of the right matrix.
n_colsThe number of columns of the right matrix.
Returns
(constexpr MatType) The multiplication matrix type.
Here is the caller graph for this function:

◆ operator!=()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > flames::operator!= ( const M1< T1, n_rows, n_cols, type, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type, _unused2... > &  mat_R 
)

Element-wise unequal comparison.

This function returns a bool matrix.
You can configure the macro FLAMES_MAT_BOOL_OPER_UNROLL_FACTOR to determine the parallelism.

Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<bool, n_rows, n_cols, type>) The comparison result.

◆ operator%()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< T1, n_rows, n_cols, type > flames::operator% ( const M1< T1, n_rows, n_cols, type, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type, _unused2... > &  mat_R 
)

Element-wise product of two matrices.

You can configure the macro FLAMES_MAT_EMUL_UNROLL_FACTOR to determine the parallelism.
This internally calls Mat::emul(mat, mat).
The return element type is that of the left matrix.

Note
It now only supports element-wise product of two matrices of the same dimension and MatType.
This is not the modulus operator.Ise .mod() for the element-wise modulus operation.
Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<T1, n_rows, n_cols, type>) The element-wise product result.
Here is the call graph for this function:

◆ operator*() [1/6]

template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , size_t n_rows, size_t n_cols, MatType type, int AP_W, int AP_I, ap_q_mode AP_Q, ap_o_mode AP_O, int AP_N>
static Mat< T, n_rows, n_cols, type > flames::operator* ( ap_fixed< AP_W, AP_I, AP_Q, AP_O, AP_N >  s,
const M< T, n_rows, n_cols, type, _unused... > &  mat_R 
)
inlinestatic

Matrix times an ap_fixed scalar.

Template Parameters
MThe matrix type.
_unused(unused)
TThe matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
AP_Wap_int W param.
AP_Iap_int I param.
AP_Qap_int Q param.
AP_Oap_int O param.
AP_Nap_int N param.
Parameters
mat_RThe right matrix.
sThe float.
Returns
(Mat&) The multiplication result (a reference to 'this').
Here is the call graph for this function:

◆ operator*() [2/6]

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t comm, size_t n_cols, MatType type1, MatType type2, std::enable_if_t<(std::is_same< T1, bool >::value), bool > = true>
static Mat< T2, n_rows, n_cols, mulType(type1, type2, n_rows, comm, n_cols)> flames::operator* ( const M1< T1, n_rows, comm, type1, _unused1... > &  mat_L,
const M2< T2, comm, n_cols, type2, _unused2... > &  mat_R 
)
inlinestatic

Matrix multiplication.

This operator calls .mul() function. You may configure FLAMES_MAT_SCALAR_TIMES_UNROLL_FACTOR or FLAMES_UNROLL_FACTOR to doing multiplication in parallel.

Note
This function makes a copy so it should only by used for initialization. Otherwise use .mul(Mat_L, mat_R) to avoid the copy operation.
Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe row number of the left matrix.
commThe common number (the column number of the left matrix and the row number of the right matrix).
n_colsThe column number of the right matrix.
type1The left matrix MatType.
type2The right matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<T, n_rows, n_cols, mulType(type1, type2, n_rows, comm, n_cols)>) The multiplication result.
Here is the call graph for this function:

◆ operator*() [3/6]

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t comm, size_t n_cols, MatType type1, MatType type2, std::enable_if_t<!(std::is_same< T1, bool >::value), bool > = true>
static Mat< T1, n_rows, n_cols, mulType(type1, type2, n_rows, comm, n_cols)> flames::operator* ( const M1< T1, n_rows, comm, type1, _unused1... > &  mat_L,
const M2< T2, comm, n_cols, type2, _unused2... > &  mat_R 
)
inlinestatic
Here is the call graph for this function:

◆ operator*() [4/6]

template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , size_t n_rows, size_t n_cols, MatType type, int AP_W, int AP_I, ap_q_mode AP_Q, ap_o_mode AP_O, int AP_N>
static Mat< T, n_rows, n_cols, type > flames::operator* ( const M< T, n_rows, n_cols, type, _unused... > &  mat_L,
ap_fixed< AP_W, AP_I, AP_Q, AP_O, AP_N >  s 
)
inlinestatic

Matrix times an ap_fixed scalar.

Template Parameters
MThe matrix type.
_unused(unused)
TThe matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
AP_Wap_int W param.
AP_Iap_int I param.
AP_Qap_int Q param.
AP_Oap_int O param.
AP_Nap_int N param.
Parameters
mat_LThe left matrix.
sThe float.
Returns
(Mat&) The multiplication result (a reference to 'this').
Here is the call graph for this function:

◆ operator*() [5/6]

template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , typename ScalarT , size_t n_rows, size_t n_cols, MatType type, std::enable_if_t< std::is_arithmetic< std::remove_reference_t< ScalarT > >::value, bool > = true>
static Mat< T, n_rows, n_cols, type > flames::operator* ( const M< T, n_rows, n_cols, type, _unused... > &  mat_L,
ScalarT  s 
)
inlinestatic

Matrix times a scalar.

This operator calls .mul() function. This scalar is C++ arithmetic types, like double and int. You may configure FLAMES_MAT_SCALAR_TIMES_UNROLL_FACTOR or FLAMES_UNROLL_FACTOR to doing multiplication in parallel.

Note
This function makes a copy so it should only by used for initialization. Otherwise use .mul(Mat_L, s) to avoid the copy operation.
Template Parameters
MThe matrix type.
_unused(unused)
ScalarTThe scalar type.
TThe matrix element type.
Parameters
mat_LThe matrix.
sThe scalar.
Returns
(Mat&) The multiplication result (a reference to 'this').
Here is the call graph for this function:

◆ operator*() [6/6]

template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , typename ScalarT , size_t n_rows, size_t n_cols, MatType type, std::enable_if_t< std::is_arithmetic< std::remove_reference_t< ScalarT > >::value, bool > = true>
static Mat< T, n_rows, n_cols, type > flames::operator* ( ScalarT  s,
const M< T, n_rows, n_cols, type, _unused... > &  mat_R 
)
inlinestatic

Matrix times a scalar.

This operator calls .mul() function. This scalar is C++ arithmetic types, like double and int. You may configure FLAMES_MAT_SCALAR_TIMES_UNROLL_FACTOR or FLAMES_UNROLL_FACTOR to doing multiplication in parallel.

Note
This function makes a copy so it should only by used for initialization. Otherwise use .mul(Mat_R, mat_s) to avoid the copy operation.
Template Parameters
MThe matrix type.
_unused(unused)
ScalarTThe scalar type.
T2The matrix element type.
Parameters
mat_RThe matrix.
sThe scalar.
Returns
(Mat&) The multiplication result (a reference to 'this').
Here is the call graph for this function:

◆ operator*=() [1/2]

template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T , typename ScalarT , size_t n_rows, size_t n_cols, MatType type, std::enable_if_t< std::is_arithmetic< std::remove_reference_t< ScalarT > >::value, bool > = true>
static Mat< T, n_rows, n_cols, type > & flames::operator*= ( const M< T, n_rows, n_cols, type, _unused... > &  mat,
ScalarT  s 
)
inlinestatic

Matrix self times a scalar.

This operator calls .mul() function. This scalar is C++ arithmetic types, like double and int. You may configure FLAMES_MAT_SCALAR_TIMES_UNROLL_FACTOR or FLAMES_UNROLL_FACTOR to doing multiplication in parallel.

Template Parameters
MThe matrix type.
_unused(unused)
ScalarTThe scalar type.
TThe matrix element type.
Parameters
matThe matrix.
sThe scalar.
Returns
(Mat&) The multiplication result (a reference to 'this').

◆ operator*=() [2/2]

template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2, std::enable_if_t<(std::is_same< T1, bool >::value), bool > = true>
static Mat< T1, n_rows, n_cols, mulType(type1, type2, n_rows, n_cols, n_cols)> flames::operator*= ( Mat< T1, n_rows, n_cols, type1 > &  mat,
const M< T2, n_cols, n_cols, type2, _unused... > &  mat_R 
)
inlinestatic

Matrix self times a matrix.

Matrix self times a matrix of a different type.

This operator calls .mul() function. You may configure FLAMES_MAT_SCALAR_TIMES_UNROLL_FACTOR or FLAMES_UNROLL_FACTOR to doing multiplication in parallel.

Note
This is the correct way to do self multiplication.
The wrong way:
a.mul(a, b);
because this will lead to writing into the read only matrix, leading to a access violation and wrong results.
Template Parameters
MThe matrix type.
_unused(unused)
ScalarTThe scalar type.
T2The matrix element type.
Parameters
matThe matrix.
sThe scalar.
Returns
(Mat&) The multiplication result (a reference to 'this').
Template Parameters
MThe matrix type.
_unused(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
type1The left side matrix MatType.
type2The right side matrix MatType.
Parameters
matThe matrix.
mat_RThe right matrix.
Returns
Mat<T1, n_rows, n_cols, mulType(type1, type2, n_rows, n_cols, n_cols)>
Here is the call graph for this function:

◆ operator+()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2>
static Mat< T1, n_rows, n_cols, sumType(type1, type2)> flames::operator+ ( const M1< T1, n_rows, n_cols, type1, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type2, _unused2... > &  mat_R 
)
inlinestatic

Add two matrices and make a copy.

This will call .add() function.

Note
This function makes a copy so it should only by used for initialization. Otherwise use .add(Mat_L, mat_R) to avoid the copy operation.
Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
type1The left matrix MatType.
type2The right matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<T1, n_rows, n_cols, sumType(type1, type2)>) The addition result as a copy.
Here is the call graph for this function:

◆ operator+=()

template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2>
static Mat< T1, n_rows, n_cols, type1 > & flames::operator+= ( Mat< T1, n_rows, n_cols, type1 > &  mat_L,
const M< T2, n_rows, n_cols, type2, _unused... > &  mat_R 
)
inlinestatic

Matrix self plus a matrix.

Template Parameters
MThe right side matrix type.
_unused(unused)
T1The left side matrix element type.
T2The right side matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
type1The left side matrix MatType.
type2The right side matrix MatType.
Parameters
mat_LThe left side matrix.
mat_RThe right side matrix.
Returns
(Mat<T1, n_rows, n_cols, type1>&) The addition result (a reference to 'this').
Here is the call graph for this function:

◆ operator-()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2>
static Mat< T1, n_rows, n_cols, sumType(type1, type2)> flames::operator- ( const M1< T1, n_rows, n_cols, type1, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type2, _unused2... > &  mat_R 
)
inlinestatic

Minus two matrices and make a copy.

This will call .sub() function.

Note
This function makes a copy so it should only by used for initialization. Otherwise use .sub(Mat_L, mat_R) to avoid the copy operation.
Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
type1The left matrix MatType.
type2The right matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<T1, n_rows, n_cols, sumType(type1, type2)>) The subtract result as a copy.
Here is the call graph for this function:

◆ operator-=()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type1, MatType type2>
static M1< T1, n_rows, n_cols, type1 > & flames::operator-= ( M1< T1, n_rows, n_cols, type1, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type2, _unused2... > &  mat_R 
)
inlinestatic

Matrix self minus a matrix.

Template Parameters
MThe right side matrix type.
_unused(unused)
T1The left side matrix element type.
T2The right side matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
type1The left side matrix MatType.
type2The right side matrix MatType.
Parameters
mat_LThe left side matrix.
mat_RThe right side matrix.
Returns
(Mat<T1, n_rows, n_cols, type1>&) The subtract result (a reference to 'this').

◆ operator<()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > flames::operator< ( const M1< T1, n_rows, n_cols, type, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type, _unused2... > &  mat_R 
)

Element-wise less comparison.

This function returns a bool matrix.
You can configure the macro FLAMES_MAT_BOOL_OPER_UNROLL_FACTOR to determine the parallelism.

Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<bool, n_rows, n_cols, type>) The comparison result.

◆ operator<<()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
static std::ostream & flames::operator<< ( std::ostream &  os,
const Mat< T, n_rows, n_cols, type > &  mat 
)
inlinestatic

Print matrix in a out stream.

This function calls .print() function.

Template Parameters
TThe matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
osThe out stream.
matThe matrix.
Returns
(std::ostream&) The out stream.

◆ operator<=()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > flames::operator<= ( const M1< T1, n_rows, n_cols, type, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type, _unused2... > &  mat_R 
)

Element-wise less or equal comparison.

This function returns a bool matrix.
You can configure the macro FLAMES_MAT_BOOL_OPER_UNROLL_FACTOR to determine the parallelism.

Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<bool, n_rows, n_cols, type>) The comparison result.

◆ operator==()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > flames::operator== ( const M1< T1, n_rows, n_cols, type, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type, _unused2... > &  mat_R 
)

Element-wise equal comparison.

This function returns a bool matrix.
You can configure the macro FLAMES_MAT_BOOL_OPER_UNROLL_FACTOR to determine the parallelism.

Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<bool, n_rows, n_cols, type>) The comparison result.

◆ operator>()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > flames::operator> ( const M1< T1, n_rows, n_cols, type, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type, _unused2... > &  mat_R 
)

Element-wise greater comparison.

This function returns a bool matrix.
You can configure the macro FLAMES_MAT_BOOL_OPER_UNROLL_FACTOR to determine the parallelism.

Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<bool, n_rows, n_cols, type>) The comparison result.

◆ operator>=()

template<template< class, size_t, size_t, MatType, class... > typename M1, typename... _unused1, template< class, size_t, size_t, MatType, class... > typename M2, typename... _unused2, typename T1 , typename T2 , size_t n_rows, size_t n_cols, MatType type>
Mat< bool, n_rows, n_cols, type > flames::operator>= ( const M1< T1, n_rows, n_cols, type, _unused1... > &  mat_L,
const M2< T2, n_rows, n_cols, type, _unused2... > &  mat_R 
)

Element-wise greater or equal comparison.

This function returns a bool matrix.
You can configure the macro FLAMES_MAT_BOOL_OPER_UNROLL_FACTOR to determine the parallelism.

Template Parameters
M1The left matrix type.
_unused1(unused)
M2The right matrix type.
_unused2(unused)
T1The left matrix element type.
T2The right matrix element type.
n_rowsThe number of rows.
n_colsThe number of columns.
typeThe matrix MatType.
Parameters
mat_LThe left matrix.
mat_RThe right matrix.
Returns
(Mat<bool, n_rows, n_cols, type>) The comparison result.

◆ slowerRow()

constexpr size_t flames::slowerRow ( size_t  index,
size_t  N 
)
inlineconstexpr

Calculate the row index of a strict lower triangular matrix.

Parameters
indexThe data index.
NThe matrix dimension.
Returns
(constexpr size_t) The row index.
Here is the caller graph for this function:

◆ sort() [1/2]

template<typename V1 , typename V2 >
static void flames::sort ( const V1 &  in,
V2 &  out 
)
inlinestatic
Here is the call graph for this function:

◆ sort() [2/2]

template<typename V >
static void flames::sort ( V vec)
inlinestatic
Here is the call graph for this function:

◆ sumType()

constexpr MatType flames::sumType ( MatType  type1,
MatType  type2 
)
inlineconstexprnoexcept

Summation type of two matrices.

Parameters
type1The MatType of the left matrix.
type2The MatType of the right matrix.
Returns
(constexpr MatType) The summation matrix type.

◆ supperRow()

constexpr size_t flames::supperRow ( size_t  index,
size_t  N 
)
inlineconstexpr

Calculate the row index of a strict upper triangular matrix.

Parameters
indexThe data index.
NThe matrix dimension.
Returns
(constexpr size_t) The row index.
Here is the caller graph for this function:

◆ tType()

constexpr MatType flames::tType ( MatType  type)
inlineconstexprnoexcept

Transpose type of a matrix.

Parameters
typeThe MatType of the matrix.
Returns
(constexpr MatType) The transpose matrix type.

◆ upperRow()

constexpr size_t flames::upperRow ( size_t  index,
size_t  N 
)
inlineconstexpr

Calculate the row index of a upper triangular matrix.

Parameters
indexThe data index.
NThe matrix dimension.
Returns
(constexpr size_t) The row index.
Here is the caller graph for this function: