Skip to content

Commit

Permalink
permitted handling of userdefined elementwise functions with non-iden…
Browse files Browse the repository at this point in the history
…tity alpha, since this is needed when scaling for symmetric permutations
  • Loading branch information
solomonik committed Feb 10, 2016
1 parent e2c9991 commit 2dde4d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions examples/dft.cxx
Expand Up @@ -47,6 +47,8 @@ int test_dft(int64_t n,
std::complex<double> (0.0, 0.0), "ik");*/
DFT["ik"] = .5*DFT["ij"]*IDFT["jk"];

Scalar< std::complex<double> > ss(wrld);
ss[""] = ((Function< std::complex<double>, std::complex<double>, std::complex<double> >)([](std::complex<double> a, std::complex<double> b){ return a+b; }))(DFT["ij"],DFT["ij"]);

DFT.read_local(&np, &idx, &data);
int pass = 1;
Expand Down
16 changes: 9 additions & 7 deletions src/contraction/sym_seq_ctr.cxx
Expand Up @@ -248,18 +248,20 @@ printf("HERE1\n");
}
CTF_FLOPS_ADD(2*(imax-imin));
} else {
ASSERT(0);
assert(0);
//ASSERT(0);
//assert(0);
//printf("HERTE alpha = %d\n",*(int*)alpha);
for (int i=imin; i<imax; i++){
char tmp[sr_C->el_size];
sr_C->mul(A+offsets_A[0][i],
func->apply_f(A+offsets_A[0][i],
B+offsets_B[0][i],
tmp);
sr_C->mul(tmp,
alpha,
tmp);
func->acc_f(tmp,
B+offsets_B[0][i],
C+offsets_C[0][i],
sr_C);
sr_C->add(tmp,
C+offsets_C[0][i],
C+offsets_C[0][i]);
}
CTF_FLOPS_ADD(3*(imax-imin));
}
Expand Down
3 changes: 2 additions & 1 deletion src/interface/fun_term.cxx
Expand Up @@ -104,7 +104,8 @@ namespace CTF_int {
ASSERT(0);
assert(0);
}
contraction c(opA.parent, opA.idx_map, opB.parent, opB.idx_map, NULL, output.parent, output.idx_map, output.scale, func);
contraction c(opA.parent, opA.idx_map, opB.parent, opB.idx_map, output.sr->mulid(), output.parent, output.idx_map, output.scale, func);
//contraction c(opA.parent, opA.idx_map, opB.parent, opB.idx_map, NULL, output.parent, output.idx_map, output.scale, func);
c.execute();
// if (scl != NULL) cdealloc(scl);
}
Expand Down

0 comments on commit 2dde4d4

Please sign in to comment.