Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
|
a tensor with an index map associated with it (necessary for overloaded operators) More...
#include <idx_tensor.h>
Public Member Functions | |
CTF_int::Term * | clone (std::map< CTF_int::tensor *, CTF_int::tensor * > *remap=NULL) const |
base classes must implement this copy function to retrieve pointer More... | |
Idx_Tensor (CTF_int::tensor *parent_, const char *idx_map_, int copy=0) | |
constructor takes in a parent tensor and its indices More... | |
Idx_Tensor (CTF::Idx_Tensor const &other, int copy=0, std::map< CTF_int::tensor *, CTF_int::tensor * > *remap=NULL) | |
copy constructor More... | |
Idx_Tensor (CTF_int::algstrct const *sr) | |
constructor for scalar More... | |
Idx_Tensor (CTF_int::algstrct const *sr, double scl) | |
Idx_Tensor (CTF_int::algstrct const *sr, int64_t scl) | |
~Idx_Tensor () | |
Idx_Tensor | execute (std::vector< char > out_inds) const |
evalues the expression to produce an intermediate with all expression indices remaining More... | |
void | execute (Idx_Tensor output) const |
evalues the expression, which just scales by default More... | |
double | estimate_time (Idx_Tensor output) const |
estimates the cost of a contraction More... | |
Idx_Tensor | estimate_time (double &cost, std::vector< char > out_inds) const |
estimates the cost the expression to produce an intermediate with all expression indices remaining More... | |
std::vector< char > | get_uniq_inds () const |
find list of unique indices that are involved in this term More... | |
void | get_inputs (std::set< Idx_Tensor *, CTF_int::tensor_name_less > *inputs_set) const |
appends the tensors this depends on to the input set More... | |
void | operator= (CTF_int::Term const &B) |
A = B, compute any operations on operand B and set. More... | |
void | operator= (Idx_Tensor const &B) |
void | operator= (double scl) |
void | operator+= (double scl) |
void | operator-= (double scl) |
void | operator*= (double scl) |
void | multeq (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) |
void | operator+= (CTF_int::Term const &B) |
A += B, compute any operations on operand B and add. More... | |
void | operator-= (CTF_int::Term const &B) |
A += B, compute any operations on operand B and add. More... | |
void | operator*= (CTF_int::Term const &B) |
negates term More... | |
World * | where_am_i () const |
figures out what world this term lives on More... | |
Public Member Functions inherited from CTF_int::Term | |
Term (algstrct const *sr) | |
virtual | ~Term () |
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) |
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 | |
CTF_int::tensor * | parent |
char * | idx_map |
int | is_intm |
Data Fields inherited from CTF_int::Term | |
char * | scale |
algstrct * | sr |
a tensor with an index map associated with it (necessary for overloaded operators)
Definition at line 15 of file idx_tensor.h.
CTF::Idx_Tensor::Idx_Tensor | ( | CTF_int::tensor * | parent_, |
const char * | idx_map_, | ||
int | copy = 0 |
||
) |
constructor takes in a parent tensor and its indices
[in] | parent_ | the parent tensor |
[in] | idx_map_ | the indices assigned ot this tensor |
[in] | copy | if set to 1, create copy of parent |
Definition at line 83 of file idx_tensor.cxx.
References CTF_int::alloc(), idx_map, is_intm, CTF_int::tensor::order, and parent.
Referenced by clone(), multeq(), operator*=(), operator+=(), operator-=(), and operator=().
CTF::Idx_Tensor::Idx_Tensor | ( | CTF::Idx_Tensor const & | other, |
int | copy = 0 , |
||
std::map< CTF_int::tensor *, CTF_int::tensor * > * | remap = NULL |
||
) |
copy constructor
[in] | other | tensor to copy |
[in] | copy | if 1 then copy the parent tensor of B into a new tensor |
[in] | remap | redistribution dependency map |
Definition at line 116 of file idx_tensor.cxx.
References CTF_int::alloc(), idx_map, is_intm, ctf.core::it, CTF_int::tensor::order, parent, CTF_int::algstrct::safecopy(), CTF_int::Term::scale, and CTF_int::Term::sr.
CTF::Idx_Tensor::Idx_Tensor | ( | CTF_int::algstrct const * | sr | ) |
CTF::Idx_Tensor::Idx_Tensor | ( | CTF_int::algstrct const * | sr, |
double | scl | ||
) |
Definition at line 102 of file idx_tensor.cxx.
References CTF_int::algstrct::cast_double(), idx_map, is_intm, parent, and CTF_int::Term::scale.
CTF::Idx_Tensor::Idx_Tensor | ( | CTF_int::algstrct const * | sr, |
int64_t | scl | ||
) |
Definition at line 109 of file idx_tensor.cxx.
References CTF_int::algstrct::cast_int(), idx_map, is_intm, parent, and CTF_int::Term::scale.
CTF::Idx_Tensor::~Idx_Tensor | ( | ) |
Definition at line 159 of file idx_tensor.cxx.
References CTF_int::cdealloc(), idx_map, is_intm, and parent.
|
virtual |
base classes must implement this copy function to retrieve pointer
Implements CTF_int::Term.
Reimplemented in CTF::Typ_Idx_Tensor< dtype >, and CTF::Typ_Idx_Tensor< dtype_C >.
Definition at line 168 of file idx_tensor.cxx.
References Idx_Tensor().
Referenced by CTF_int::contract_down_terms(), CTF::TensorOperation::execute(), and CTF_int::Term::operator*().
|
virtual |
estimates the cost of a contraction
[in] | output | tensor to write results into and its indices |
Implements CTF_int::Term.
Definition at line 294 of file idx_tensor.cxx.
References CTF_int::summation::estimate_time(), idx_map, CTF_int::algstrct::mulid(), parent, CTF_int::Term::scale, CTF_int::Term::sr, and where_am_i().
Referenced by CTF_int::Sum_Term::estimate_time(), and CTF_int::Contract_Term::estimate_time().
|
virtual |
estimates the cost the expression to produce an intermediate with all expression indices remaining
[out] | cost | estimate of time in sec |
[in] | out_inds | unique indices to not contract/sum away |
Implements CTF_int::Term.
Definition at line 307 of file idx_tensor.cxx.
|
virtual |
evalues the expression to produce an intermediate with all expression indices remaining
[in] | out_inds | unique indices to not contract/sum away |
Implements CTF_int::Term.
Definition at line 290 of file idx_tensor.cxx.
Referenced by CTF_int::Sum_Term::execute(), CTF_int::Contract_Term::execute(), multeq(), CTF::Typ_Sum_Term< dtype_A, dtype_B >::operator()(), operator*=(), operator+=(), CTF::Typ_Sum_Term< dtype_A, dtype_B >::operator,(), operator-=(), and operator=().
|
virtual |
evalues the expression, which just scales by default
[in,out] | output | tensor to write results into and its indices |
Implements CTF_int::Term.
Definition at line 270 of file idx_tensor.cxx.
References CTF_int::summation::execute(), CTF_int::tensor::get_raw_data(), idx_map, parent, CTF_int::Term::scale, CTF_int::Term::sr, and where_am_i().
void CTF::Idx_Tensor::get_inputs | ( | std::set< Idx_Tensor *, CTF_int::tensor_name_less > * | inputs_set | ) | const |
appends the tensors this depends on to the input set
Definition at line 320 of file idx_tensor.cxx.
|
virtual |
find list of unique indices that are involved in this term
Implements CTF_int::Term.
Definition at line 311 of file idx_tensor.cxx.
References idx_map, CTF_int::tensor::order, and parent.
Referenced by CTF_int::Sum_Term::estimate_time(), CTF_int::Contract_Term::estimate_time(), CTF_int::Sum_Term::execute(), CTF_int::Contract_Term::execute(), multeq(), CTF::Typ_Sum_Term< dtype_A, dtype_B >::operator()(), operator*=(), operator+=(), CTF::Typ_Sum_Term< dtype_A, dtype_B >::operator,(), operator-=(), and operator=().
void CTF::Idx_Tensor::multeq | ( | double | scl | ) |
Definition at line 222 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator*= | ( | double | scl | ) |
Definition at line 221 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator*= | ( | int64_t | scl | ) |
Definition at line 227 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator*= | ( | int | scl | ) |
Definition at line 232 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator*= | ( | CTF_int::Term const & | B | ) |
negates term
A -> A*B contract two tensors
[in] | B | tensor on the right hand side |
Definition at line 257 of file idx_tensor.cxx.
References CTF::ScheduleBase::add_operation(), CTF_int::Term::clone(), CTF::global_schedule, Idx_Tensor(), and CTF::TENSOR_OP_MULTIPLY.
void CTF::Idx_Tensor::operator+= | ( | double | scl | ) |
Definition at line 219 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
Referenced by CTF::Typ_Idx_Tensor< dtype_C >::operator+=().
void CTF::Idx_Tensor::operator+= | ( | int64_t | scl | ) |
Definition at line 225 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator+= | ( | int | scl | ) |
Definition at line 230 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator+= | ( | CTF_int::Term const & | B | ) |
A += B, compute any operations on operand B and add.
[in] | B | tensor on the right hand side |
Definition at line 207 of file idx_tensor.cxx.
References CTF::ScheduleBase::add_operation(), CTF_int::Term::clone(), CTF_int::Term::execute(), CTF::global_schedule, Idx_Tensor(), CTF_int::algstrct::mulid(), CTF_int::algstrct::safecopy(), CTF_int::Term::scale, CTF_int::Term::sr, and CTF::TENSOR_OP_SUM.
void CTF::Idx_Tensor::operator-= | ( | double | scl | ) |
Definition at line 220 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator-= | ( | int64_t | scl | ) |
Definition at line 226 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator-= | ( | int | scl | ) |
Definition at line 231 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator-= | ( | CTF_int::Term const & | B | ) |
A += B, compute any operations on operand B and add.
[in] | B | tensor on the right hand side |
Definition at line 241 of file idx_tensor.cxx.
References CTF::ScheduleBase::add_operation(), CTF_int::cdealloc(), CTF_int::Term::clone(), CTF_int::Term::execute(), CTF::global_schedule, Idx_Tensor(), CTF_int::algstrct::mulid(), CTF_int::algstrct::safeaddinv(), CTF_int::algstrct::safecopy(), CTF_int::algstrct::safemul(), CTF_int::Term::scale, CTF_int::Term::sr, and CTF::TENSOR_OP_SUBTRACT.
void CTF::Idx_Tensor::operator= | ( | CTF_int::Term const & | B | ) |
A = B, compute any operations on operand B and set.
[in] | B | tensor on the right hand side |
Definition at line 192 of file idx_tensor.cxx.
References CTF::ScheduleBase::add_operation(), CTF_int::algstrct::addid(), CTF_int::Term::clone(), CTF_int::Term::execute(), CTF::global_schedule, CTF_int::algstrct::has_mul(), Idx_Tensor(), CTF_int::algstrct::mulid(), parent, CTF_int::algstrct::safecopy(), CTF_int::Term::scale, CTF_int::tensor::set_zero(), CTF_int::Term::sr, and CTF::TENSOR_OP_SET.
Referenced by CTF::Typ_Idx_Tensor< dtype_C >::operator=().
void CTF::Idx_Tensor::operator= | ( | Idx_Tensor const & | B | ) |
Definition at line 177 of file idx_tensor.cxx.
References CTF_int::algstrct::addid(), execute(), CTF::global_schedule, CTF_int::algstrct::has_mul(), CTF_int::algstrct::mulid(), parent, CTF_int::algstrct::safecopy(), CTF_int::Term::scale, CTF_int::tensor::set_zero(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator= | ( | double | scl | ) |
Definition at line 218 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator= | ( | int64_t | scl | ) |
Definition at line 224 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
void CTF::Idx_Tensor::operator= | ( | int | scl | ) |
Definition at line 229 of file idx_tensor.cxx.
References execute(), get_uniq_inds(), Idx_Tensor(), and CTF_int::Term::sr.
|
virtual |
figures out what world this term lives on
brief TODO A -> A * B^-1 param[in] B brief execute ips into output with scale beta
Implements CTF_int::Term.
Definition at line 172 of file idx_tensor.cxx.
References parent, and CTF_int::tensor::wrld.
Referenced by estimate_time(), and execute().
char* CTF::Idx_Tensor::idx_map |
Definition at line 18 of file idx_tensor.h.
Referenced by CTF_int::contract_down_terms(), CTF_int::Unifun_Term::estimate_time(), CTF_int::Bifun_Term::estimate_time(), estimate_time(), CTF_int::Sum_Term::estimate_time(), CTF_int::Contract_Term::estimate_time(), CTF_int::Unifun_Term::execute(), CTF_int::Bifun_Term::execute(), execute(), CTF_int::Sum_Term::execute(), CTF_int::Contract_Term::execute(), CTF_int::get_full_intm(), get_uniq_inds(), Idx_Tensor(), CTF_int::endomorphism::operator()(), and ~Idx_Tensor().
int CTF::Idx_Tensor::is_intm |
Definition at line 19 of file idx_tensor.h.
Referenced by CTF_int::get_full_intm(), Idx_Tensor(), and ~Idx_Tensor().
CTF_int::tensor* CTF::Idx_Tensor::parent |
Definition at line 17 of file idx_tensor.h.
Referenced by ccsd(), CTF_int::contract_down_terms(), CTF_int::Unifun_Term::estimate_time(), CTF_int::Bifun_Term::estimate_time(), estimate_time(), CTF_int::Sum_Term::estimate_time(), CTF_int::Contract_Term::estimate_time(), CTF_int::Unifun_Term::execute(), CTF_int::Bifun_Term::execute(), execute(), CTF_int::Sum_Term::execute(), CTF_int::Contract_Term::execute(), CTF_int::get_full_intm(), get_uniq_inds(), Idx_Tensor(), CTF_int::endomorphism::operator()(), CTF_int::tensor_name_less::operator()(), operator=(), CTF::Schedule::partition_and_execute(), where_am_i(), and ~Idx_Tensor().