Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
CTF::Bivar_Function< dtype_A, dtype_B, dtype_C > Class Template Reference

custom bivariate function on two tensors: e.g. C["ij"] = f(A["ik"],B["kj"]) More...

#include <functions.h>

Inheritance diagram for CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >:
Collaboration diagram for CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >:

Public Member Functions

 Bivar_Function (std::function< dtype_C(dtype_A, dtype_B)> f_)
 constructor takes function pointers to compute C=f(A,B); More...
 
 Bivar_Function (std::function< dtype_C(dtype_A, dtype_B)> f_, bool is_comm)
 constructor takes function pointers to compute C=f(A,B); More...
 
 Bivar_Function ()
 default constructor sets function pointer to NULL More...
 
void apply_f (char const *a, char const *b, char *c) const
 compute c = f(a,b) More...
 
void acc_f (char const *a, char const *b, char *c, CTF_int::algstrct const *sr_C) const
 compute c = c+ f(a,b) More...
 
void csrmm (int m, int n, int k, dtype_A const *A, int const *JA, int const *IA, int64_t nnz_A, dtype_B const *B, dtype_C *C, CTF_int::algstrct const *sr_C) const
 
void csrmultd (int m, int n, int k, dtype_A const *A, int const *JA, int const *IA, int nnz_A, dtype_B const *B, int const *JB, int const *IB, int nnz_B, dtype_C *C, CTF_int::algstrct const *sr_C) const
 
void csrmultcsr (int m, int n, int k, dtype_A const *A, int const *JA, int const *IA, int nnz_A, dtype_B const *B, int const *JB, int const *IB, int nnz_B, char *&C_CSR, CTF_int::algstrct const *sr_C) const
 
void ccsrmm (int m, int n, int k, char const *A, int const *JA, int const *IA, int64_t nnz_A, char const *B, char *C, CTF_int::algstrct const *sr_C) const
 
void ccsrmultd (int m, int n, int k, char const *A, int const *JA, int const *IA, int nnz_A, char const *B, int const *JB, int const *IB, int nnz_B, char *C, CTF_int::algstrct const *sr_C) const
 
void ccsrmultcsr (int m, int n, int k, char const *A, int const *JA, int const *IA, int nnz_A, char const *B, int const *JB, int const *IB, int nnz_B, char *&C_CSR, CTF_int::algstrct const *sr_C) const
 
- Public Member Functions inherited from CTF_int::bivar_function
void operator() (Term const &A, Term const &B, Term const &C) const
 evaluate C+=f(A,B) or f(A,B,C) if transform More...
 
Bifun_Term operator() (Term const &A, Term const &B) const
 evaluate f(A,B) More...
 
 bivar_function (bool is_comm=false, bool is_left_dist=false, bool is_right_dist=false)
 constructor sets function properties, pessimistic defaults More...
 
virtual ~bivar_function ()
 
virtual bool is_accumulator () const
 
virtual void cgemm (char tA, char tB, int m, int n, int k, char const *A, char const *B, char *C) const
 
virtual void coffload_gemm (char tA, char tB, int m, int n, int k, char const *A, char const *B, char *C) const
 
virtual void ccoomm (int m, int n, int k, char const *A, int const *rows_A, int const *cols_A, int64_t nnz_A, char const *B, char *C) const
 
virtual void coffload_csrmm (int m, int n, int k, char const *all_data, char const *B, char *C) const
 

Data Fields

std::function< dtype_C(dtype_A, dtype_B)> f
 function signature for element-wise multiplication, compute C=f(A,B) More...
 
- Data Fields inherited from CTF_int::bivar_function
bool has_kernel
 
bool has_off_gemm
 
bool commutative
 
bool left_distributive
 
bool right_distributive
 

Detailed Description

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
class CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >

custom bivariate function on two tensors: e.g. C["ij"] = f(A["ik"],B["kj"])

Definition at line 137 of file functions.h.

Constructor & Destructor Documentation

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::Bivar_Function ( std::function< dtype_C(dtype_A, dtype_B)>  f_)
inline

constructor takes function pointers to compute C=f(A,B);

Parameters
[in]f_bivariate function (type_A,type_B)->(type_C)

Definition at line 149 of file functions.h.

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::Bivar_Function ( std::function< dtype_C(dtype_A, dtype_B)>  f_,
bool  is_comm 
)
inline

constructor takes function pointers to compute C=f(A,B);

Parameters
[in]f_bivariate function (type_A,type_B)->(type_C)
[in]is_commwhether function is commutative

Definition at line 159 of file functions.h.

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::Bivar_Function ( )

default constructor sets function pointer to NULL

Member Function Documentation

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
void CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::acc_f ( char const *  a,
char const *  b,
char *  c,
CTF_int::algstrct const *  sr_C 
) const
inlinevirtual

compute c = c+ f(a,b)

Parameters
[in]apointer to operand that will be cast to dtype
[in]bpointer to operand that will be cast to dtype
[in,out]cresult c+f(*a,b) of applying f on value of (different type) on a
[in]sr_Calgebraic structure for b, needed to do add

Implements CTF_int::bivar_function.

Definition at line 188 of file functions.h.

References CTF_int::algstrct::add(), and CTF::Endomorphism< dtype >::f.

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
void CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::apply_f ( char const *  a,
char const *  b,
char *  c 
) const
inlinevirtual

compute c = f(a,b)

Parameters
[in]apointer to operand that will be cast to dtype
[in]bpointer to operand that will be cast to dtype
[in,out]cresult c+f(*a,b) of applying f on value of (different type) on a

Implements CTF_int::bivar_function.

Definition at line 177 of file functions.h.

References CTF::Endomorphism< dtype >::f.

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
void CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::ccsrmm ( int  m,
int  n,
int  k,
char const *  A,
int const *  JA,
int const *  IA,
int64_t  nnz_A,
char const *  B,
char *  C,
CTF_int::algstrct const *  sr_C 
) const
inlinevirtual

Reimplemented from CTF_int::bivar_function.

Reimplemented in CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >.

Definition at line 328 of file functions.h.

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
void CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::ccsrmultcsr ( int  m,
int  n,
int  k,
char const *  A,
int const *  JA,
int const *  IA,
int  nnz_A,
char const *  B,
int const *  JB,
int const *  IB,
int  nnz_B,
char *&  C_CSR,
CTF_int::algstrct const *  sr_C 
) const
inlinevirtual

Reimplemented from CTF_int::bivar_function.

Reimplemented in CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >.

Definition at line 359 of file functions.h.

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
void CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::ccsrmultd ( int  m,
int  n,
int  k,
char const *  A,
int const *  JA,
int const *  IA,
int  nnz_A,
char const *  B,
int const *  JB,
int const *  IB,
int  nnz_B,
char *  C,
CTF_int::algstrct const *  sr_C 
) const
inlinevirtual

Reimplemented from CTF_int::bivar_function.

Reimplemented in CTF::Bivar_Kernel< dtype_A, dtype_B, dtype_C, f, g >.

Definition at line 342 of file functions.h.

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
void CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmm ( int  m,
int  n,
int  k,
dtype_A const *  A,
int const *  JA,
int const *  IA,
int64_t  nnz_A,
dtype_B const *  B,
dtype_C *  C,
CTF_int::algstrct const *  sr_C 
) const
inline

Definition at line 196 of file functions.h.

References CTF_int::algstrct::add(), and CTF::Endomorphism< dtype >::f.

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
void CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultcsr ( int  m,
int  n,
int  k,
dtype_A const *  A,
int const *  JA,
int const *  IA,
int  nnz_A,
dtype_B const *  B,
int const *  JB,
int const *  IB,
int  nnz_B,
char *&  C_CSR,
CTF_int::algstrct const *  sr_C 
) const
inline
template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
void CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::csrmultd ( int  m,
int  n,
int  k,
dtype_A const *  A,
int const *  JA,
int const *  IA,
int  nnz_A,
dtype_B const *  B,
int const *  JB,
int const *  IB,
int  nnz_B,
dtype_C *  C,
CTF_int::algstrct const *  sr_C 
) const
inline

Definition at line 228 of file functions.h.

References CTF_int::algstrct::add(), and CTF::Endomorphism< dtype >::f.

Field Documentation

template<typename dtype_A = double, typename dtype_B = dtype_A, typename dtype_C = dtype_A>
std::function<dtype_C (dtype_A, dtype_B)> CTF::Bivar_Function< dtype_A, dtype_B, dtype_C >::f

function signature for element-wise multiplication, compute C=f(A,B)

Definition at line 143 of file functions.h.


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