Graph Framework
Loading...
Searching...
No Matches
backend::buffer< T > Class Template Reference

Class representing a generic buffer. More...

#include <backend.hpp>

Public Types

typedef T base
 Type def to retrieve the backend T type.
 

Public Member Functions

 buffer ()
 Construct an empty buffer backend.
 
 buffer (const size_t s)
 Construct a buffer backend with a size.
 
 buffer (const size_t s, const T d)
 Construct a buffer backend with a size.
 
 buffer (const std::vector< T > &d)
 Construct a buffer backend from a vector.
 
 buffer (const buffer &d)
 Construct a buffer backend from a buffer backend.
 
T & operator[] (const size_t index)
 Index operator.
 
const T & operator[] (const size_t index) const
 Const index operator.
 
const T at (const size_t index) const
 Get value at.
 
void set (const T d)
 Assign a constant value.
 
void set (const std::vector< T > &d)
 Assign a vector value.
 
size_t size () const
 Get size of the buffer.
 
bool is_same () const
 Is every element the same.
 
bool is_zero () const
 Is every element zero.
 
bool has_zero () const
 Is any element zero.
 
bool is_negative () const
 Is every element negative.
 
bool is_even () const
 Is every element even.
 
bool is_none () const
 Is every element negative one.
 
void sqrt ()
 Take sqrt.
 
void exp ()
 Take exp.
 
void log ()
 Take log.
 
void sin ()
 Take sin.
 
void cos ()
 Take cos.
 
void erfi ()
 Take erfi.
 
T * data ()
 Get a pointer to the basic memory buffer.
 
bool is_normal () const
 Check for normal values.
 
void add_row (const buffer< T > &x)
 Add row operation.
 
void add_col (const buffer< T > &x)
 Add col operation.
 
void subtract_row (const buffer< T > &x)
 Subtract row operation.
 
void subtract_col (const buffer< T > &x)
 Subtract col operation.
 
void multiply_row (const buffer< T > &x)
 Multiply row operation.
 
void multiply_col (const buffer< T > &x)
 Multiply col operation.
 
void divide_row (const buffer< T > &x)
 Divide row operation.
 
void divide_col (const buffer< T > &x)
 Divide col operation.
 
void atan_row (const buffer< T > &x)
 Atan row operation.
 
void atan_col (const buffer< T > &x)
 Atan col operation.
 
void pow_row (const buffer< T > &x)
 Pow row operation.
 
void pow_col (const buffer< T > &x)
 Pow col operation.
 

Detailed Description

template<jit::float_scalar T>
class backend::buffer< T >

Class representing a generic buffer.

Template Parameters
TBase type of the calculation.

Constructor & Destructor Documentation

◆ buffer() [1/4]

template<jit::float_scalar T>
backend::buffer< T >::buffer ( const size_t  s)
inline

Construct a buffer backend with a size.

Parameters
[in]sSize of he data buffer.

◆ buffer() [2/4]

template<jit::float_scalar T>
backend::buffer< T >::buffer ( const size_t  s,
const T  d 
)
inline

Construct a buffer backend with a size.

Parameters
[in]sSize of he data buffer.
[in]dScalar data to initalize.

◆ buffer() [3/4]

template<jit::float_scalar T>
backend::buffer< T >::buffer ( const std::vector< T > &  d)
inline

Construct a buffer backend from a vector.

Parameters
[in]dArray buffer.

◆ buffer() [4/4]

template<jit::float_scalar T>
backend::buffer< T >::buffer ( const buffer< T > &  d)
inline

Construct a buffer backend from a buffer backend.

Parameters
[in]dBackend buffer.

Member Function Documentation

◆ add_col()

template<jit::float_scalar T>
void backend::buffer< T >::add_col ( const buffer< T > &  x)
inline

Add col operation.

Adds m_ij + v_j or v_j + m_ij. This will resize the buffer if it needs to be.

Parameters
[in]xThe other operand.

◆ add_row()

template<jit::float_scalar T>
void backend::buffer< T >::add_row ( const buffer< T > &  x)
inline

Add row operation.

Adds m_ij + v_i or v_i + m_ij. This will resize the buffer if it needs to be.

Parameters
[in]xThe right operand.

◆ atan_col()

template<jit::float_scalar T>
void backend::buffer< T >::atan_col ( const buffer< T > &  x)
inline

Atan col operation.

Computes atan(m_ij, v_j) or atan(v_j, m_ij). This will resize the buffer if it needs to be.

Parameters
[in]xThe other operand.

◆ atan_row()

template<jit::float_scalar T>
void backend::buffer< T >::atan_row ( const buffer< T > &  x)
inline

Atan row operation.

Computes atan(m_ij, v_i) or atan(v_i, m_ij). This will resize the buffer if it needs to be.

Parameters
[in]xThe right operand.

◆ data()

template<jit::float_scalar T>
T * backend::buffer< T >::data ( )
inline

Get a pointer to the basic memory buffer.

Returns
The pointer to the buffer memory.

◆ divide_col()

template<jit::float_scalar T>
void backend::buffer< T >::divide_col ( const buffer< T > &  x)
inline

Divide col operation.

Divides m_ij / v_j or v_j / m_ij. This will resize the buffer if it needs to be.

Parameters
[in]xThe other operand.

◆ divide_row()

template<jit::float_scalar T>
void backend::buffer< T >::divide_row ( const buffer< T > &  x)
inline

Divide row operation.

Divides m_ij / v_i or v_i / m_ij. This will resize the buffer if it needs to be.

Parameters
[in]xThe right operand.

◆ has_zero()

template<jit::float_scalar T>
bool backend::buffer< T >::has_zero ( ) const
inline

Is any element zero.

Returns
Returns true if any element is zero.

◆ is_even()

template<jit::float_scalar T>
bool backend::buffer< T >::is_even ( ) const
inline

Is every element even.

Returns
Returns true if every element is negative.

◆ is_negative()

template<jit::float_scalar T>
bool backend::buffer< T >::is_negative ( ) const
inline

Is every element negative.

Returns
Returns true if every element is negative.

◆ is_none()

template<jit::float_scalar T>
bool backend::buffer< T >::is_none ( ) const
inline

Is every element negative one.

Returns
Returns true if every element is negative one.

◆ is_normal()

template<jit::float_scalar T>
bool backend::buffer< T >::is_normal ( ) const
inline

Check for normal values.

Returns
False if any NaN or Inf is found.

◆ is_same()

template<jit::float_scalar T>
bool backend::buffer< T >::is_same ( ) const
inline

Is every element the same.

Returns
Returns true if every element is the same.

◆ is_zero()

template<jit::float_scalar T>
bool backend::buffer< T >::is_zero ( ) const
inline

Is every element zero.

Returns
Returns true if every element is zero.

◆ multiply_col()

template<jit::float_scalar T>
void backend::buffer< T >::multiply_col ( const buffer< T > &  x)
inline

Multiply col operation.

Multiplies m_ij * v_j or v_j * m_ij. This will resize the buffer if it needs to be.

Parameters
[in]xThe other operand.

◆ multiply_row()

template<jit::float_scalar T>
void backend::buffer< T >::multiply_row ( const buffer< T > &  x)
inline

Multiply row operation.

Multiplies m_ij * v_i or v_i * m_ij. This will resize the buffer if it needs to be.

Parameters
[in]xThe right operand.

◆ pow_col()

template<jit::float_scalar T>
void backend::buffer< T >::pow_col ( const buffer< T > &  x)
inline

Pow col operation.

Computes pow(m_ij, v_j) or pow(v_j, m_ij). This will resize the buffer if it needs to be.

Parameters
[in]xThe other operand.

◆ pow_row()

template<jit::float_scalar T>
void backend::buffer< T >::pow_row ( const buffer< T > &  x)
inline

Pow row operation.

Computes pow(m_ij, v_i) or pow(v_i, m_ij). This will resize the buffer if it needs to be.

Parameters
[in]xThe right operand.

◆ set() [1/2]

template<jit::float_scalar T>
void backend::buffer< T >::set ( const std::vector< T > &  d)
inline

Assign a vector value.

Parameters
[in]dVector data to set.

◆ set() [2/2]

template<jit::float_scalar T>
void backend::buffer< T >::set ( const T  d)
inline

Assign a constant value.

Parameters
[in]dScalar data to set.

◆ subtract_col()

template<jit::float_scalar T>
void backend::buffer< T >::subtract_col ( const buffer< T > &  x)
inline

Subtract col operation.

Sunbtracts m_ij - v_j or v_j - m_ij. This will resize the buffer if it needs to be.

Parameters
[in]xThe other operand.

◆ subtract_row()

template<jit::float_scalar T>
void backend::buffer< T >::subtract_row ( const buffer< T > &  x)
inline

Subtract row operation.

Sunbtracts m_ij - v_i or v_i - m_ij. This will resize the buffer if it needs to be.

Parameters
[in]xThe right operand.

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