Skip to content
Snippets Groups Projects
Commit d611b18c authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

Don't use library methods 'min' and 'max', because ADOL-C doesn't implement them in vector mode

[[Imported from SVN: r9814]]
parent 9c27ff15
No related branches found
No related tags found
No related merge requests found
...@@ -3,14 +3,6 @@ ...@@ -3,14 +3,6 @@
#include <limits> #include <limits>
adouble min_hack(const adouble& a, const adouble& b) {
return fmin(a,b);
}
adouble max_hack(const adouble& a, const adouble& b) {
return fmax(a,b);
}
adouble sqrt_hack(adouble a) { adouble sqrt_hack(adouble a) {
return sqrt(a); return sqrt(a);
} }
...@@ -43,11 +35,13 @@ adouble acos_hack(adouble a) { ...@@ -43,11 +35,13 @@ adouble acos_hack(adouble a) {
namespace std namespace std
{ {
adouble min(adouble a, adouble b) { adouble min(adouble a, adouble b) {
return min_hack(a,b); // Do not use 'min', because ADOL-C lacks support for that in vector-mode
return (a + b - abs_hack(a - b))*0.5;
} }
adouble max(adouble a, adouble b) { adouble max(adouble a, adouble b) {
return max_hack(a,b); // Do not use 'max', because ADOL-C lacks support for that in vector-mode
return - min(-a,-b);
} }
adouble sqrt(adouble a) { adouble sqrt(adouble a) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment