Skip to content

Commit

Permalink
Fixed a rounding issue that is causing the inverse to fail to be crea…
Browse files Browse the repository at this point in the history
…ted under certain circumstances (PyORBIT-Collaboration#52)

* modified set inverse to resolve a rounding issue that causes the inverse to fail to be created

* updated how set inverse was fixed to avoid having to check an if statement each time
  • Loading branch information
khilde authored Aug 31, 2021
1 parent 8018344 commit 7916ee3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/OU_Function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,11 @@ int Function::setInverse(Function* f_inv)
//create x-arr if it is not ready
if(f_inv->getSize() < 2){
f_inv->clean();
for(int i = 0; i < size; i++){
double xx = getMinY() + i*(getMaxY() - getMinY())/(size - 1);
for(int i = 0; i < size-1; i++){
double xx = getMinY() + i*(getMaxY() - getMinY())/(size - 1);
f_inv->add(xx,0.);
}
f_inv->add(getMaxY(),0.);
f_inv->setConstStep(1);
}

Expand Down

0 comments on commit 7916ee3

Please sign in to comment.