6 #include "../tensor/untyped_tensor.h" 13 template<
typename dtype=
double>
16 template <
typename dtype>
27 template<
typename dtype=
double>
57 bool operator<(Pair<dtype> other)
const {
63 template<
typename dtype>
73 template <
typename dtype=
double>
95 char const * name=NULL,
114 char const * name=NULL,
130 char const * name=NULL,
150 char const * name=NULL,
169 char const * name=NULL,
201 int const * new_sym);
233 char const * name=NULL,
260 char const * name=NULL,
277 void read(int64_t npair,
289 void read(int64_t npair,
290 int64_t
const * global_idx,
300 void read(int64_t npair,
314 void read(int64_t npair,
317 int64_t
const * global_idx,
328 void get_local_data(int64_t * npair,
329 int64_t ** global_idx,
331 bool nonzeros_only=
false,
332 bool unpack_sym=
false)
const;
345 void read_local(int64_t * npair,
346 int64_t ** global_idx,
348 bool unpack_sym=
false)
const;
357 void get_local_pairs(int64_t * npair,
359 bool nonzeros_only=
false,
360 bool unpack_sym=
false)
const;
370 void read_local(int64_t * npair,
372 bool unpack_sym=
false)
const;
380 void get_all_data(int64_t * npair,
390 void read_all(int64_t * npair,
399 int64_t read_all(
dtype * data,
bool unpack=
false);
411 void write(int64_t npair,
412 int64_t
const * global_idx,
420 void write(int64_t npair,
431 void write(int64_t npair,
434 int64_t
const * global_idx,
444 void write(int64_t npair,
461 void contract(
dtype alpha,
480 void contract(
dtype alpha,
545 dtype * get_mapped_data(
char const * idx,
558 void write(
char const * idx,
599 int const * ends)
const;
609 int64_t corner_end)
const;
622 World * oworld)
const;
635 World * oworld)
const;
649 void slice(
int const * offsets,
653 int const * offsets_A,
668 void slice(int64_t corner_off,
672 int64_t corner_off_A,
673 int64_t corner_end_A,
692 int *
const * perms_A,
709 void permute(
int *
const * perms_B,
728 void sparsify(
dtype threshold,
736 void sparsify(std::function<
bool(
dtype)> filter);
744 void read_sparse_from_file(
const char * fpath,
bool with_vals=
true);
752 void write_sparse_to_file(
const char * fpath,
bool with_vals=
true);
821 void norm1(
double & nrm);
826 void norm2(
double & nrm);
831 void norm_infty(
double & nrm);
838 dtype * get_raw_data(int64_t * size)
const;
845 const dtype * raw_data(int64_t * size)
const;
854 void get_max_abs(
int n,
874 void fill_sp_random(
dtype rmin,
dtype rmax,
double frac_sp);
890 void set_name(
char const * name);
914 void print(FILE * fp,
dtype cutoff)
const;
915 void print(FILE * fp = stdout)
const;
924 void compare(
const Tensor<dtype>& A, FILE * fp = stdout,
double cutoff = -1.0);
void permute(int order, int const *perm, int *arr)
permute an array
OP
reduction types for tensor data deprecated types: OP_NORM1=OP_SUMABS, OP_NORM2=call norm2()...
custom scalar function on tensor: e.g. A["ij"] = f(A["ij"])
def sum(tensor, init_A, axis=None, dtype=None, out=None, keepdims=None)
dtype d
tensor value associated with index
Ring class defined by a datatype and addition and multiplicaton functions addition must have an ident...
Pair()
default constructor
custom bivariate function on two tensors: e.g. C["ij"] = f(A["ik"],B["kj"])
an instance of the CTF library (world) on a MPI communicator
int64_t k
key, global index [i1,i2,...] specified as i1+len[0]*i2+...
dtype norm2()
computes the frobenius norm of the tensor (needs sqrt()!)
index-value pair used for tensor data input
custom function f : X -> Y to be applied to tensor elemetns: e.g. B["ij"] = f(A["ij"]) ...
a sparse subset of a tensor
dtype norm_infty()
finds the max absolute value element of the tensor
Pair(int64_t k_, dtype d_)
constructor builds pair
algstrct (algebraic structure) defines the elementwise operations computed in each tensor contraction...
internal distributed tensor class
dtype norm1()
computes the entrywise 1-norm of the tensor
an instance of a tensor within a CTF world
bool comp_pair(Pair< dtype > i, Pair< dtype > j)