Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
fun_term.h
Go to the documentation of this file.
1 #ifndef __CUST_TERM_H__
2 #define __CUST_TERM_H__
3 
4 #include "term.h"
5 
6 namespace CTF_int {
7  class univar_function;
8  class bivar_function;
9 }
10 
11 namespace CTF_int {
12  class Unifun_Term : public Term{
13  public:
14  Term * A;
16 
17  Unifun_Term(Term * A,
18  univar_function const * func);
19 
20  Unifun_Term(Unifun_Term const & other,
21  std::map<tensor*, tensor*>* remap=NULL);
22 
23  ~Unifun_Term();
24 
25  Term * clone(std::map<tensor*, tensor*>* remap = NULL) const;
26 
27  void execute(CTF::Idx_Tensor output) const;
28 
29  CTF::Idx_Tensor execute(std::vector<char> out_inds) const;
30 
31  CTF::Idx_Tensor estimate_time(double & cost, std::vector<char> out_inds) const;
32 
33  double estimate_time(CTF::Idx_Tensor output) const;
34 
35  std::vector<char> get_uniq_inds() const;
36 
37  void get_inputs(std::set<CTF::Idx_Tensor*, tensor_name_less >* inputs_set) const;
38 
39  CTF::World * where_am_i() const;
40  };
41 
42  class Bifun_Term : public Term {
43  public:
44  Term * A;
45  Term * B;
47 
48  Bifun_Term(Term * A,
49  Term * B,
50  bivar_function const * func);
51 
52  Bifun_Term(Bifun_Term const & other,
53  std::map<tensor*, tensor*>* remap=NULL);
54 
55  ~Bifun_Term();
56 
57  Term * clone(std::map<tensor*, tensor*>* remap = NULL) const;
58 
59  void execute(CTF::Idx_Tensor output) const;
60 
61  CTF::Idx_Tensor execute(std::vector<char> out_inds) const;
62 
63  CTF::Idx_Tensor estimate_time(double & cost, std::vector<char> out_inds) const;
64 
65  double estimate_time(CTF::Idx_Tensor output) const;
66 
67  std::vector<char> get_uniq_inds() const;
68 
69  void get_inputs(std::set<CTF::Idx_Tensor*, tensor_name_less >* inputs_set) const;
70 
71  CTF::World * where_am_i() const;
72  };
73 
74 }
75 
76 #endif
a term is an abstract object representing some expression of tensors
Definition: term.h:33
void execute(CTF::Idx_Tensor output) const
evalues the expression, which just scales by default
Definition: fun_term.cxx:33
bivar_function const * func
Definition: fun_term.h:46
int bivar_function(int n, World &dw)
CTF::World * where_am_i() const
figures out what world this term lives on
Definition: fun_term.cxx:66
untyped internal class for doubly-typed univariate function
Definition: sum_tsr.h:14
an instance of the CTF library (world) on a MPI communicator
Definition: world.h:19
untyped internal class for triply-typed bivariate function
Definition: ctr_comm.h:16
univar_function const * func
Definition: fun_term.h:15
void get_inputs(std::set< CTF::Idx_Tensor *, tensor_name_less > *inputs_set) const
appends the tensors this depends on to the input set
Definition: fun_term.cxx:62
CTF::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 ...
Definition: fun_term.cxx:45
Term * clone(std::map< tensor *, tensor * > *remap=NULL) const
base classes must implement this copy function to retrieve pointer
Definition: fun_term.cxx:21
int univar_function(int n, World &dw)
Unifun_Term(Term *A, univar_function const *func)
Definition: fun_term.cxx:11
std::vector< char > get_uniq_inds() const
find list of unique indices that are involved in this term
Definition: fun_term.cxx:58
a tensor with an index map associated with it (necessary for overloaded operators) ...
Definition: idx_tensor.h:15