Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sander, Oliver
dune-gfe
Commits
b5c7f982
Commit
b5c7f982
authored
11 years ago
by
Oliver Sander
Committed by
sander
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
remove some unused code
[[Imported from SVN: r9408]]
parent
f622015e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/adolctest.cc
+0
-54
0 additions, 54 deletions
test/adolctest.cc
with
0 additions
and
54 deletions
test/adolctest.cc
+
0
−
54
View file @
b5c7f982
...
...
@@ -153,60 +153,6 @@ int main() {
std
::
cout
<<
std
::
endl
;
}
// Get gradient
#if 0
int n,i,j;
size_t tape_stats[STAT_SIZE];
cout << "SPEELPENNINGS PRODUCT (ADOL-C Documented Example)\n\n";
cout << "number of independent variables = ? \n";
cin >> n;
std::vector<double> xp(n);
double yp = 0.0;
std::vector<adouble> x(n);
adouble y = 1;
for(i=0; i<n; i++)
xp[i] = (i+1.0)/(2.0+i); // some initialization
trace_on(1); // tag = 1, keep = 0 by default
for(i=0; i<n; i++) {
x[i] <<= xp[i]; // or x <<= xp outside the loop
y *= x[i];
} // end for
y >>= yp;
trace_off(1);
tapestats(1,tape_stats); // reading of tape statistics
cout<<"maxlive "<<tape_stats[NUM_MAX_LIVES]<<"\n";
// ..... print other tape stats
double* g = new double[n];
gradient(1,n,xp.data(),g); // gradient evaluation
double** H = (double**) malloc(n*sizeof(double*));
for(i=0; i<n; i++)
H[i] = (double*)malloc((i+1)*sizeof(double));
hessian(1,n,xp.data(),H); // H equals (n-1)g since g is
double errg = 0; // homogeneous of degree n-1.
double errh = 0;
for(i=0; i<n; i++)
errg += fabs(g[i]-yp/xp[i]); // vanishes analytically.
for(i=0; i<n; i++) {
for(j=0; j<n; j++) {
if (i>j) // lower half of hessian
errh += fabs(H[i][j]-g[i]/xp[j]);
} // end for
} // end for
cout << yp-1/(1.0+n) << " error in function \n";
cout << errg <<" error in gradient \n";
cout << errh <<" consistency check \n";
#endif
return
0
;
}
// end main
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment