3 #include "../shared/iter_tsr.h" 4 #include "../shared/util.h" 8 #include "../interface/idx_tensor.h" 26 for (i=0; i<order_A; i++){
27 if (idx_A[i] > dim_max) dim_max = idx_A[i];
32 std::fill((*idx_arr), (*idx_arr)+dim_max, -1);
34 for (i=0; i<order_A; i++){
35 (*idx_arr)[idx_A[i]] = i;
44 int const * edge_len_A,
46 int const * idx_map_A){
48 int idx, i, idx_max, imin, imax, iA, j, k;
49 int off_idx, sym_pass;
50 int * idx_glb, * rev_idx_map;
52 int64_t idx_A, off_lda;
55 &idx_max, &rev_idx_map);
58 memcpy(dlen_A, edge_len_A,
sizeof(
int)*order_A);
61 memset(idx_glb, 0,
sizeof(
int)*idx_max);
73 for (idx=0; idx<idx_max; idx++){
74 imin = 0, imax = INT_MAX;
78 ASSERT(idx_glb[idx] >= imin && idx_glb[idx] < imax);
82 if (idx_glb[idx] >= imax){
85 if (idx_glb[idx] != imin) {
89 if (idx == idx_max)
break;
92 if (!sym_pass)
continue;
109 int const * edge_len_A,
111 int const * idx_map_A,
114 int idx, i, idx_max, imin, imax, iA, j, k;
115 int off_idx, sym_pass;
116 int * idx_glb, * rev_idx_map;
118 int64_t idx_A, off_lda;
121 &idx_max, &rev_idx_map);
124 memcpy(dlen_A, edge_len_A,
sizeof(
int)*order_A);
127 memset(idx_glb, 0,
sizeof(
int)*idx_max);
140 for (idx=0; idx<idx_max; idx++){
141 imin = 0, imax = INT_MAX;
145 ASSERT(idx_glb[idx] >= imin && idx_glb[idx] < imax);
149 if (idx_glb[idx] >= imax){
152 if (idx_glb[idx] != imin) {
156 if (idx == idx_max)
break;
159 if (!sym_pass)
continue;
a term is an abstract object representing some expression of tensors
virtual void execute(CTF::Idx_Tensor output) const =0
evalues the expression, which just scales by default
untyped internal class for singly-typed single variable function (Endomorphism)
int sym_seq_sum_ref(char const *alpha, char const *A, algstrct const *sr_A, int order_A, int const *edge_len_A, int const *sym_A, int const *idx_map_A, char const *beta, char *B, algstrct const *sr_B, int order_B, int const *edge_len_B, int const *sym_B, int const *idx_map_B)
performs symmetric contraction with unblocked reference kernel
void inv_idx(int order_A, int const *idx_A, int order_B, int const *idx_B, int order_C, int const *idx_C, int *order_tot, int **idx_arr)
invert index map
void * alloc(int64_t len)
alloc abstraction
#define GET_MIN_MAX(__X, nr, wd)
virtual void apply_f(char *a) const
apply function f to value stored at a
class for execution distributed scaling of a tensor
int sym_seq_scl_ref(char const *alpha, char *A, algstrct const *sr_A, int order_A, int const *edge_len_A, int const *sym_A, int const *idx_map_A)
performs symmetric scaling using algstrct const * sr_A
int sym_seq_scl_cust(char const *alpha, char *A, algstrct const *sr_A, int const order_A, int const *edge_len_A, int const *sym_A, int const *idx_map_A, endomorphism const *func)
performs symmetric scaling using custom func
virtual std::vector< char > get_uniq_inds() const =0
find list of unique indices that are involved in this term
int sym_seq_sum_cust(char const *alpha, char const *A, algstrct const *sr_A, int order_A, int const *edge_len_A, int const *sym_A, int const *idx_map_A, char const *beta, char *B, algstrct const *sr_B, int order_B, int const *edge_len_B, int const *sym_B, int const *idx_map_B, univar_function const *func)
performs symmetric summation with custom elementwise function
int el_size
size of each element of algstrct in bytes
int cdealloc(void *ptr)
free abstraction
algstrct (algebraic structure) defines the elementwise operations computed in each tensor contraction...
void operator()(Term const &A) const
apply f to A
virtual void mul(char const *a, char const *b, char *c) const
c = a*b
a tensor with an index map associated with it (necessary for overloaded operators) ...