Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
|
a term is an abstract object representing some expression of tensors More...
#include <term.h>
Public Member Functions | |
Term (algstrct const *sr) | |
virtual | ~Term () |
virtual Term * | clone (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 |
Term & | operator- () |
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::World * | where_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 |
algstrct * | sr |
a term is an abstract object representing some expression of tensors
CTF_int::Term::Term | ( | algstrct const * | sr | ) |
Definition at line 202 of file term.cxx.
References CTF_int::algstrct::clone(), and ctf.core::scale().
|
virtual |
Definition at line 208 of file term.cxx.
References CTF_int::cdealloc(), and ctf.core::scale().
|
pure virtual |
base classes must implement this copy function to retrieve pointer
Implemented in CTF_int::Contract_Term, CTF::Typ_Idx_Tensor< dtype >, CTF::Typ_Idx_Tensor< dtype_C >, CTF_int::Sum_Term, CTF_int::Bifun_Term, CTF_int::Unifun_Term, and CTF::Idx_Tensor.
Referenced by CTF_int::Bifun_Term::Bifun_Term(), CTF::TensorOperation::execute(), CTF_int::univar_function::operator()(), CTF_int::bivar_function::operator()(), operator*(), CTF_int::Contract_Term::operator*(), CTF::Idx_Tensor::operator*=(), operator+(), CTF_int::Sum_Term::operator+(), CTF::Idx_Tensor::operator+=(), operator-(), CTF_int::Sum_Term::operator-(), CTF::Idx_Tensor::operator-=(), CTF::Idx_Tensor::operator=(), and CTF_int::Unifun_Term::Unifun_Term().
|
pure virtual |
estimates the cost of a contraction/sum/.. term
[in] | 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.
Referenced by CTF_int::contract_down_terms(), CTF_int::Unifun_Term::estimate_time(), CTF_int::Bifun_Term::estimate_time(), CTF_int::Sum_Term::estimate_time(), and CTF_int::Contract_Term::estimate_time().
|
pure virtual |
estimates the cost the expression to produce an intermediate with all expression indices remaining
[in,out] | cost | the cost of the operation |
[in] | out_inds | unique indices to not contract/sum away |
Implemented in CTF_int::Contract_Term, CTF_int::Sum_Term, CTF::Idx_Tensor, CTF_int::Bifun_Term, and CTF_int::Unifun_Term.
|
pure virtual |
evalues the expression, which just scales by default
[in,out] | 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.
Referenced by CTF_int::contract_down_terms(), CTF_int::Unifun_Term::execute(), CTF_int::Bifun_Term::execute(), CTF_int::Sum_Term::execute(), CTF_int::Contract_Term::execute(), CTF_int::endomorphism::operator()(), CTF_int::bivar_function::operator()(), CTF_int::univar_function::operator()(), CTF::Idx_Tensor::operator+=(), CTF::Idx_Tensor::operator-=(), operator<<(), and CTF::Idx_Tensor::operator=().
|
pure virtual |
evalues the expression to produce an intermediate with all expression indices remaining
[in] | out_inds | unique 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.
|
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().
|
pure virtual |
find list of unique indices that are involved in this term
Implemented in CTF_int::Contract_Term, CTF_int::Sum_Term, CTF::Idx_Tensor, CTF_int::Bifun_Term, and CTF_int::Unifun_Term.
Referenced by CTF_int::Bifun_Term::estimate_time(), CTF_int::Bifun_Term::execute(), CTF_int::Unifun_Term::get_uniq_inds(), CTF_int::Bifun_Term::get_uniq_inds(), CTF_int::endomorphism::operator()(), CTF_int::bivar_function::operator()(), and CTF_int::univar_function::operator()().
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 |
Contract_Term CTF_int::Term::operator* | ( | int64_t | scl | ) | const |
multiples by a constant
[in] | scl | scaling 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().
Sum_Term CTF_int::Term::operator+ | ( | double | scl | ) | const |
Sum_Term CTF_int::Term::operator+ | ( | int64_t | scl | ) | const |
constructs a new term by subtracting term A
[in] | A | subtracted 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<< | ( | CTF_int::Term const & | B | ) |
Definition at line 737 of file term.cxx.
References execute(), CTF_int::Contract_Term::execute(), CTF_int::Contract_Term::get_uniq_inds(), CTF_int::algstrct::mulid(), CTF_int::algstrct::safecopy(), scale, and sr.
void CTF_int::Term::operator<< | ( | double | scl | ) |
Definition at line 741 of file term.cxx.
References CTF_int::Contract_Term::execute(), CTF_int::Contract_Term::get_uniq_inds(), and sr.
void CTF_int::Term::operator= | ( | CTF::Idx_Tensor const & | B | ) |
|
pure virtual |
figures out what world this term lives on
Implemented in CTF_int::Contract_Term, CTF_int::Sum_Term, CTF::Idx_Tensor, CTF_int::Bifun_Term, and CTF_int::Unifun_Term.
Referenced by CTF_int::Unifun_Term::where_am_i(), and CTF_int::Bifun_Term::where_am_i().
char* CTF_int::Term::scale |
Definition at line 35 of file term.h.
Referenced by CTF_int::Bifun_Term::Bifun_Term(), CTF_int::contract_down_terms(), CTF_int::Contract_Term::Contract_Term(), CTF_int::Unifun_Term::estimate_time(), CTF_int::Bifun_Term::estimate_time(), CTF::Idx_Tensor::estimate_time(), CTF_int::Sum_Term::estimate_time(), CTF_int::Contract_Term::estimate_time(), CTF_int::Unifun_Term::execute(), CTF_int::Bifun_Term::execute(), CTF::Idx_Tensor::execute(), CTF_int::Sum_Term::execute(), CTF_int::Contract_Term::execute(), CTF::Idx_Tensor::Idx_Tensor(), CTF_int::endomorphism::operator()(), CTF::Idx_Tensor::operator+=(), operator-(), CTF_int::Sum_Term::operator-(), CTF::Idx_Tensor::operator-=(), operator<<(), CTF::Idx_Tensor::operator=(), CTF::Typ_Idx_Tensor< dtype_C >::operator=(), CTF_int::Sum_Term::Sum_Term(), and CTF_int::Unifun_Term::Unifun_Term().
algstrct* CTF_int::Term::sr |
Definition at line 36 of file term.h.
Referenced by CTF_int::Bifun_Term::Bifun_Term(), CTF_int::Contract_Term::Contract_Term(), CTF_int::Bifun_Term::estimate_time(), CTF::Idx_Tensor::estimate_time(), CTF_int::Contract_Term::estimate_time(), CTF_int::Bifun_Term::execute(), CTF::Idx_Tensor::execute(), CTF_int::Sum_Term::execute(), CTF_int::Contract_Term::execute(), CTF::Idx_Tensor::Idx_Tensor(), CTF::Idx_Tensor::multeq(), CTF::Idx_Tensor::operator*=(), CTF::Idx_Tensor::operator+=(), CTF_int::Sum_Term::operator-(), CTF::Idx_Tensor::operator-=(), operator<<(), CTF::Idx_Tensor::operator=(), CTF::Typ_Idx_Tensor< dtype_C >::operator=(), CTF_int::Sum_Term::Sum_Term(), and CTF_int::Unifun_Term::Unifun_Term().