FLAMES 0.1.0
Matrix-Empowered HLS Library
flames::MatView< T, n_rows, n_cols, type > Class Template Reference

Read only view version of a matrix. More...

#include <core.hpp>

Public Member Functions

 MatView (const Mat< T, n_rows, n_cols, type > &m)
 Construct a new MatView object from raw data pointer. More...
 
 MatView (Mat< T, n_rows, n_cols, type > &m)
 
 MatView (const T *const ptr)
 
 MatView (const MatView &m)
 Copy constructor. More...
 
MatViewoperator= (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. More...
 
operator[] (size_t index) const
 Get the read only element by array row major index. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2, size_t rows_, size_t cols_>
MatViewcol (const M< T2, rows_, cols_, type2, _unused... > &mat, size_t c)
 Take a column of a matrix by index. More...
 
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::NORMAL > col (size_t c) const
 Take a column of a matrix by index and make a copy. More...
 
template<template< class, size_t, size_t, MatType, class... > typename M, typename... _unused, typename T2 , MatType type2>
MatViewadd (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>
MatViewsub (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. More...
 
Mat< T, n_rows, n_cols, type > asMat () const
 Explicitly make a Mat copy. More...
 
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. More...
 

Public Attributes

const T *const _data
 

Detailed Description

template<typename T, size_t n_rows, size_t n_cols, MatType type>
class flames::MatView< T, n_rows, n_cols, type >

Read only view version of a matrix.

Template Parameters
TElement type.
n_rowsNumber of rows.
n_colsNumber of columns.
typeMatrix type.

Constructor & Destructor Documentation

◆ MatView() [1/4]

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

Construct a new MatView object from raw data pointer.

Parameters
mThe original matrix.

◆ MatView() [2/4]

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

◆ MatView() [3/4]

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

◆ MatView() [4/4]

template<typename T , size_t n_rows, size_t n_cols, MatType type>
flames::MatView< T, n_rows, n_cols, type >::MatView ( const MatView< 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::MatView< 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>
MatView & flames::MatView< 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::MatView< 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::MatView< 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_>
MatView & flames::MatView< 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::MatView< 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::MatView< 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::MatView< 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()()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
T flames::MatView< 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>
MatView & flames::MatView< 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[]()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
T flames::MatView< 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::MatView< 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::MatView< 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:

◆ size()

template<typename T , size_t n_rows, size_t n_cols, MatType type>
static constexpr size_t flames::MatView< 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>
MatView & flames::MatView< 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::MatView< 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>
const T* const flames::MatView< T, n_rows, n_cols, type >::_data

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