FLAMES 0.1.0
Matrix-Empowered HLS Library
Loading...
Searching...
No Matches
flames::MatRef< T, n_rows, n_cols, type > Class Template Reference

#include <core.hpp>

Public Member Functions

 MatRef (Mat< T, n_rows, n_cols, type > &m)
 Construct a new MatView object from raw data pointer.
 
 MatRef (const T *const ptr)
 
 MatRef (const MatRef &m)
 Copy constructor.
 
MatRefoperator= (const Mat< T, n_rows, n_cols, type > &m)
 
template<typename M >
void assign (M m)
 
operator() (size_t r, size_t c) const
 Get the read only data element from row and column index.
 
T & operator() (size_t r, size_t c)
 Get writeable data element by row index and column index.
 
operator[] (size_t index) const
 Get the read only element by array row major index.
 
T & operator[] (size_t index)
 Get the writeable element by array row major index.
 
void setValue (T val)
 Set all elements of the matrix to a value.
 
void setZero ()
 Set all elements of the matrix to zero.
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2, size_t rows_, size_t cols_>
MatRefcol (const M< T2, rows_, cols_, type2, _unused... > &mat, size_t c)
 Take a column of a matrix by index.
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2, size_t rows_, size_t cols_>
void col (size_t c, const M< T2, rows_, cols_, type2, _unused... > &mat)
 
Mat< T, n_rows, 1, MatType::NORMALcol (size_t c) const
 Take a column of a matrix by index and make a copy.
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2>
MatRefadd (const M< T2, n_rows, n_cols, type2, _unused... > &mat_R)
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2>
MatRefsub (const M< T2, n_rows, n_cols, type2, _unused... > &mat_R)
 
MatViewT< T, n_cols, n_rows, type > t_ () const
 
template<typename Tp = T>
Tp power () const
 
template<typename Tp = T>
Tp abssum () const
 
 operator Mat< T, n_rows, n_cols, type > () const
 Conversion from view to a real Mat.
 
Mat< T, n_rows, n_cols, type > asMat () const
 Explicitly make a Mat copy.
 
void print (const std::string &str="", std::ostream &os=std::cout) const
 

Static Public Member Functions

static constexpr size_t size () noexcept
 The data element number.
 

Public Attributes

T *const _data
 

Constructor & Destructor Documentation

◆ MatRef() [1/3]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
flames::MatRef< T, n_rows, n_cols, type >::MatRef ( Mat< T, n_rows, n_cols, type > & m)
inline

Construct a new MatView object from raw data pointer.

Parameters
mThe original matrix.

◆ MatRef() [2/3]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
flames::MatRef< T, n_rows, n_cols, type >::MatRef ( const T *const ptr)
inline

◆ MatRef() [3/3]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
flames::MatRef< T, n_rows, n_cols, type >::MatRef ( const MatRef< T, n_rows, n_cols, type > & m)
inline

Copy constructor.

Parameters
mAnother MatView object.

Member Function Documentation

◆ abssum()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
template<typename Tp = T>
Tp flames::MatRef< T, n_rows, n_cols, type >::abssum ( ) const
inline
Here is the call graph for this function:

◆ add()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2>
MatRef & flames::MatRef< T, n_rows, n_cols, type >::add ( const M< T2, n_rows, n_cols, type2, _unused... > & mat_R)
inline
Here is the call graph for this function:

◆ asMat()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
Mat< T, n_rows, n_cols, type > flames::MatRef< T, n_rows, n_cols, type >::asMat ( ) const
inline

Explicitly make a Mat copy.

Returns
(Mat<T, n_rows, n_cols, type>) The real Mat.
Here is the caller graph for this function:

◆ assign()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
template<typename M >
void flames::MatRef< T, n_rows, n_cols, type >::assign ( M m)
inline
Here is the call graph for this function:

◆ col() [1/3]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2, size_t rows_, size_t cols_>
MatRef & flames::MatRef< T, n_rows, n_cols, type >::col ( const M< T2, rows_, cols_, type2, _unused... > & mat,
size_t c )
inline

Take a column of a matrix by index.

The result is stored to 'this'. You may configure macro FLAMES_MAT_COPY_UNROLL_FACTOR or FLAMES_UNROLL_FACTOR to do the operation in parallel.

Template Parameters
MThe original matrix type.
_unused(unused)
T2The original matrix element type.
Parameters
matThe original matrix.
cThe column index.
Returns
(Mat&) The certain column(a column vector) (a reference to 'this') .
Here is the call graph for this function:

◆ col() [2/3]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
Mat< T, n_rows, 1, MatType::NORMAL > flames::MatRef< T, n_rows, n_cols, type >::col ( size_t c) const
inline

Take a column of a matrix by index and make a copy.

Note
This function makes a copy, so if you want to optimize your design, always use .col(Mat, int) that takes an argument to avoid copy in place other than initialization. They are equivalent in initialization. Another choice is to use .col_() which creates a read only view, and this operation does not copy.

You may configure macro FLAMES_MAT_COPY_UNROLL_FACTOR or FLAMES_UNROLL_FACTOR to do the operation in parallel.

Parameters
cThe column index.
Returns
(Mat<T, n_rows, 1, MatType::NORMAL>)(column vector) The certain column vector copy.

◆ col() [3/3]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2, size_t rows_, size_t cols_>
void flames::MatRef< T, n_rows, n_cols, type >::col ( size_t c,
const M< T2, rows_, cols_, type2, _unused... > & mat )
inline

◆ operator Mat< T, n_rows, n_cols, type >()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
flames::MatRef< T, n_rows, n_cols, type >::operator Mat< T, n_rows, n_cols, type > ( ) const
inline

Conversion from view to a real Mat.

Returns
(Mat<T, n_rows, n_cols, type>) The real Mat.

◆ operator()() [1/2]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
T & flames::MatRef< T, n_rows, n_cols, type >::operator() ( size_t r,
size_t c )
inline

Get writeable data element by row index and column index.

Parameters
rThe row index (starting from 0).
cThe column index (staring from 0).
Returns
(T) The writeable data element.

◆ operator()() [2/2]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
T flames::MatRef< T, n_rows, n_cols, type >::operator() ( size_t r,
size_t c ) const
inline

Get the read only data element from row and column index.

Parameters
rThe row index.
cThe column index.
Returns
(T) The element value.

◆ operator=()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
MatRef & flames::MatRef< T, n_rows, n_cols, type >::operator= ( const Mat< T, n_rows, n_cols, type > & m)
inline
Here is the call graph for this function:

◆ operator[]() [1/2]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
T & flames::MatRef< T, n_rows, n_cols, type >::operator[] ( size_t index)
inline

Get the writeable element by array row major index.

Parameters
indexThe index.
Returns
(T) The data.
Here is the call graph for this function:

◆ operator[]() [2/2]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
T flames::MatRef< T, n_rows, n_cols, type >::operator[] ( size_t index) const
inline

Get the read only element by array row major index.

Parameters
indexThe index.
Returns
(T) The data.
Here is the call graph for this function:

◆ power()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
template<typename Tp = T>
Tp flames::MatRef< T, n_rows, n_cols, type >::power ( ) const
inline
Here is the call graph for this function:

◆ print()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
void flames::MatRef< T, n_rows, n_cols, type >::print ( const std::string & str = "",
std::ostream & os = std::cout ) const
inline
Here is the call graph for this function:

◆ setValue()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
void flames::MatRef< T, n_rows, n_cols, type >::setValue ( T val)
inline

Set all elements of the matrix to a value.

Parameters
valThe value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setZero()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
void flames::MatRef< T, n_rows, n_cols, type >::setZero ( )
inline

Set all elements of the matrix to zero.

Here is the call graph for this function:

◆ size()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
static constexpr size_t flames::MatRef< T, n_rows, n_cols, type >::size ( )
inlinestaticconstexprnoexcept

The data element number.

Returns
(constexpr size_t) The size.
Here is the caller graph for this function:

◆ sub()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2>
MatRef & flames::MatRef< T, n_rows, n_cols, type >::sub ( const M< T2, n_rows, n_cols, type2, _unused... > & mat_R)
inline
Here is the call graph for this function:

◆ t_()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
MatViewT< T, n_cols, n_rows, type > flames::MatRef< T, n_rows, n_cols, type >::t_ ( ) const
inline

Member Data Documentation

◆ _data

template<typename T , size_t n_rows, size_t n_cols, MatType type>
T* const flames::MatRef< T, n_rows, n_cols, type >::_data

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