Skip to content

Commit

Permalink
fixing compress for functions with only the root node
Browse files Browse the repository at this point in the history
  • Loading branch information
fbischoff committed Sep 27, 2023
1 parent 04cca03 commit 03ad53b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/madness/mra/mraimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3213,10 +3213,21 @@ template <typename T, std::size_t NDIM>
return woT::task(world.rank(),&implT::compress_op, key, v, nonstandard1);
}
else {
Future<coeffT > result(node.coeff());
if (!keepleaves) node.clear_coeff();
node.set_dnorm(0.0);
return result;
// special case: tree has only root node: keep sum coeffs and make zero diff coeffs
if (key.level()==0) {
// if (0) {
Future<coeffT > result(node.coeff());
coeffT sdcoeff(cdata.v2k,this->get_tensor_type());
sdcoeff(cdata.s0)+=node.coeff();
node.coeff()=sdcoeff;
node.set_dnorm(0.0);
return result;
} else {
Future<coeffT > result(node.coeff());
if (!keepleaves) node.clear_coeff();
node.set_dnorm(0.0);
return result;
}
}
}

Expand Down

0 comments on commit 03ad53b

Please sign in to comment.