5 #include "../summation/summation.h" 84 const char * idx_map_,
118 std::map<tensor*, tensor*>* remap) :
Term(other.
sr) {
119 if (other.
parent == NULL){
126 typename std::map<CTF_int::tensor*, CTF_int::tensor*>::iterator
it = remap->find(
parent);
127 assert(it != remap->end());
173 if (
parent == NULL)
return NULL;
179 std::cout <<
"op= tensor" << std::endl;
277 if (ts.wrld->rank == 0) ts.sr->safecopy(data,
scale);
312 if (
parent == NULL)
return std::vector<char>();
313 std::set<char> uniq_inds;
317 return std::vector<char>(uniq_inds.begin(), uniq_inds.end());
void get_raw_data(char **data, int64_t *size) const
get raw data pointer without copy WARNING: includes padding
a term is an abstract object representing some expression of tensors
void operator+=(double scl)
virtual void execute(CTF::Idx_Tensor output) const =0
evalues the expression, which just scales by default
void safecopy(char *&a, char const *b) const
copies element b to element a, , with checks for NULL and alloc as necessary
void execute(bool run_diag=false)
run summation
void * alloc(int64_t len)
alloc abstraction
virtual char const * addid() const
MPI datatype for pairs.
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
A tensor operation, containing all the data (op, lhs, rhs) required to run it. Also provides methods ...
an instance of the CTF library (world) on a MPI communicator
virtual void safemul(char const *a, char const *b, char *&c) const
c = a*b, with NULL treated as mulid
int order
number of tensor dimensions
double estimate_time()
predicts execution time in seconds using performance models
CTF::World * wrld
distributed processor context on which tensor is defined
virtual bool has_mul() const
virtual Term * clone(std::map< tensor *, tensor * > *remap=NULL) const =0
base classes must implement this copy function to retrieve pointer
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
virtual void cast_int(int64_t i, char *c) const
c = &i
Idx_Tensor(CTF_int::tensor *parent_, const char *idx_map_, int copy=0)
constructor takes in a parent tensor and its indices
int set_zero()
elects a mapping and sets tensor data to zero
double estimate_time(Idx_Tensor output) const
estimates the cost of a contraction
std::vector< char > get_uniq_inds() const
find list of unique indices that are involved in this term
int cdealloc(void *ptr)
free abstraction
Idx_Tensor execute(std::vector< char > out_inds) const
evalues the expression to produce an intermediate with all expression indices remaining ...
algstrct (algebraic structure) defines the elementwise operations computed in each tensor contraction...
internal distributed tensor class
ScheduleBase * global_schedule
void operator=(CTF_int::Term const &B)
A = B, compute any operations on operand B and set.
virtual void add_operation(TensorOperationBase *op)=0
void operator-=(double scl)
class for execution distributed summation of tensors
An experession representing a contraction of a set of tensors contained in operands.
virtual void cast_double(double d, char *c) const
c = &d
virtual void safeaddinv(char const *a, char *&b) const
b = -a, with checks for NULL and alloc as necessary
virtual char const * mulid() const
identity element for multiplication i.e. 1
a tensor with an index map associated with it (necessary for overloaded operators) ...
World * where_am_i() const
figures out what world this term lives on
void operator*=(double scl)