Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
CTF_int::Term Class Referenceabstract

a term is an abstract object representing some expression of tensors More...

#include <term.h>

Inheritance diagram for CTF_int::Term:
Collaboration diagram for CTF_int::Term:

Public Member Functions

 Term (algstrct const *sr)
 
virtual ~Term ()
 
virtual Termclone (std::map< tensor *, tensor * > *remap=NULL) const =0
 base classes must implement this copy function to retrieve pointer More...
 
virtual void execute (CTF::Idx_Tensor output) const =0
 evalues the expression, which just scales by default More...
 
virtual double estimate_time (CTF::Idx_Tensor output) const =0
 estimates the cost of a contraction/sum/.. term More...
 
virtual CTF::Idx_Tensor estimate_time (double &cost, std::vector< char > out_inds) const =0
 estimates the cost the expression to produce an intermediate with all expression indices remaining More...
 
virtual CTF::Idx_Tensor execute (std::vector< char > out_inds) const =0
 evalues the expression to produce an intermediate with all expression indices remaining More...
 
virtual std::vector< char > get_uniq_inds () const =0
 find list of unique indices that are involved in this term More...
 
virtual void get_inputs (std::set< CTF::Idx_Tensor *, tensor_name_less > *inputs_set) const =0
 appends the tensors this depends on to the input set More...
 
void mult_scl (char const *mulscl)
 multiply scaling factor by mulscl More...
 
Contract_Term operator* (Term const &A) const
 constructs a new term which multiplies by tensor A More...
 
Contract_Term operator* (int64_t scl) const
 multiples by a constant More...
 
Contract_Term operator* (double scl) const
 
Sum_Term operator+ (Term const &A) const
 constructs a new term by addition of two terms More...
 
Sum_Term operator+ (double scl) const
 
Sum_Term operator+ (int64_t scl) const
 
Sum_Term operator- (Term const &A) const
 constructs a new term by subtracting term A More...
 
Sum_Term operator- (double scl) const
 
Sum_Term operator- (int64_t scl) const
 
Termoperator- ()
 
void operator= (CTF::Idx_Tensor const &B)
 A = B, compute any operations on operand B and set. More...
 
void operator= (Term const &B)
 
void operator+= (Term const &B)
 
void operator-= (Term const &B)
 
void operator*= (Term const &B)
 
void operator= (double scl)
 
void operator+= (double scl)
 
void operator<< (CTF_int::Term const &B)
 
void operator<< (double scl)
 
void operator-= (double scl)
 
void operator*= (double scl)
 
void operator= (int64_t scl)
 
void operator+= (int64_t scl)
 
void operator-= (int64_t scl)
 
void operator*= (int64_t scl)
 
void operator= (int scl)
 
void operator+= (int scl)
 
void operator-= (int scl)
 
void operator*= (int scl)
 
virtual CTF::Worldwhere_am_i () const =0
 figures out what world this term lives on More...
 
 operator float () const
 cast to float (works only if tensor type is castable to float) allows a scalar output More...
 
 operator double () const
 cast to double (works only if tensor type is castable to double) allows a scalar output More...
 
 operator int64_t () const
 cast to int64_t (works only if tensor type is castable to int64_t) allows a scalar output More...
 
 operator int () const
 cast to int64_t (works only if tensor type is castable to int64_t) allows a scalar output More...
 

Data Fields

char * scale
 
algstrctsr
 

Detailed Description

a term is an abstract object representing some expression of tensors

Definition at line 33 of file term.h.

Constructor & Destructor Documentation

CTF_int::Term::Term ( algstrct const *  sr)

Definition at line 202 of file term.cxx.

References CTF_int::algstrct::clone(), and ctf.core::scale().

CTF_int::Term::~Term ( )
virtual

Definition at line 208 of file term.cxx.

References CTF_int::cdealloc(), and ctf.core::scale().

Member Function Documentation

virtual double CTF_int::Term::estimate_time ( CTF::Idx_Tensor  output) const
pure virtual
virtual CTF::Idx_Tensor CTF_int::Term::estimate_time ( double &  cost,
std::vector< char >  out_inds 
) const
pure virtual

estimates the cost the expression to produce an intermediate with all expression indices remaining

Parameters
[in,out]costthe cost of the operation
[in]out_indsunique indices to not contract/sum away
Returns
output tensor to write results into and its indices

Implemented in CTF_int::Contract_Term, CTF_int::Sum_Term, CTF::Idx_Tensor, CTF_int::Bifun_Term, and CTF_int::Unifun_Term.

virtual CTF::Idx_Tensor CTF_int::Term::execute ( std::vector< char >  out_inds) const
pure virtual

evalues the expression to produce an intermediate with all expression indices remaining

Parameters
[in]out_indsunique indices to not contract/sum away

Implemented in CTF_int::Contract_Term, CTF_int::Sum_Term, CTF_int::Bifun_Term, CTF::Idx_Tensor, and CTF_int::Unifun_Term.

virtual void CTF_int::Term::get_inputs ( std::set< CTF::Idx_Tensor *, tensor_name_less > *  inputs_set) const
pure virtual

appends the tensors this depends on to the input set

Implemented in CTF_int::Contract_Term, CTF_int::Sum_Term, CTF_int::Bifun_Term, and CTF_int::Unifun_Term.

Referenced by CTF_int::Unifun_Term::get_inputs(), and CTF_int::Bifun_Term::get_inputs().

virtual std::vector<char> CTF_int::Term::get_uniq_inds ( ) const
pure virtual
void CTF_int::Term::mult_scl ( char const *  mulscl)

multiply scaling factor by mulscl

Definition at line 216 of file term.cxx.

References ctf.core::scale().

CTF_int::Term::operator double ( ) const

cast to double (works only if tensor type is castable to double) allows a scalar output

Definition at line 295 of file term.cxx.

References CTF_int::CommData::bcast(), CTF::World::cdt, CTF_int::tensor::data, CTF_int::get_double_ring(), and CTF_int::tensor::wrld.

CTF_int::Term::operator float ( ) const

cast to float (works only if tensor type is castable to float) allows a scalar output

Definition at line 286 of file term.cxx.

References CTF_int::CommData::bcast(), CTF::World::cdt, CTF_int::tensor::data, CTF_int::get_float_ring(), and CTF_int::tensor::wrld.

CTF_int::Term::operator int ( ) const

cast to int64_t (works only if tensor type is castable to int64_t) allows a scalar output

Definition at line 314 of file term.cxx.

References CTF_int::CommData::bcast(), CTF::World::cdt, CTF_int::tensor::data, CTF_int::get_int_ring(), and CTF_int::tensor::wrld.

CTF_int::Term::operator int64_t ( ) const

cast to int64_t (works only if tensor type is castable to int64_t) allows a scalar output

Definition at line 323 of file term.cxx.

References CTF_int::CommData::bcast(), CTF::World::cdt, CTF_int::tensor::data, CTF_int::get_int64_t_ring(), and CTF_int::tensor::wrld.

Contract_Term CTF_int::Term::operator* ( Term const &  A) const

constructs a new term which multiplies by tensor A

Parameters
[in]Aterm to multiply by

Definition at line 220 of file term.cxx.

References clone().

Contract_Term CTF_int::Term::operator* ( int64_t  scl) const

multiples by a constant

Parameters
[in]sclscaling factor to multiply term by

Definition at line 274 of file term.cxx.

References CTF::Idx_Tensor::clone().

Contract_Term CTF_int::Term::operator* ( double  scl) const

Definition at line 280 of file term.cxx.

References CTF::Idx_Tensor::clone().

void CTF_int::Term::operator*= ( Term const &  B)

Definition at line 245 of file term.cxx.

void CTF_int::Term::operator*= ( double  scl)

Definition at line 250 of file term.cxx.

void CTF_int::Term::operator*= ( int64_t  scl)

Definition at line 255 of file term.cxx.

void CTF_int::Term::operator*= ( int  scl)

Definition at line 259 of file term.cxx.

Sum_Term CTF_int::Term::operator+ ( Term const &  A) const

constructs a new term by addition of two terms

Parameters
[in]Aterm to add to output

Definition at line 226 of file term.cxx.

References clone().

Sum_Term CTF_int::Term::operator+ ( double  scl) const
Sum_Term CTF_int::Term::operator+ ( int64_t  scl) const
void CTF_int::Term::operator+= ( Term const &  B)

Definition at line 243 of file term.cxx.

void CTF_int::Term::operator+= ( double  scl)

Definition at line 248 of file term.cxx.

void CTF_int::Term::operator+= ( int64_t  scl)

Definition at line 253 of file term.cxx.

void CTF_int::Term::operator+= ( int  scl)

Definition at line 257 of file term.cxx.

Sum_Term CTF_int::Term::operator- ( Term const &  A) const

constructs a new term by subtracting term A

Parameters
[in]Asubtracted term

Definition at line 232 of file term.cxx.

References CTF_int::alloc(), clone(), CTF_int::Sum_Term::operands, and scale.

Sum_Term CTF_int::Term::operator- ( double  scl) const
Sum_Term CTF_int::Term::operator- ( int64_t  scl) const
Term & CTF_int::Term::operator- ( )

Definition at line 263 of file term.cxx.

References ctf.core::scale().

void CTF_int::Term::operator-= ( Term const &  B)

Definition at line 244 of file term.cxx.

void CTF_int::Term::operator-= ( double  scl)

Definition at line 249 of file term.cxx.

void CTF_int::Term::operator-= ( int64_t  scl)

Definition at line 254 of file term.cxx.

void CTF_int::Term::operator-= ( int  scl)

Definition at line 258 of file term.cxx.

void CTF_int::Term::operator<< ( double  scl)
void CTF_int::Term::operator= ( CTF::Idx_Tensor const &  B)

A = B, compute any operations on operand B and set.

Parameters
[in]Btensor on the right hand side

Definition at line 241 of file term.cxx.

void CTF_int::Term::operator= ( Term const &  B)

Definition at line 242 of file term.cxx.

void CTF_int::Term::operator= ( double  scl)

Definition at line 247 of file term.cxx.

void CTF_int::Term::operator= ( int64_t  scl)

Definition at line 252 of file term.cxx.

void CTF_int::Term::operator= ( int  scl)

Definition at line 256 of file term.cxx.

virtual CTF::World* CTF_int::Term::where_am_i ( ) const
pure virtual

Field Documentation


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