Commit 25e1ca75 authored by Mike Kremer's avatar Mike Kremer
Browse files

Integrated taping of functional itself.

git-svn-id: http://www.openflipper.org/svnrepo/CoMISo/trunk@183 1355f012-dd97-4b2f-ae87-10fa9f823a57
parent 327cadda
......@@ -115,30 +115,46 @@ public:
virtual double eval_f(const double* _x) {
adouble y_d = 0.0;
double y = 0.0;
trace_on(1); // Start taping
if(!function_evaluated_ || !use_tape_) {
// Fill data vector
for(int i = 0; i < n_unknowns_; ++i) {
x_d_[i] <<= _x[i];
}
adouble y_d = 0.0;
trace_on(1); // Start taping
// Fill data vector
for(int i = 0; i < n_unknowns_; ++i) {
x_d_[i] <<= _x[i];
}
// Call virtual function to compute
// functional value
y_d = evaluate(x_d_);
// Call virtual function to compute
// functional value
y_d = evaluate(x_d_);
y_d >>= y;
y_d >>= y;
trace_off();
trace_off();
#ifndef NDEBUG
tapestats(1, tape_stats_);
// Do some status output here...
#endif
function_evaluated_ = true;
} else {
double ay[1] = {0.0};
int ec = function(1, 1, n_unknowns_, const_cast<double*>(_x), ay);
#ifndef NDEBUG
tapestats(1, tape_stats_);
// Do some status output here...
std::cout << "Info: function() returned code " << ec << std::endl;
#endif
function_evaluated_ = true;
y = ay[0];
}
return y;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment