8 static double op1(
double a,
double b){
return b-b/
a; };
12 static void op2(
double a,
double &
b){ b+=
a; };
13 static double op2_t2(
double a,
double b){
return a+
b; };
14 static void op2_red(
double const *
a,
double *
b,
int n){
15 #pragma omp parallel for 16 for (
int i=0; i<n; i++){
25 MPI_Op_create([](
void *
a,
void *
b,
int * n, MPI_Datatype*){
29 for (
double sp = .005; sp<.32; sp*=2.){
47 A.
sparsify([=](
double a){
return fabs(a)<=.5*sp; });
49 G.
sparsify([=](
double a){
return fabs(a)<=.5*sp; });
50 b.
sparsify([=](
double a){
return fabs(a)<=.5*sp; });
53 B.
sparsify([=](
double a){
return fabs(a)<=.5*sp; });
54 c.
sparsify([=](
double a){
return fabs(a)<=.5*sp; });
58 k1(A[
"ik"],G[
"kj"],B[
"ij"]);
59 k1(A[
"ij"],b[
"j"],c[
"i"]);
Matrix class which encapsulates a 2D tensor.
static double op2_t2(double a, double b)
Vector class which encapsulates a 1D tensor.
an instance of the CTF library (world) on a MPI communicator
void fill_random(dtype rmin, dtype rmax)
fills local unique tensor elements to random values in the range [min,max] works only for dtype in {f...
static void op2_red(double const *a, double *b, int n)
static void op2(double a, double &b)
int rank
rank of local processor
void train_off_vec_mat(int64_t n, int64_t m, World &dw, bool sp_A, bool sp_B, bool sp_C)
void sparsify()
reduce tensor to sparse format, storing only nonzero data, or data above a specified threshold...
static double op1(double a, double b)
A Monoid is a Set equipped with a binary addition operator '+' or a custom function addition must hav...