C ALGORITHM 755, COLLECTED ALGORITHMS FROM ACM. C THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE, C VOL. 22, NO. 2, June, 1996, P. 131--167. C C This file contains 5 files separated by lines of the form C C*** filename C C The filenames in this file are: C C README dex.shar exa.shar C install.shar src.shar C C*** README -------------------------------------------------------------- ADOL-C version 1.6 as of January 1, 1995 -------------------------------------------------------------- ADOL-C = Automatic Differentiation by Overloading in C/C++ This directory contains the subdirectories SRC (ADOL-C source and examples in SRC/EXA and SRC/DEX ) To run ADOL-C you should also untar the file adol-c.ins.tar consisting of UNIX scripts and makefiles into this directory. The tarfile adol-c.doc.tar can be handled separately. C*** dex.shar #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'README' <<'END_OF_FILE' X -------------------------------------------------------------- X ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X XThe directory */SRC/DEX contains the files Xdetexam.c makefile scalexam.c Xgaussexam.c odexam.c vectexam.c X XTo compile them use the make command after calling ???install. XSee */INS/README for details. END_OF_FILE if test 395 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi chmod +x 'README' # end of 'README' fi if test -f 'detexam.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'detexam.c'\" else echo shar: Extracting \"'detexam.c'\" \(2116 characters\) sed "s/^X//" >'detexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X File detexam.c of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X detexam.c contains the determinant example described in the X manual X*/ X X#include "adouble.h" X#include "adutils.h" X#include X Xadouble** A; // A is an n x n matrix Xint n; // k <= n is the order Xadouble det(int k, int m) { // of the submatrix X if(m == 0 ) return 1.0 ; // its column indices X else { // are encoded in m. X adouble* pt = A[k-1]; X adouble t =0 ; X int s, p =1; X if (k%2) s = 1; else s = -1; X for(int i=0;i= p ) { X t += *pt*s*det(k-1, m-p); // Recursive call to det. X s = -s; } X ++pt; X p = p1; } X return t; } X} X Xvoid main() { X int i, m=1,tag=1,keep=1; X cout << "order of matrix = ? \n"; // Select matrix size X cin >> n; X A = new adouble*[n]; // or adoublem A(n,n); X trace_on(tag,keep); // tag=1=keep X double detout=0.0 , diag = 1.0; // here keep the intermediates for X for (i=0; i>= detout; // Actual function call. X printf("\n %f - %f = %f (should be 0)\n",detout,diag,detout-diag); X trace_off(); X double u[1]; X u[0] = 1.0; X double* B = new double[n*n]; X reverse(tag,1,n*n,1,u,B); X cout <<" \n first base? : "; X for (i=0;i'gaussexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X File gaussexam.c of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X gaussexam.c contains the example with gaussian elimination X described in the manual X*/ X X#include X#include X#ifdef __GNUG__ X#include X#else X#include X#endif X X#include "adouble.h" // These includes provide the compiler with X#include "adutils.h" // definitions and utilities for `adoubles'. X Xvoid gausselim(int n, adoublem& A, adoublev& bv) X{ X along i; // active integer declaration X adoublev temp(n); // active vector declaration X adouble r,rj,temps; X int j,k; X for (k=0; k < n; k++) // elimination loop X { X i = k; X r = fabs(A[k][k]); // initial pivot size X for (j=k+1; j= 0; k--) // backsubstitution X temp[k] = (bv[k]-(A[k]*temp))/A[k][k]; X bv=temp; X return; X} // end gausselim X Xvoid main() X{ X int i,j; X short tag = 1; X int dum=1; X const int size=5; X const int indep=size*size+size; X const int depen=size; X double* arguments=new double[indep]; X double* taylors=new double[depen]; X double yp[size],xp[size*size+size]; // passive variable X double **A_1, **A_2, *a_1, *a_2, *b_1, *b_2; X A_1=(double**)malloc(size*sizeof(double*)); X A_2=(double**)malloc(size*sizeof(double*)); X a_1=(double*)malloc(size*sizeof(double)); X a_2=(double*)malloc(size*sizeof(double)); X b_1=(double*)malloc(size*sizeof(double)); X b_2=(double*)malloc(size*sizeof(double)); X for(i=0;i>= yp; X trace_off(); X forward(tag,depen,indep,0,1,arguments,taylors); X cout << "Compare the calculated solution components of the\nforward sweep and the direct evaluation: forward - direct = 0 ?\n"; X for(i=0;i'odexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X File odeexam.c of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X odeexam.c contains the ODE example described in the manual X*/ X X#include "adouble.h" X#include "adutils.h" X#include X Xvoid tracerhs(short int tag, double* py, double* pyprime) { Xadoublev y(3); //This time we left the parameters Xadoublev yprime(3); // passive and use the vector types. Xtrace_on(tag); Xy <<= py; //Initialize and mark independents Xyprime[0] = -sin(y[2]) + 1e8*y[2]*(1-1/y[0]); Xyprime[1] = -10*y[0] + 3e7*y[2]*(1-y[1]); Xyprime[2] = -yprime[0] - yprime[1]; Xyprime >>= pyprime; //Mark and pass dependents Xtrace_off(tag); X} // end tracerhs X Xvoid main() { Xint i,j,deg; Xint n=3; Xdouble py[3]; Xdouble pyp[3]; Xcout << "degree of Taylor series =?\n"; Xcin >> deg; Xdouble **X; XX=(double**)malloc(n*sizeof(double*)); Xfor(i=0;i'scalexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X File scalexam.c of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X scalexam.c contains the scalar example described in the X manual X*/ X X#include "adouble.h" X#include "adutils.h" X#include X Xadouble power(adouble x, int n) { Xadouble z=1; Xif (n>0) { // Recursion and branches X int nh =n/2; // that do not depend on X z = power(x,nh); // adoubles are fine !!!! X z *= z; X if (2*nh != n) X z *= x; X return z; X} // end if Xelse { X if (n==0) // The local adouble z dies X return z; // as it goes out of scope. X else X return 1/power(x,-n); X} // end else X} // end power X Xvoid main() { Xint i,tag=1; Xcout<<"monomial degree=? \n"; // Input the desired degree. Xint n; cin >> n; X/*Allocations and Initializations*/ Xdouble* Y[1]; X*Y = new double[n+2]; Xdouble* X[1]; // Allocate passive variables with X*X = new double[n+4]; // extra dimension for derivatives XX[0][0] = 0.5; // function value = 0. coefficient XX[0][1] = 1.0; // first derivative = 1. coefficient Xfor(i=0; i < n+2; i++) X X[0][i+2]=0; // further coefficients. Xdouble* Z[1]; // used for checking consistency X*Z = new double[n+2]; // between forward and reverse Xadouble y,x; // Declare active variables X/*Beginning of Active Section*/ Xtrace_on(1); // tag = 1 and keep = 0 Xx <<= X[0][0]; // Only one independent var Xy = power(x,n); // Actual function call Xy >>= Y[0][0]; // Only one dependent adouble Xtrace_off(); // No global adouble has died X/*End of Active Section */ Xdouble u[1]; // weighting vector Xu[0]=1; // for reverse call Xfor(i=0; i < n+2; i++) { // Note that keep = i+1 in call X forward(tag,1,1,i,i+1,X,Y); // Evaluate the i-the derivative X if (i==0) X cout << Y[0][i] << " - " << value(y) << " = " << Y[0][i]-value(y) X << " (should be 0)\n"; X else X cout << Y[0][i] << " - " << Z[0][i] << " = " << Y[0][i]-Z[0][i] X << " (should be 0)\n"; X reverse(tag,1,1,i,u,Z); // Evaluate the (i+1)-st deriv. X Z[0][i+1]=Z[0][i]/(i+1); // Scale derivative to Taylorcoeff. X} // end for X} // end main X END_OF_FILE if test 2566 -ne `wc -c <'scalexam.c'`; then echo shar: \"'scalexam.c'\" unpacked with wrong size! fi chmod +x 'scalexam.c' # end of 'scalexam.c' fi if test -f 'vectexam.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'vectexam.c'\" else echo shar: Extracting \"'vectexam.c'\" \(1835 characters\) sed "s/^X//" >'vectexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X File vectexam.c of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X vectexam.c contains the vector example described in the X manual X*/ X X#include "adouble.h" X#include "adutils.h" X#include X#include X Xvoid main() { Xint n,i,j,counts[12]; Xcout << "number of independent variables = ? \n"; Xcin >> n; Xdouble* xp = new double[n]; Xadouble* x = new adouble[n]; // or: adoublev x(n); Xfor(i=0;i>= yp; Xdelete[] x; // Not needed if x adoublev Xtrace_off(); Xtapestats(1,counts); // Reading of tape statistics Xcout<<"maxlive "<j) // lower half of hessian X errh += fabs(H[i][j]-g[i]/xp[j]); X } // end for X} // end for Xcout << yp-1/(1.0+n) << " error in function \n"; Xcout << errg <<" error in gradient \n"; Xcout << errh <<" consistency check \n"; X} // end main X X END_OF_FILE if test 1835 -ne `wc -c <'vectexam.c'`; then echo shar: \"'vectexam.c'\" unpacked with wrong size! fi chmod +x 'vectexam.c' # end of 'vectexam.c' fi echo shar: End of shell archive. exit 0 C*** exa.shar #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'README' <<'END_OF_FILE' X -------------------------------------------------------------- X ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X XThe directory */SRC/EXA contains the files Xdetexam.c helm-auto-exam.c makefile scalexam.c Xeutroph.c helm-diff-exam.c od2exam.c shuttlexam.c Xgaussexam.c helm-vect-exam.c odexam.c vectexam.c X XTo compile them use the make command after calling ???install. XRead */INS/README for details. X XSome of the examples are extended versions of the documented Xexamples in */SRC/DEX. Others provide timing and correctness Xinformation or use some of the more specialized capabilities. END_OF_FILE if test 700 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi chmod +x 'README' # end of 'README' fi if test -f 'detexam.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'detexam.c'\" else echo shar: Extracting \"'detexam.c'\" \(3421 characters\) sed "s/^X//" >'detexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include "adouble.h" X#include "adutils.h" X X#ifdef __GNUG__ X#include X#include X#else X#include X#endif X X#include X#include X#include Xint n,it; Xdouble** PA; Xdouble pdet(int k, int m) X { X if(m == 0 ) return 1.0 ; X else X { X double* pt = PA[k-1]; X double t=0 ; X int p =1; X int s; X if (k%2) s = 1; X else s = -1; X for(int i=0;i= p ) X { X t += *pt*s*pdet(k-1, m-p); X s = -s; X } X ++pt; X p = p1; X } X return t; X } X } X Xadouble** A; Xadouble det(int k, int m) X { X if(m == 0 ) return 1.0 ; X else X { X adouble* pt = A[k-1]; X adouble t=0 ; X int p =1; X int s; X if (k%2) s = 1; X else s = -1; X for(int i=0;i= p ) X { X t += *pt*s*det(k-1, m-p); X s = -s; X } X ++pt; X p = p1; X } X return t; X } X } Xvoid main() X{ X int i; X int tag = 1; X printf("order of matrix = ? \n",n); X scanf("%d",&n); X A = new adouble*[n]; X PA = new double*[n]; X int n2 =n*n; X double* a = new double[n2]; X double diag; X diag = 0; X int m=1; X double t00 = myclock(); X trace_on(tag,m); X int loc =0; X for (i=0; i>= detout; X printf("\n %f =? %f should be the same \n",detout,diag); X trace_off(); X double t12 = myclock(); X int itu; itu=8-n; itu=itu*itu*itu*itu; X itu = itu > 0 ? itu : 1; X double raus; X for(it = 0; it < itu; it++) X raus = pdet(n,m-1); X double t13 = myclock(); X double rtu = itu/(t13-t12); X// cout << itu <<" reps -> time "<< 1/rtu <<"\n"; X// cout << t0-tm1+t1-t01 <<"= file time \n"; X double* B = new double[n2]; X double* detaut = new double[1]; X double t11 = myclock(); X for(it = 0; it < itu; it++) X forward(tag,1,n2,0,1,a,detaut); X double t21 = myclock(); X double u[1]; X u[0] = 1.0; X for(it = 0; it < itu; it++) X reverse(tag,1,n2,1,u,B); X double t31 = myclock(); X// for(i=0;i "<'eutroph.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include "adouble.h" X#include "adutils.h" Xvoid eutroph(unsigned short tag, double* px, double* pxp) X{ Xdouble IK=0.11 ; Xdouble FRZ=0.3 ; Xdouble EFFUZ=0.6; Xdouble PRITZ=1.0e-3; Xdouble RESP=5.0e-3; Xdouble sinK=5.0e-3; Xdouble PRITA=0.1; Xdouble RZ=1.0e-2; Xdouble K2=4.0e-2; Xdouble K3=5.0e-1; Xdouble KSP=2.0e2; Xdouble KSF=1.0; Xdouble BETA=100.0/1.25; Xdouble ALPHA=0.002; Xdouble TRZ=2; Xdouble EPSP = 0.4; Xdouble FI1 = 230.4; Xdouble FI3=282.8; Xdouble FI4=127.5; Xdouble FI5=141.9; Xdouble p = 40.0; Xdouble DEPTH = 45; X/************* fix controls ********/ Xdouble PRFOS = 0.5*p; Xdouble M = 0.1; Xdouble ZMIX = (45+RZ)/2; Xdouble QIV=0.297E-02/3; X/******initialize adoubles *************/ Xadouble x[5],xp[5]; Xint i; Xtrace_on(tag); Xfor(i=0;i<4;i++) X x[i]<<= px[i]; Xadouble T; XT <<= px[4]; Xxp[4] = 1; Xdouble tdum=0.0; Xadouble TEMP=9.5+7.9*sin(T+FI1); Xadouble FOTOP = 12.0+4.19*sin(T+280.0); Xadouble I=229.0+215.0*sin(T+FI3)+15.3*sin(2.0*T+FI4)+ 21.7*sin(3.0*T+FI5); Xadouble PIDI=.8+.25*cos(T)-.12*cos(2.*T); Xdouble MORITZ = 0.075; Xdouble Q = 0.786E6; Xdouble VND = 0.265E9; Xdouble V = VND; Xif (T<72) I *= 0.603; Xadouble EPS = ALPHA * x[0] + x[3] + EPSP; Xadouble temp = I * exp(-EPS*ZMIX); Xadouble temp2 = 2*IK*FOTOP; Xadouble GROW; XGROW = 1.2*FOTOP/EPS/ZMIX * (1.333 * atan ( I / temp2 ) X -IK*FOTOP / I * log( 1 + pow( (I /temp2 ),2) ) X -1.333 * atan ( temp / temp2) X +IK*FOTOP/temp* log( 1+pow(temp/temp2, 2) )) * x[2] /(KSF+x[2]) X * 0.366 * pow(K2,0.52) * exp(0.09*TEMP) * pow(x[0],(1-0.52)); Xxp[0] = GROW - RESP * TEMP * x[0] - FRZ * x[0] * x[1] - sinK * PIDI * x[0] X + (PRITA - x[0]) * Q/VND; Xxp[1] = FRZ * x[0] / K2 * x[1] / 1000 * EFFUZ*KSP / KSP+x[0] X - RZ * x[1] - MORITZ * x[1] + (PRITZ - x[1] ) * Q/V; Xxp[2] = K3 * (-GROW + RESP * TEMP * x[0] + FRZ * x[0] * x[1] * X (1 - EFFUZ*KSP /(KSP+x[0]) ) + RZ * K2 * 1000 * X x[1] + MORITZ * K2 * 1000 * x[1] ) + (PRFOS - x[2])* Q/V; Xxp[3] = (- x[3] * Q + BETA * M / TRZ)/VND; Xfor (i=0;i<4;i++) X xp[i] >>= pxp[i]; Xxp[4] >>= tdum; Xtrace_off(); X} X Xvoid eutroph(double* px, double* pxp) X{ Xdouble IK=0.11 ; Xdouble FRZ=0.3 ; Xdouble EFFUZ=0.6; Xdouble PRITZ=1.0e-3; Xdouble RESP=5.0e-3; Xdouble sinK=5.0e-3; Xdouble PRITA=0.1; Xdouble RZ=1.0e-2; Xdouble K2=4.0e-2; Xdouble K3=5.0e-1; Xdouble KSP=2.0e2; Xdouble KSF=1.0; Xdouble BETA=100.0/1.25; Xdouble ALPHA=0.002; Xdouble TRZ=2; Xdouble EPSP = 0.4; Xdouble FI1 = 230.4; Xdouble FI3=282.8; Xdouble FI4=127.5; Xdouble FI5=141.9; Xdouble p = 40.0; Xdouble DEPTH = 45; X/************* fix controls ********/ Xdouble PRFOS = 0.5*p; Xdouble M = 0.1; Xdouble ZMIX = (45+RZ)/2; Xdouble QIV=0.297E-02/3; X/******initialize doubles *************/ Xdouble x[5],xp[5]; Xint i; Xfor(i=0;i<4;i++) X x[i]= px[i]; Xdouble T; XT = px[4]; Xxp[4] = 1; Xdouble TEMP=9.5+7.9*sin(T+FI1); Xdouble FOTOP = 12.0+4.19*sin(T+280.0); Xdouble I=229.0+215.0*sin(T+FI3)+15.3*sin(2.0*T+FI4)+ 21.7*sin(3.0*T+FI5); Xdouble PIDI=.8+.25*cos(T)-.12*cos(2.*T); Xdouble MORITZ = 0.075; Xdouble Q = 0.786E6; Xdouble VND = 0.265E9; Xdouble V = VND; Xif (T<72) I *= 0.603; Xdouble EPS = ALPHA * x[0] + x[3] + EPSP; Xdouble temp = I * exp(-EPS*ZMIX); Xdouble temp2 = 2*IK*FOTOP; Xdouble GROW; XGROW = 1.2*FOTOP/EPS/ZMIX * (1.333 * atan ( I / temp2 ) X -IK*FOTOP / I * log( 1 + pow( (I /temp2 ),2) ) X -1.333 * atan ( temp / temp2) X +IK*FOTOP/temp* log( 1+pow(temp/temp2, 2) )) * x[2] /(KSF+x[2]) X * 0.366 * pow(K2,0.52) * exp(0.09*TEMP) * pow(x[0],(1-0.52)); Xxp[0] = GROW - RESP * TEMP * x[0] - FRZ * x[0] * x[1] - sinK * PIDI * x[0] X + (PRITA - x[0]) * Q/VND; Xxp[1] = FRZ * x[0] / K2 * x[1] / 1000 * EFFUZ*KSP / KSP+x[0] X - RZ * x[1] - MORITZ * x[1] + (PRITZ - x[1] ) * Q/V; Xxp[2] = K3 * (-GROW + RESP * TEMP * x[0] + FRZ * x[0] * x[1] * X (1 - EFFUZ*KSP /(KSP+x[0]) ) + RZ * K2 * 1000 * X x[1] + MORITZ * K2 * 1000 * x[1] ) + (PRFOS - x[2])* Q/V; Xxp[3] = (- x[3] * Q + BETA * M / TRZ)/VND; Xfor (i=0;i<5;i++) X pxp[i] = xp[i]; X} END_OF_FILE if test 4136 -ne `wc -c <'eutroph.c'`; then echo shar: \"'eutroph.c'\" unpacked with wrong size! fi chmod +x 'eutroph.c' # end of 'eutroph.c' fi if test -f 'gaussexam.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'gaussexam.c'\" else echo shar: Extracting \"'gaussexam.c'\" \(8616 characters\) sed "s/^X//" >'gaussexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include X#include X X#ifdef __GNUG__ X#include X#else X#include X#endif X#include "usrparms.h" Xextern "C" { X#include "taputil3.h" X} X#include "adouble.h" // These includes provide the compiler with X#include "adutils.h" // definitions and utilities for `adoubles'. X Xvoid gausselim(int n, adoublem& A, adoublev& bv) X{ X along i; X adoublev temp(n); X adouble r,rj,temps; X int j,k,ik; X for (k=0; k < n; k++) X { X for(j=0;jr),j); X condassign(r,(rj >r),rj); X } // endfor X cout << i << "index \n"; X temp = A[i]; X A[i] = A[k]; X A[k] = temp; /* exchange of rows */ X temps = bv[i]; X bv[i]=bv[k]; X bv[k]=temps; X if (!value(A[k][k])) X { X cout << " Matrix does not have full rank!\n"; X exit(-1); X } // endif X cout << "changed rows: ---------------------\n"; X for (ik=0; ik < n; ik++) X { X for(j=0;j= 0; k--) X { X temp[k] = (bv[k]-(A[k]*temp))/A[k][k]; X cout << value(temp[k]) << "\n"; X } X bv=temp; X return; X} // end gausselim X X Xvoid main() X{ X int i,j,k,l=1,ok=1; X short tag = 1; X double epsilon=0.0000000001; // max. allowed difference between results X int dum=1; X const int max_deg=4; // maximal order of derivation X const int tayl_num=2; // Number of taylor series X int pages=1; // for eventually writing the tape to a file X const int size=5; X const int indep=size*size+size; X const int depen=size; X const int laglength=2; X double*lagras=new double[depen]; X for(i=0;i>= yp; X trace_off(); X int buf_size,maxlive,deaths; X int tape_stats[11]; /* tape stats */ X tapestats(tag,tape_stats); X X maxlive = tape_stats[2]; X deaths = tape_stats[3]; X buf_size = tape_stats[4]; X X // initialization for Forward - testing +++++++++++++++++++++++++++++++++++++ X X basepoint=xp; X for(i=0;iepsilon) X { X cout << "difference is here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"; X ok=0; X } X for(k=0;kepsilon) X { X cout << "difference is here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"; X ok=0; X } // endif X } // endfor X } // endfor X } // endfor X X // some preparation for the 4 different reverse modes: ----------------- X hos_forward(tag,depen,indep,max_deg,max_deg,scalargs[0],scalres[0]); X cout << "reverse sweeps will be done for the first taylor serie only\n"; X hos_reverse(tag,depen,indep,max_deg-1,lagras,resultshos); X hov_reverse(tag,depen,indep,max_deg-1,laglength,lagrav,resultshov,nonzero); X hos_forward(tag,depen,indep,max_deg,1,scalargs[0],scalres[0]); X fos_reverse(tag,depen,indep,lagras,resultsfos); X fov_reverse(tag,depen,indep,laglength,lagrav,resultsfov); X // output X for (i=0;iepsilon) || (fabs(resultshov[i][j][k]- resultsfov[i][j])>epsilon) || (fabs(resultshov[i][j][k]-resultsfos[j])>epsilon)) X { X cout << "difference is here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"; X ok=0; X } // endif X } // endif X else X { X cout << "reshov["<epsilon) X { X cout << "difference is here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"; X ok=0; X } // endif X } // endelse X } // endfor X } // endfor X } // endif X else X { X for (j=0;jepsilon) X { X cout << "difference is here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"; X ok=0; X } // endif X } // endif X else X cout << "reshov["<'helm-auto-exam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X X#include "adouble.h" X#include "adutils.h" X#include X#include X X#ifdef __GNUG__ X#include X#else X#include X#endif X X/* X This program computes first order directional derivatives X for the helmholtz energy function. X*/ X struct tms *buffer; X int n,deg,ideg; X adouble y,z,u; X adouble den,r,t0,t1,t2,t3; X adouble ttim[6]; X adouble ttim2[6]; X adouble bx,te,he,xax,tem; X Xadouble energy(int n,adouble x[], adouble bv[]) X{ X adouble r,he; X int i,j; X xax = 0; X bx = 0; X he =0; X te =0; X X for (i=0; i < n; i++) X { X he += x[i]*log(x[i]); X bx += bv[i]*x[i]; X tem = (2.0/(1.0+i+i))*x[i]; X for (j=0; j>= result; X X trace_off(); X printf("%f -- energy\n",result); X reverse(1,1,n,0,1.0,grad); X for (int l=0; l < n;l++) X { X printf("%d, %f, \n",l,grad[l]); X } X printf("%f -- energy\n",result); X free((char*) x); X free((char*) bv); X free((char*) dir); X free((char*) grad); X} X END_OF_FILE if test 2003 -ne `wc -c <'helm-auto-exam.c'`; then echo shar: \"'helm-auto-exam.c'\" unpacked with wrong size! fi chmod +x 'helm-auto-exam.c' # end of 'helm-auto-exam.c' fi if test -f 'helm-diff-exam.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'helm-diff-exam.c'\" else echo shar: Extracting \"'helm-diff-exam.c'\" \(2078 characters\) sed "s/^X//" >'helm-diff-exam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include X#include X#include X#include X#include X#define delta 0.000001 X X/* X This program computes first order directional derivatives X for the helmholtz energy function. X*/ X X struct tms *buffer; X int n,deg,ideg; X double y,z,u; X double den,r,t0,t1,t2,t3; X double ttim[6]; X double ttim2[6]; X double bx,te,he,xax,tem; X Xdouble energy(int n,double x[],double bv[]) X{ X double r,he; X int i,j; X xax = 0; X bx = 0; X he =0; X te =0; X X for (i=0; i < n; i++) X { X he += x[i]*log(x[i]); X bx += bv[i]*x[i]; X tem = (2.0/(1.0+i+i))*x[i]; X for (j=0; j'helm-vect-exam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include "adouble.h" X#include "adutils.h" X X/* X This program computes first order directional derivatives X for the helmholtz energy function. Uses vector operations. X X*/ X struct tms *buffer; X int n,deg,ideg; X adouble y,z,u; X adouble den,r,t0,t1,t2,t3; X adouble ttim[6]; X adouble ttim2[6]; X adouble bx,te,he,xax,tem; X Xadouble energy(int n, const adoublev &x, const adoublev &bv) X{ X adouble r,he; X int i,j; X xax = 0; X bx = 0; X he =0; X te =0; X X bx = bv*x; X for (i=0; i < n; i++) X { X he += x[i]*log(x[i]); X tem = (2.0/(1.0+i+i))*x[i]; X for (j=0; j>= result; X X trace_off(); X printf("%f -- energy\n",result); X reverse(1,1,n,0,1.0,grad); X for (int l=0; l < n;l++) X { X printf("%d, %f, \n",l,grad[l]); X } X printf("%f -- energy\n",result); X} X X END_OF_FILE if test 1846 -ne `wc -c <'helm-vect-exam.c'`; then echo shar: \"'helm-vect-exam.c'\" unpacked with wrong size! fi chmod +x 'helm-vect-exam.c' # end of 'helm-vect-exam.c' fi if test -f 'od2exam.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'od2exam.c'\" else echo shar: Extracting \"'od2exam.c'\" \(4565 characters\) sed "s/^X//" >'od2exam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include "adouble.h" X#include "adutils.h" X#include X#include X X#ifdef __GNUG__ X#include X#include X#else X#include X#endif X Xint const N=5; // State Space Dimesion of ODE X X/********************************************************** X This orinigal cersion of the right hand side may be used X for run time comparisons. However, the results are not X representative because the function is extremely small X and is likely to stay in cache if evaluated repeatedly. X*********************************************************/ Xvoid eutroph(double*,double*); Xvoid eutroph(unsigned short, double*,double*); X Xvoid main() X{ X/******************************************************* X Select problem set up data and generate the tracerhs X*******************************************************/ Xcout << "highest derivatives =? \n"; Xint D; Xcin >> D; Xint i,j,k; Xint yes ; Xdouble **z, *zz, *pyp; Xz = myalloc(N,D+1);; Xzz = new double[N]; Xpyp = new double[N]; X*z[0] = 0.5; X*z[1] = 0.0005; X*z[2] = 4.00; X*z[3] = 0.0; X*z[4] = 0.0; Xfor (i=0;i> tau; Xdouble **w = myalloc(N,D+1);; Xshort** nonzero; Xnonzero = new short*[N]; Xfor (i=0;i> yes; Xif(yes) X{ Xcout << " 4 = transcend , 3 = rational , 2 = polynomial , 1 = linear , 0 = zero \n"; Xcout << " negative number k indicate that entries of all B_j with j < -k vanish \n"; Xfor(i=0;i> yes; Xif(yes) X { X for(i=0;i> h; Xfor (i=0;i "<'odexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include "adouble.h" X#include "adutils.h" X#include X#include X X#ifdef __GNUG__ X#include X#include X#else X#include X#endif X Xint const N=3; // State Space Dimesion of ODE X X/********************************************************** X This orinigal cersion of the right hand side may be used X for run time comparisons. However, the results are not X representative because the function is extremely small X and is likely to stay in cache if evaluated repeatedly. X*********************************************************/ X Xvoid tracerhs(double* y, double* yprime) X{ Xyprime[0] = -sin(y[2]) + 1e8*y[2]*(1-1/y[0]); Xyprime[1] = -10*y[0] + 3e7*y[2]*(1-y[1]); Xyprime[2] = -yprime[0] - yprime[1]; X} X X/******************************************************** X This overloaded function generates the tape by evaluating X the right hand side in terms of adouble variables. X*********************************************************/ Xvoid tracerhs(unsigned int tag, double* py, double* pyprime) X{ X// py must represent some feasible state space point Xadouble y[N],yprime[N]; Xint i; Xtrace_on(tag); X Xfor (i=0;i>= pyprime[i]; // Mark and pass dependents X Xtrace_off(); X} X Xvoid main() X{ X/******************************************************* X Select problem set up data and generate the tracerhs X*******************************************************/ Xcout << "highest derivatives =? \n"; Xint D; Xcin >> D; Xint i,j,k; Xint yes ; Xdouble **z, *zz, *pyp; Xz = new double*[N]; Xzz = new double[N]; Xpyp = new double[N]; Xfor (i=0;i> tau; Xdouble **w = myalloc(N,D+1);; Xshort** nonzero; Xnonzero = new short*[N]; Xfor (i=0;i> yes; Xif(yes) X{ Xcout << " 4 = transcend , 3 = rational , 2 = polynomial , 1 = linear , 0 = zero \n"; Xcout << " negative number k indicate that entries of all B_j with j < -k vanish \n"; Xfor(i=0;i> yes; Xif(yes) X { X for(i=0;i> h; Xfor (i=0;i "<'scalexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include X#include X X#ifdef __GNUG__ X#include X#else X#include X#endif X X/* This program can be used to verify the consistency and correctness Xof derivatives computed by ADOL-C in its forward and eevere mode. XThe use is required to selct one integer input id. For positive n = id Xthe monomial x^n is evaluated recursively at x=0.5 and all its nonzero XTaylor coeffcients at this point are evaluated in the forward and Xreverse mode. A negative choice of id >= -9 leads to one of nine Xidentities, whose derivatives should be trivial. These identities Xmay be used to check the correctness of particular code segments Xin the ADOL-C sources forward.c and reverse.c. No timings are Xperformed in this example program */ X X#include "adouble.h" // These includes provide the compiler with X#include "adutils.h" // definitions and utilities for `adoubles'. X X// The monomial evaluation routine which has been obtained from X// the original version by retyping all `doubles' as `adoubles'. X Xadouble power(adouble x, int n) X { X adouble z=1; X if (n>0) X { X int nh =n/2; X z = power(x,nh); X z *= z; X if (2*nh != n) z *= x; X return z; X } X else X { X if (n==0) X return z; X else return 1.0/power(x,-n); X } X } Xvoid main() X{ X int n,i,id; X int tag = 0; X cout << "problem number(-1 .. -10) / degree of monomial =? \n"; X cin >> id; X n = id >0 ? id : 3; X double *xp,*yp; X xp = new double[n+4]; X yp = new double[n+4]; X yp[0]=0; X xp[0] = 0.5; X xp[1] = 1.0; X adouble y,x; X int dum=1; X trace_on(tag,dum); // Begin taping all calculations with 'adoubles' X x <<= xp[0]; X if( id >= 0 ) X { X cout << "Evaluate and differentiate recursive power routine \n"; X y = power(x,n); X } X else X { X cout<<"Check Operations and Functions by Algebraic Identities \n"; X double pi = 2*asin(1.0); X switch (id) X { X case -1 : X cout << "Addition/Subtraction: y = x + x - (2.0/3)*x - x/3 \n"; X y = x + x - (2.0/3)*x - x/3 ; X break; X case -2 : X cout << "Multiplication/divison: y = x*x/x \n"; X y = x*x/x; X break; X case -3 : X cout << "Square root and power: y = sqrt(pow(x,2)) \n"; X y = sqrt(pow(x,2)); X break; X case -4 : X cout << "Exponential and log: y = exp(log(log(exp(x)))) \n"; X y = exp(log(log(exp(x)))); X break; X case -5 : X cout << "Trig identity: y = x + sin(2*x)-2*cos(x)*sin(x) \n"; X y = x + sin(2.0*x)-2.0*cos(x)*sin(x); X break; X case -6 : X cout << "Check out quadrature macro \n"; X y = exp(myquad(myquad(exp(x)))); X break; X case -7 : X cout << "Arcsin: y = sin(asin(acos(cos(x)))) \n"; X y = sin(asin(acos(cos(x)))); X break; X case -8 : X cout << "Hyperbolic tangent: y = x + tanh(x)-sinh(x)/cosh(x) \n"; X y = x + tanh(x)-sinh(x)/cosh(x) ; X break; X case -9 : X cout << "Absolute value: y = x + fabs(x) - fabs(-x) \n"; X y = x + fabs(-x) - fabs(x); X break; X case -10 : X cout << "atan2: y = atan2(sin(x-0.5+pi),cos(x-0.5+pi)) \n"; X y = atan2(sin(x),cos(x)); X // y= tan(atan2(x,1.0)); X break; X default : cout << " Please select problem number >= -10 \n"; X exit(-1); X } X cout << "Round-off error: " << value(y-x) << " \n"; X } X y >>= yp[0]; X trace_off(); // The (partial) execution trace is completed. X int oper,indep,depen,buf_size,maxlive,deaths; X int tape_stats[11]; X tapestats(tag,tape_stats); X indep = tape_stats[0]; X depen = tape_stats[1]; X buf_size = tape_stats[4]; X oper = tape_stats[5]; X deaths = tape_stats[3]; X maxlive = tape_stats[2]; X X X cout<<"\n"; X cout<<"independents "<'shuttlexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include "adouble.h" X#include "adutils.h" X#include X#include X X#ifdef __GNUG__ X#include X#else X#include X#endif X X#define tag 3 Xdouble getunitime(){ Xdouble t0 = myclock(); Xfor(int it=0;it<5000;it++) X { X double f[7]; X double H,x,l,V,g,A,b,Hp,xp,lp,Vp,gp,Ap,bp, X r,gr,rho,L,cd,ma,Om,Z; X // *** Initialization of independent variables X H = 264039.328; X x = 177.718047; X l = 32.0417885; X V = 24317.0798; X g = -0.749986488; X A = 62.7883367; X b = 41.100771834; X Hp = -318; X xp = 0.01; X lp = 0.1; X Vp = -3.6; X gp = 0.001; X Ap = 0.1; X bp =0.06*(it+1); X double ae = 20902900; X double mu = 0.14E+17; X bp /= (it+1); X r = H+ae; X gr = mu/(r*r); X rho = .002378*exp(-H/23800.); X double a = 40; X double S =2690; X double crtd = 180/3.14; X double cl = .84-.48*(38.-a*crtd)/26.; X L = .5*rho*cl*S*V*V; X cd = .78-.58*(38.-a*crtd)/26.; X ma = 5964.496499824; X Om = .72921159e-4; X Z = .5*rho*cd*S*V*V; X double C0 = 3.974960446019; X double C1 = -.01448947694635; X double C2 = -.2156171551995e-4; X double C3 = -.1089609507291e-7; X double V0 = 0; X// evaluate the dynamic equations ... X double sing,cosg,sinA,cosA,sinl,cosl,tanl; X sinA =sin(A); X cosA = cos(A); X sing =sin(g); X cosg = cos(g); X sinl=sin(l); X cosl=cos(l); X tanl = sinl/cosl; X f[0] = V*sing-Hp; X f[1] = V*cosg*sinA/(r*cosl)-xp; X f[2] = V*cosg*cosA/r-lp; X f[3] = -Z/ma-gr*sing-Om*Om*r*cosl X *(sinl*cosA*cosg-cosl*sing)-Vp; X f[4] = L*cos(b)/(ma*V)+cosl/V*(V*V/r-gr) X +2*Om*cosl*sinA X +Om*Om*r*cosl/V*(sinl*cosA*sing+cosl*cosg) X -gp; X f[5] = L*sin(b)/(ma*V*cosg)+V/r*cosg*sinA*tanl X -2*Om*(cosl*cosA*sing/cosg-sinl) X +Om*Om*r*cosl*sinl*sinA/(V*cosg)-Ap; X f[6] = Z/ma - (C0+(V-V0)*(C1+(V-V0)*(C2+(V-V0)*C3))); X } X double t1 = myclock(); X double ti = (t1-t0)/5000.0; X return ti ; X} X Xvoid main() { X double rtu = 1.0/getunitime(); X int i,j,k,deg; X adouble f[7]; X adouble H,x,l,V,g,A,b,Hp,xp,lp,Vp,gp,Ap,bp, X r,gr,rho,L,cd,ma,Om,Z; X cout<<"\nenter the degree: "; cin>>deg; cout<<"\n"; X trace_on(tag); X // *** Initialization of independent variables X H <<= 264039.328; X x <<= 177.718047; X l <<= 32.0417885; X V <<= 24317.0798; X g <<= -0.749986488; X A <<= 62.7883367; X b <<= 41.100771834; X Hp <<= -318; X xp <<= 0.01; X lp <<= 0.1; X Vp <<= -3.6; X gp <<= 0.001; X Ap <<= 0.1; X bp <<=0.06; X double ae = 20902900; X double mu = 0.14E+17; X r = H+ae; X gr = mu/(r*r); X rho = .002378*exp(-H/23800.); X double a = 40; X double S =2690; X double crtd = 180/3.14; X double cl = .84-.48*(38.-a*crtd)/26.; X L = .5*rho*cl*S*V*V; X cd = .78-.58*(38.-a*crtd)/26.; X ma = 5964.496499824; X Om = .72921159e-4; X Z = .5*rho*cd*S*V*V; X double C0 = 3.974960446019; X double C1 = -.01448947694635; X double C2 = -.2156171551995e-4; X double C3 = -.1089609507291e-7; X double V0 = 0; X// evaluate the dynamic equations ... X adouble sing,cosg,sinA,cosA,sinl,cosl,tanl; X sinA =sin(A); X cosA = cos(A); X sing =sin(g); X cosg = cos(g); X sinl=sin(l); X cosl=cos(l); X tanl = sinl/cosl; X f[0] = V*sing-Hp; X f[1] = V*cosg*sinA/(r*cosl)-xp; X f[2] = V*cosg*cosA/r-lp; X f[3] = -Z/ma-gr*sing-Om*Om*r*cosl X *(sinl*cosA*cosg-cosl*sing)-Vp; X f[4] = L*cos(b)/(ma*V)+cosl/V*(V*V/r-gr) X +2*Om*cosl*sinA X +Om*Om*r*cosl/V*(sinl*cosA*sing+cosl*cosg) X -gp; X f[5] = L*sin(b)/(ma*V*cosg)+V/r*cosg*sinA*tanl X -2*Om*(cosl*cosA*sing/cosg-sinl) X +Om*Om*r*cosl*sinl*sinA/(V*cosg)-Ap; X f[6] = Z/ma - (C0+(V-V0)*(C1+(V-V0)*(C2+(V-V0)*C3))); X // *** pass final values of active variables to passive variables X double res[7]; X for(i=0;i<7;i++) X f[i] >>= res[i]; X trace_off (); X // Set up correspondence between user's Variables and program Variables X const int m = 7; X const int n = 14; X double **X = myalloc(n,deg+1); // independent variable values X double **Y = myalloc(m,deg+1); // output Taylor coefficients X double **Y0 = myalloc(m,deg+1); // output Taylor coefficients X X[0][0] = value(H); X X[1][0] = value(x); X X[2][0] = value(l); X X[3][0] = value(V); X X[4][0] = value(g); X X[5][0] = value(A); X X[6][0] = value(b); X X[7][0] = value(Hp); X X[8][0] = value(xp); X X[9][0] = value(lp); X X[10][0] = value(Vp); X X[11][0] = value(gp); X X[12][0] = value(Ap); X X[13][0] = value(bp); X srand(53); X for(i=1;i<=deg;i++) X for(j=0;j> yes; X if(yes) X { X cout<<" 4 = transcend , 4 = rational , 2 = polynomial , 1 = linear , 0 = zero \n"; X for(i=0;i<7;i++) X { X for(j=0;j<14;j++) X cout << nonzero[i][j] <<" "; X cout <<"\n"; X } X } X// time multiple calls to scalar reverse X float err =0; X cout << "Print comparison between reverse and differences? \n"; X cin >> yes; X double t4 = myclock(); X for (i=0;i'vectexam.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X Testexample of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X*/ X X#include "adouble.h" X#include "adutils.h" X#include X#define abs(x) ((x >= 0) ? (x) : -(x)) X#define maxabs(x,y) (((x)>abs(y)) ? (x) : abs(y)) X#define TAG 1 X X#ifdef CLOCKS_PER_SEC X#define clockspeed 1.0/CLOCKS_PER_SEC X#else X#define clockspeed 1.e-6 //machine dependent X#endif X#include Xlong t0, t1,t2,t3,t4,t5,t6,t7,t8,t9; Xvoid main() { X int n,i,oper,indep,depen,buf_size,maxlive,deaths; X int tape_stats[11]; X cout << "number of independent variables = ? \n"; X cin >> n; X double **xp = new double*[n]; X double yp =1; // Undifferenciated double code X for (i=0;i>= yout; X t2 = clock(); X cout<< yout <<" =? "< zero timing due to small problem dimension \n"; X} END_OF_FILE if test 4490 -ne `wc -c <'vectexam.c'`; then echo shar: \"'vectexam.c'\" unpacked with wrong size! fi chmod +x 'vectexam.c' # end of 'vectexam.c' fi echo shar: End of shell archive. exit 0 C*** install.shar #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'README' <<'END_OF_FILE' X -------------------------------------------------------------- X ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X XThis directory contains makefiles and other UNIX scripts. X XTo produce the ADOL-C library libad.a use the executable Xinstall (e.g. aixinstall). XIt inserts appropriate makefiles into the ADOL-C library Xand the two example subdirectories provided. XAfter that the make command can be invoked as usual: X X- in */SRC Xmake Xwill produce the library libad.a X X- in */SRC/DEX or */SRC/EXA Xmake Xwill build the executable . X XThe design goals, applicability and some implementation details Xof ADOL-C are described in the tared LaTeX file adol-c.doc.tar. XAny difficulties and questions should be reported to: Xadol-c@math.tu-dresden.de X XAIX: Problems with float constants may occur if the environment variable XLANG is not set to En_US -- test it with: Xset Xset it with: Xexport LANG=En_US X-- because the compiler may parse constants containing a decimal dot Xnot correctly. X XGNU: Some source files contain remove and unlink calls. XAlthough remove complies with the ANSI C standard it turned out, that Xin some situations (e.g. using GNU's compilers on a SUN workstation) Xunlink has to be used instead of remove. In this case Xchange the comment signs in the source where both alternatives Xare offered. X END_OF_FILE if test 1423 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi chmod +x 'README' # end of 'README' fi if test -f 'aixinstall' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'aixinstall'\" else echo shar: Extracting \"'aixinstall'\" \(1035 characters\) sed "s/^X//" >'aixinstall' <<'END_OF_FILE' X# -------------------------------------------------------------- X# File aixinstall of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# aixinstall rewrites some fileextensions and copies X# the correct makefiles for ADOL-C itself into */SRC X# and for the examples into the subdirectories */SRC/EXA and */SRC/DEX. X Xcp makefile.src.aix ../SRC/makefile Xcp makefile.dex.aix ../SRC/DEX/makefile Xcp makefile.exa.aix ../SRC/EXA/makefile Xcd ../SRC Xmv adouble.c adouble.C Xmv avector.c avector.C Xmv drivers.c drivers.C Xmv utils.c utils.C Xcd DEX Xmv detexam.c detexam.C Xmv scalexam.c scalexam.C Xmv gaussexam.c gaussexam.C Xmv odexam.c odexam.C Xmv vectexam.c vectexam.C Xcd ../EXA Xmv detexam.c detexam.C Xmv helm-auto-exam.c helm-auto-exam.C Xmv helm-vect-exam.c helm-vect-exam.C Xmv odexam.c odexam.C Xmv od2exam.c od2exam.C Xmv eutroph.c eutroph.C Xmv scalexam.c scalexam.C Xmv shuttlexam.c shuttlexam.C Xmv vectexam.c vectexam.C Xmv gaussexam.c gaussexam.C Xcd ../.. X END_OF_FILE if test 1035 -ne `wc -c <'aixinstall'`; then echo shar: \"'aixinstall'\" unpacked with wrong size! fi chmod +x 'aixinstall' # end of 'aixinstall' fi if test -f 'aixuninstall' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'aixuninstall'\" else echo shar: Extracting \"'aixuninstall'\" \(928 characters\) sed "s/^X//" >'aixuninstall' <<'END_OF_FILE' X# --------------------------------------------------------------- X# File aixuninstall of ADOL-C version 1.6 as of January 1, 1995 X# --------------------------------------------------------------- X Xcd ../SRC Xrm makefile Xmv adouble.C adouble.c Xmv avector.C avector.c Xmv drivers.C drivers.c Xmv utils.C utils.c X/bin/rm *.o X/bin/rm libad.a Xcd DEX Xrm makefile Xmv detexam.C detexam.c Xmv scalexam.C scalexam.c Xmv gaussexam.C gaussexam.c Xmv odexam.C odexam.c Xmv vectexam.C vectexam.c X/bin/rm *.o X/bin/rm *xam X/bin/rm _adol* X/bin/rm adoltemp.xxx Xcd ../EXA Xrm makefile Xmv detexam.C detexam.c Xmv helm-auto-exam.C helm-auto-exam.c Xmv helm-vect-exam.C helm-vect-exam.c Xmv odexam.C odexam.c Xmv od2exam.C od2exam.c Xmv eutroph.C eutroph.c Xmv scalexam.C scalexam.c Xmv shuttlexam.C shuttlexam.c Xmv vectexam.C vectexam.c Xmv gaussexam.C gaussexam.c X/bin/rm *.o X/bin/rm *xam X/bin/rm _adol* X/bin/rm adoltemp.xxx Xcd ../.. X END_OF_FILE if test 928 -ne `wc -c <'aixuninstall'`; then echo shar: \"'aixuninstall'\" unpacked with wrong size! fi chmod +x 'aixuninstall' # end of 'aixuninstall' fi if test -f 'gnuinstall' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'gnuinstall'\" else echo shar: Extracting \"'gnuinstall'\" \(464 characters\) sed "s/^X//" >'gnuinstall' <<'END_OF_FILE' X# -------------------------------------------------------------- X# File gnuinstall of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# gnuinstall copies X# the correct makefiles for ADOL-C itself into */SRC X# and for the examples into the subdirectories */SRC/EXA and */SRC/DEX. X Xcp makefile.src.gnu ../SRC/makefile Xcp makefile.dex.gnu ../SRC/DEX/makefile Xcp makefile.exa.gnu ../SRC/EXA/makefile X END_OF_FILE if test 464 -ne `wc -c <'gnuinstall'`; then echo shar: \"'gnuinstall'\" unpacked with wrong size! fi chmod +x 'gnuinstall' # end of 'gnuinstall' fi if test -f 'gnuuninstall' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'gnuuninstall'\" else echo shar: Extracting \"'gnuuninstall'\" \(425 characters\) sed "s/^X//" >'gnuuninstall' <<'END_OF_FILE' X# --------------------------------------------------------------- X# File gnuuninstall of ADOL-C version 1.6 as of January 1, 1995 X# --------------------------------------------------------------- X Xcd ../SRC Xrm makefile X/bin/rm *.o X/bin/rm libad.a Xcd DEX Xrm makefile X/bin/rm *.o X/bin/rm *xam X/bin/rm _adol* X/bin/rm adoltemp.xxx Xcd ../EXA Xrm makefile X/bin/rm *.o X/bin/rm *xam X/bin/rm _adol* X/bin/rm adoltemp.xxx Xcd ../.. X END_OF_FILE if test 425 -ne `wc -c <'gnuuninstall'`; then echo shar: \"'gnuuninstall'\" unpacked with wrong size! fi chmod +x 'gnuuninstall' # end of 'gnuuninstall' fi if test -f 'makefile.dex.aix' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.dex.aix'\" else echo shar: Extracting \"'makefile.dex.aix'\" \(1476 characters\) sed "s/^X//" >'makefile.dex.aix' <<'END_OF_FILE' X# X# -------------------------------------------------------------- X# makefile (DEX) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for documented examples in subdirectory DEX X# written for IBM RS/6000 with AIX 3.2. X# XAD = ../ X# AD may be any directory with ADOL-C library and header files X# XCFLAG = -I$(AD) XLFLAG = -L$(AD) XCC = xlC XMCC = xlc XLIBS = -lad -lm Xall: vectexam scalexam detexam odexam gaussexam X Xvectexam : vectexam.o $(AD)/libad.a X $(CC) -o vectexam vectexam.o $(LFLAG) $(LIBS) Xvectexam.o : vectexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) vectexam.C X Xscalexam : scalexam.o $(AD)/libad.a X $(CC) -o scalexam scalexam.o $(LFLAG) $(LIBS) Xscalexam.o : scalexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) scalexam.C X Xdetexam : detexam.o $(AD)/libad.a X $(CC) -o detexam detexam.o $(LFLAG) $(LIBS) Xdetexam.o : detexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) detexam.C X Xodexam : odexam.o $(AD)/libad.a X $(CC) -o odexam odexam.o $(LFLAG) $(LIBS) Xodexam.o : odexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) odexam.C X Xgaussexam : gaussexam.o $(AD)/libad.a X $(CC) -o gaussexam gaussexam.o $(LFLAG) $(LIBS) Xgaussexam.o : gaussexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) gaussexam.C X Xclean: X /bin/rm *.o Xreallyclean: X /bin/rm *exam X END_OF_FILE if test 1476 -ne `wc -c <'makefile.dex.aix'`; then echo shar: \"'makefile.dex.aix'\" unpacked with wrong size! fi chmod +x 'makefile.dex.aix' # end of 'makefile.dex.aix' fi if test -f 'makefile.dex.gnu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.dex.gnu'\" else echo shar: Extracting \"'makefile.dex.gnu'\" \(1469 characters\) sed "s/^X//" >'makefile.dex.gnu' <<'END_OF_FILE' X# X# -------------------------------------------------------------- X# makefile (DEX) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for documented examples in subdirectory DEX X# written for GNU's g++ compiler. X# XAD = ../ X# AD may be any directory with ADOL-C library and header files X# XCFLAG = -O -I$(AD) XLFLAG = -L$(AD) XCC = g++ XLIBS = -lad -lm Xall: vectexam scalexam detexam odexam gaussexam X Xvectexam : vectexam.o $(AD)/libad.a X $(CC) -o vectexam vectexam.o $(LFLAG) $(LIBS) Xvectexam.o : vectexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) vectexam.c X Xscalexam : scalexam.o $(AD)/libad.a X $(CC) -o scalexam scalexam.o $(LFLAG) $(LIBS) Xscalexam.o : scalexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) scalexam.c X Xdetexam : detexam.o $(AD)/libad.a X $(CC) -g -o detexam detexam.o $(LFLAG) $(LIBS) Xdetexam.o : detexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) detexam.c X Xodexam : odexam.o $(AD)/libad.a X $(CC) -o odexam odexam.o $(LFLAG) $(LIBS) Xodexam.o : odexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) odexam.c X Xgaussexam : gaussexam.o $(AD)/libad.a X $(CC) -o gaussexam gaussexam.o $(LFLAG) $(LIBS) Xgaussexam.o : gaussexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) gaussexam.c X Xclean: X /bin/rm *.o Xreallyclean: X /bin/rm *exam X END_OF_FILE if test 1469 -ne `wc -c <'makefile.dex.gnu'`; then echo shar: \"'makefile.dex.gnu'\" unpacked with wrong size! fi chmod +x 'makefile.dex.gnu' # end of 'makefile.dex.gnu' fi if test -f 'makefile.dex.xxx' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.dex.xxx'\" else echo shar: Extracting \"'makefile.dex.xxx'\" \(1431 characters\) sed "s/^X//" >'makefile.dex.xxx' <<'END_OF_FILE' X# X# -------------------------------------------------------------- X# makefile (DEX) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for documented examples in subdirectory DEX X# XAD = ../ X# AD may be any directory with ADOL-C library and header files X# XCFLAG = -O -I$(AD) XLFLAG = -L$(AD) XCC = CC XLIBS = -lad -lm Xall: vectexam scalexam detexam odexam gaussexam Xvectexam : vectexam.o $(AD)/libad.a X $(CC) -o vectexam vectexam.o $(LFLAG) $(LIBS) Xvectexam.o : vectexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) vectexam.c X Xscalexam : scalexam.o $(AD)/libad.a X $(CC) -o scalexam scalexam.o $(LFLAG) $(LIBS) Xscalexam.o : scalexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) scalexam.c X Xdetexam : detexam.o $(AD)/libad.a X $(CC) -g -o detexam detexam.o $(LFLAG) $(LIBS) Xdetexam.o : detexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) detexam.c X Xodexam : odexam.o $(AD)/libad.a X $(CC) -o odexam odexam.o $(LFLAG) $(LIBS) Xodexam.o : odexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) odexam.c X Xgaussexam : gaussexam.o $(AD)/libad.a X $(CC) -o gaussexam gaussexam.o $(LFLAG) $(LIBS) Xgaussexam.o : gaussexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) gaussexam.c X Xclean: X /bin/rm *.o Xreallyclean: X /bin/rm *exam X END_OF_FILE if test 1431 -ne `wc -c <'makefile.dex.xxx'`; then echo shar: \"'makefile.dex.xxx'\" unpacked with wrong size! fi chmod +x 'makefile.dex.xxx' # end of 'makefile.dex.xxx' fi if test -f 'makefile.exa.aix' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.exa.aix'\" else echo shar: Extracting \"'makefile.exa.aix'\" \(2522 characters\) sed "s/^X//" >'makefile.exa.aix' <<'END_OF_FILE' X# X# -------------------------------------------------------------- X# makefile (EXA) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for undocumented examples in subdirectory EXA X# written for IBM RS/6000 with AIX 3.2. X# XAD = ../ X# AD may be any directory with ADOL-C library and header files X# XCFLAG = -I$(AD) XLFLAG = -L$(AD) XCC = xlC XMCC = xlc XLIBS = -lad -lm Xall: vectexam scalexam detexam odexam gaussexam helm-diff-exam helm-auto-exam helm-vect-exam shuttlexam od2exam X Xhelm-diff-exam : helm-diff-exam.c X $(MCC) -o helm-diff-exam helm-diff-exam.c -lm X Xhelm-auto-exam : helm-auto-exam.o X $(CC) -o helm-auto-exam helm-auto-exam.o $(LFLAG) $(LIBS) Xhelm-auto-exam.o: helm-auto-exam.C $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) helm-auto-exam.C X Xhelm-vect-exam : helm-vect-exam.o X $(CC) -o helm-vect-exam helm-vect-exam.o $(LFLAG) $(LIBS) Xhelm-vect-exam.o: helm-vect-exam.C $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) helm-vect-exam.C X Xshuttlexam : shuttlexam.o $(AD)/libad.a X $(CC) -o shuttlexam shuttlexam.o $(LFLAG) $(LIBS) Xshuttlexam.o: shuttlexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) shuttlexam.C X Xvectexam : vectexam.o $(AD)/libad.a X $(CC) -o vectexam vectexam.o $(LFLAG) $(LIBS) Xvectexam.o : vectexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) vectexam.C X Xscalexam : scalexam.o $(AD)/libad.a X $(CC) -o scalexam scalexam.o $(LFLAG) $(LIBS) Xscalexam.o : scalexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) scalexam.C X Xdetexam : detexam.o $(AD)/libad.a X $(CC) -o detexam detexam.o $(LFLAG) $(LIBS) Xdetexam.o : detexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) detexam.C X Xodexam : odexam.o $(AD)/libad.a X $(CC) -o odexam odexam.o $(LFLAG) $(LIBS) Xodexam.o : odexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) odexam.C X Xod2exam : od2exam.o eutroph.o $(AD)/libad.a X $(CC) -o od2exam od2exam.o eutroph.o $(LFLAG) $(LIBS) Xod2exam.o : od2exam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) od2exam.C Xeutroph.o : eutroph.C $(AD)/usrparms.h $(AD)/adouble.h X $(CC) -c $(CFLAG) eutroph.C X Xgaussexam : gaussexam.o $(AD)/libad.a X $(CC) -o gaussexam gaussexam.o $(LFLAG) $(LIBS) Xgaussexam.o : gaussexam.C $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) gaussexam.C X Xclean: X /bin/rm *.o Xreallyclean: X /bin/rm *exam X END_OF_FILE if test 2522 -ne `wc -c <'makefile.exa.aix'`; then echo shar: \"'makefile.exa.aix'\" unpacked with wrong size! fi chmod +x 'makefile.exa.aix' # end of 'makefile.exa.aix' fi if test -f 'makefile.exa.gnu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.exa.gnu'\" else echo shar: Extracting \"'makefile.exa.gnu'\" \(2530 characters\) sed "s/^X//" >'makefile.exa.gnu' <<'END_OF_FILE' X# X# -------------------------------------------------------------- X# makefile (EXA) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for undocumented examples in subdirectory EXA X# written for GNU's gcc and g++ compilers. X# XAD = ../ X# AD may be any directory with ADOL-C library and header files X# XCFLAG = -O -I$(AD) XLFLAG = -L$(AD) XCC = g++ XMCC = gcc XLIBS = -lad -lm Xall: vectexam scalexam detexam odexam gaussexam helm-diff-exam helm-auto-exam helm-vect-exam shuttlexam od2exam X Xhelm-diff-exam : helm-diff-exam.c X $(MCC) -o helm-diff-exam helm-diff-exam.c -lm X Xhelm-auto-exam : helm-auto-exam.o X $(CC) -o helm-auto-exam helm-auto-exam.o $(LFLAG) $(LIBS) Xhelm-auto-exam.o: helm-auto-exam.c $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) helm-auto-exam.c X Xhelm-vect-exam : helm-vect-exam.o X $(CC) -o helm-vect-exam helm-vect-exam.o $(LFLAG) $(LIBS) Xhelm-vect-exam.o: helm-vect-exam.c $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) helm-vect-exam.c X Xshuttlexam : shuttlexam.o $(AD)/libad.a X $(CC) -o shuttlexam shuttlexam.o $(LFLAG) $(LIBS) Xshuttlexam.o: shuttlexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) shuttlexam.c X Xvectexam : vectexam.o $(AD)/libad.a X $(CC) -o vectexam vectexam.o $(LFLAG) $(LIBS) Xvectexam.o : vectexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) vectexam.c X Xscalexam : scalexam.o $(AD)/libad.a X $(CC) -o scalexam scalexam.o $(LFLAG) $(LIBS) Xscalexam.o : scalexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) scalexam.c X Xdetexam : detexam.o $(AD)/libad.a X $(CC) -o detexam detexam.o $(LFLAG) $(LIBS) Xdetexam.o : detexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) detexam.c X Xodexam : odexam.o $(AD)/libad.a X $(CC) -o odexam odexam.o $(LFLAG) $(LIBS) Xodexam.o : odexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) odexam.c X Xod2exam : od2exam.o eutroph.o $(AD)/libad.a X $(CC) -o od2exam od2exam.o eutroph.o $(LFLAG) $(LIBS) Xod2exam.o : od2exam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) od2exam.c Xeutroph.o : eutroph.c $(AD)/usrparms.h $(AD)/adouble.h X $(CC) -c $(CFLAG) eutroph.c X Xgaussexam : gaussexam.o $(AD)/libad.a X $(CC) -o gaussexam gaussexam.o $(LFLAG) $(LIBS) Xgaussexam.o : gaussexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) gaussexam.c X Xclean: X /bin/rm *.o Xreallyclean: X /bin/rm *exam X END_OF_FILE if test 2530 -ne `wc -c <'makefile.exa.gnu'`; then echo shar: \"'makefile.exa.gnu'\" unpacked with wrong size! fi chmod +x 'makefile.exa.gnu' # end of 'makefile.exa.gnu' fi if test -f 'makefile.exa.xxx' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.exa.xxx'\" else echo shar: Extracting \"'makefile.exa.xxx'\" \(2481 characters\) sed "s/^X//" >'makefile.exa.xxx' <<'END_OF_FILE' X# X# -------------------------------------------------------------- X# makefile (EXA) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for undocumented examples in subdirectory EXA XAD = ../ X# AD may be any directory with ADOL-C library and header files X# XCFLAG = -O -I$(AD) XLFLAG = -L$(AD) XCC = CC XMCC = cc XLIBS = -lad -lm Xall: vectexam scalexam detexam odexam gaussexam helm-diff-exam helm-auto-exam helm-vect-exam shuttlexam od2exam X Xhelm-diff-exam : helm-diff-exam.c X $(MCC) -o helm-diff-exam helm-diff-exam.c -lm X Xhelm-auto-exam : helm-auto-exam.o X $(CC) -o helm-auto-exam helm-auto-exam.o $(LFLAG) $(LIBS) Xhelm-auto-exam.o: helm-auto-exam.c $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) helm-auto-exam.c X Xhelm-vect-exam : helm-vect-exam.o X $(CC) -o helm-vect-exam helm-vect-exam.o $(LFLAG) $(LIBS) Xhelm-vect-exam.o: helm-vect-exam.c $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) helm-vect-exam.c X Xshuttlexam : shuttlexam.o $(AD)/libad.a X $(CC) -o shuttlexam shuttlexam.o $(LFLAG) $(LIBS) Xshuttlexam.o: shuttlexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) shuttlexam.c X Xvectexam : vectexam.o $(AD)/libad.a X $(CC) -o vectexam vectexam.o $(LFLAG) $(LIBS) Xvectexam.o : vectexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) vectexam.c X Xscalexam : scalexam.o $(AD)/libad.a X $(CC) -o scalexam scalexam.o $(LFLAG) $(LIBS) Xscalexam.o : scalexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) scalexam.c X Xdetexam : detexam.o $(AD)/libad.a X $(CC) -o detexam detexam.o $(LFLAG) $(LIBS) Xdetexam.o : detexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) detexam.c X Xodexam : odexam.o $(AD)/libad.a X $(CC) -o odexam odexam.o $(LFLAG) $(LIBS) Xodexam.o : odexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) odexam.c X Xod2exam : od2exam.o eutroph.o $(AD)/libad.a X $(CC) -o od2exam od2exam.o eutroph.o $(LFLAG) $(LIBS) Xod2exam.o : od2exam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) od2exam.c Xeutroph.o : eutroph.c $(AD)/usrparms.h $(AD)/adouble.h X $(CC) -c $(CFLAG) eutroph.c X Xgaussexam : gaussexam.o $(AD)/libad.a X $(CC) -o gaussexam gaussexam.o $(LFLAG) $(LIBS) Xgaussexam.o : gaussexam.c $(AD)/usrparms.h $(AD)/adouble.h $(AD)/adutils.h X $(CC) -c $(CFLAG) gaussexam.c X Xclean: X /bin/rm *.o Xreallyclean: X /bin/rm *exam X END_OF_FILE if test 2481 -ne `wc -c <'makefile.exa.xxx'`; then echo shar: \"'makefile.exa.xxx'\" unpacked with wrong size! fi chmod +x 'makefile.exa.xxx' # end of 'makefile.exa.xxx' fi if test -f 'makefile.src.aix' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.src.aix'\" else echo shar: Extracting \"'makefile.src.aix'\" \(2910 characters\) sed "s/^X//" >'makefile.src.aix' <<'END_OF_FILE' X# X# -------------------------------------------------------------- X# makefile (SRC) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for the library libad.a of ADOL-C X# written for IBM RS/6000 with AIX 3.2. X# X XCFLAGS = XLIB = -lc XCC = xlC XMCC = xlc Xlibad: adouble.o avector.o taputil1.o taputil2.o taputil3.o hos_forward.o hov_forward.o fov_forward.o hos_reverse.o fos_reverse.o hov_reverse.o fov_reverse.o tayutil.o drivers.o driversc.o utils.o X ranlib libad.a X @echo 'Library created' Xadouble.o: adouble.C adouble.h avector.h oplate.h taputil1.h X $(CC) -c $(CFLAGS) $(LIB) adouble.C X ar rcv libad.a adouble.o Xavector.o: avector.C adouble.h avector.h oplate.h taputil1.h X $(CC) -c $(CFLAGS) $(LIB) avector.C X ar rcv libad.a avector.o Xtaputil1.o: taputil1.c oplate.h taputil2.h tayutil.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil1.c X ar rcv libad.a taputil1.o Xtaputil2.o: taputil2.c dvlparms.h oplate.h taputil3.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil2.c X ar rcv libad.a taputil2.o Xtaputil3.o: taputil3.c dvlparms.h oplate.h tayutil.h taputil1.h taputil2.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil3.c X ar rcv libad.a taputil3.o Xhos_forward.o: hos_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hos_forward.c X ar rcv libad.a hos_forward.o Xhov_forward.o: hov_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hov_forward.c X ar rcv libad.a hov_forward.o Xfov_forward.o: fov_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fov_forward.c X ar rcv libad.a fov_forward.o Xhos_reverse.o: hos_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hos_reverse.c X ar rcv libad.a hos_reverse.o Xfos_reverse.o: fos_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fos_reverse.c X ar rcv libad.a fos_reverse.o Xhov_reverse.o: hov_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hov_reverse.c X ar rcv libad.a hov_reverse.o Xfov_reverse.o: fov_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fov_reverse.c X ar rcv libad.a fov_reverse.o Xtayutil.o: tayutil.c dvlparms.h usrparms.h tayutil.h X $(MCC) -c $(CFLAGS) $(LIB) tayutil.c X ar rcv libad.a tayutil.o Xutils.o: utils.C tayutil.h taputil3.h X $(CC) -c $(CFLAGS) $(LIB) utils.C X ar rcv libad.a utils.o Xdriversc.o: driversc.c dvlparms.h adutilsc.h X $(MCC) -c $(CFLAGS) $(LIB) driversc.c X ar rcv libad.a driversc.o Xdrivers.o: drivers.C dvlparms.h adutils.h X $(CC) -c $(CFLAGS) $(LIB) drivers.C X ar rcv libad.a drivers.o Xclean : X /bin/rm *.o X END_OF_FILE if test 2910 -ne `wc -c <'makefile.src.aix'`; then echo shar: \"'makefile.src.aix'\" unpacked with wrong size! fi chmod +x 'makefile.src.aix' # end of 'makefile.src.aix' fi if test -f 'makefile.src.gnu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.src.gnu'\" else echo shar: Extracting \"'makefile.src.gnu'\" \(2919 characters\) sed "s/^X//" >'makefile.src.gnu' <<'END_OF_FILE' X X# -------------------------------------------------------------- X# makefile (SRC) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for the library libad.a of ADOL-C X# written for GNU's gcc and g++ compilers. X# X XCFLAGS = -O XCC = g++ XMCC = gcc XLIBS = -lad -lm Xlibad: adouble.o avector.o taputil1.o taputil2.o taputil3.o hos_forward.o hov_forward.o fov_forward.o hos_reverse.o fos_reverse.o hov_reverse.o fov_reverse.o tayutil.o drivers.o driversc.o utils.o X ranlib libad.a X @echo 'Library created' Xadouble.o: adouble.c adouble.h avector.h oplate.h taputil1.h X $(CC) -c $(CFLAGS) $(LIB) adouble.c X ar rcv libad.a adouble.o Xavector.o: avector.c adouble.h avector.h oplate.h taputil1.h X $(CC) -c $(CFLAGS) $(LIB) avector.c X ar rcv libad.a avector.o Xtaputil1.o: taputil1.c oplate.h taputil2.h tayutil.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil1.c X ar rcv libad.a taputil1.o Xtaputil2.o: taputil2.c dvlparms.h oplate.h taputil3.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil2.c X ar rcv libad.a taputil2.o Xtaputil3.o: taputil3.c dvlparms.h oplate.h tayutil.h taputil1.h taputil2.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil3.c X ar rcv libad.a taputil3.o Xhos_forward.o: hos_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hos_forward.c X ar rcv libad.a hos_forward.o Xhov_forward.o: hov_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hov_forward.c X ar rcv libad.a hov_forward.o Xfov_forward.o: fov_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fov_forward.c X ar rcv libad.a fov_forward.o Xhos_reverse.o: hos_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hos_reverse.c X ar rcv libad.a hos_reverse.o Xfos_reverse.o: fos_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fos_reverse.c X ar rcv libad.a fos_reverse.o Xhov_reverse.o: hov_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hov_reverse.c X ar rcv libad.a hov_reverse.o Xfov_reverse.o: fov_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fov_reverse.c X ar rcv libad.a fov_reverse.o Xtayutil.o: tayutil.c dvlparms.h usrparms.h tayutil.h X $(MCC) -c $(CFLAGS) $(LIB) tayutil.c X ar rcv libad.a tayutil.o Xutils.o: utils.c tayutil.h taputil3.h X $(CC) -c $(CFLAGS) $(LIB) utils.c X ar rcv libad.a utils.o Xdriversc.o: driversc.c dvlparms.h adutilsc.h X $(MCC) -c $(CFLAGS) $(LIB) driversc.c X ar rcv libad.a driversc.o Xdrivers.o: drivers.c dvlparms.h adutils.h X $(CC) -c $(CFLAGS) $(LIB) drivers.c X ar rcv libad.a drivers.o Xclean: X /bin/rm *.o X END_OF_FILE if test 2919 -ne `wc -c <'makefile.src.gnu'`; then echo shar: \"'makefile.src.gnu'\" unpacked with wrong size! fi chmod +x 'makefile.src.gnu' # end of 'makefile.src.gnu' fi if test -f 'makefile.src.xxx' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile.src.xxx'\" else echo shar: Extracting \"'makefile.src.xxx'\" \(2873 characters\) sed "s/^X//" >'makefile.src.xxx' <<'END_OF_FILE' X X# -------------------------------------------------------------- X# makefile (SRC) of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# makefile for the library libad.a of ADOL-C X XCFLAGS = -O XCC = CC XMCC = cc XLIBS = -lad -lm Xlibad: adouble.o avector.o taputil1.o taputil2.o taputil3.o hos_forward.o hov_forward.o fov_forward.o hos_reverse.o fos_reverse.o hov_reverse.o fov_reverse.o tayutil.o drivers.o driversc.o utils.o X ranlib libad.a X @echo 'Library created' Xadouble.o: adouble.c adouble.h avector.h oplate.h taputil1.h X $(CC) -c $(CFLAGS) $(LIB) adouble.c X ar rcv libad.a adouble.o Xavector.o: avector.c adouble.h avector.h oplate.h taputil1.h X $(CC) -c $(CFLAGS) $(LIB) avector.c X ar rcv libad.a avector.o Xtaputil1.o: taputil1.c oplate.h taputil2.h tayutil.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil1.c X ar rcv libad.a taputil1.o Xtaputil2.o: taputil2.c dvlparms.h oplate.h taputil3.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil2.c X ar rcv libad.a taputil2.o Xtaputil3.o: taputil3.c dvlparms.h oplate.h tayutil.h taputil1.h taputil2.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) taputil3.c X ar rcv libad.a taputil3.o Xhos_forward.o: hos_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hos_forward.c X ar rcv libad.a hos_forward.o Xhov_forward.o: hov_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hov_forward.c X ar rcv libad.a hov_forward.o Xfov_forward.o: fov_forward.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fov_forward.c X ar rcv libad.a fov_forward.o Xhos_reverse.o: hos_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hos_reverse.c X ar rcv libad.a hos_reverse.o Xfos_reverse.o: fos_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fos_reverse.c X ar rcv libad.a fos_reverse.o Xhov_reverse.o: hov_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) hov_reverse.c X ar rcv libad.a hov_reverse.o Xfov_reverse.o: fov_reverse.c dvlparms.h taputil1.h taputil2.h taputil3.h tayutil.h oplate.h usrparms.h X $(MCC) -c $(CFLAGS) $(LIB) fov_reverse.c X ar rcv libad.a fov_reverse.o Xtayutil.o: tayutil.c dvlparms.h usrparms.h tayutil.h X $(MCC) -c $(CFLAGS) $(LIB) tayutil.c X ar rcv libad.a tayutil.o Xutils.o: utils.c tayutil.h taputil3.h X $(CC) -c $(CFLAGS) $(LIB) utils.c X ar rcv libad.a utils.o Xdriversc.o: driversc.c dvlparms.h adutilsc.h X $(MCC) -c $(CFLAGS) $(LIB) driversc.c X ar rcv libad.a driversc.o Xdrivers.o: drivers.c dvlparms.h adutils.h X $(CC) -c $(CFLAGS) $(LIB) drivers.c X ar rcv libad.a drivers.o Xclean: X /bin/rm *.o X END_OF_FILE if test 2873 -ne `wc -c <'makefile.src.xxx'`; then echo shar: \"'makefile.src.xxx'\" unpacked with wrong size! fi chmod +x 'makefile.src.xxx' # end of 'makefile.src.xxx' fi if test -f 'xxxinstall' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xxxinstall'\" else echo shar: Extracting \"'xxxinstall'\" \(464 characters\) sed "s/^X//" >'xxxinstall' <<'END_OF_FILE' X# -------------------------------------------------------------- X# File xxxinstall of ADOL-C version 1.6 as of January 1, 1995 X# -------------------------------------------------------------- X# xxxinstall copies X# the correct makefiles for ADOL-C itself into */SRC X# and for the examples into the subdirectories */SRC/EXA and */SRC/DEX. X Xcp makefile.src.xxx ../SRC/makefile Xcp makefile.dex.xxx ../SRC/DEX/makefile Xcp makefile.exa.xxx ../SRC/EXA/makefile X END_OF_FILE if test 464 -ne `wc -c <'xxxinstall'`; then echo shar: \"'xxxinstall'\" unpacked with wrong size! fi chmod +x 'xxxinstall' # end of 'xxxinstall' fi if test -f 'xxxuninstall' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xxxuninstall'\" else echo shar: Extracting \"'xxxuninstall'\" \(425 characters\) sed "s/^X//" >'xxxuninstall' <<'END_OF_FILE' X# --------------------------------------------------------------- X# File xxxuninstall of ADOL-C version 1.6 as of January 1, 1995 X# --------------------------------------------------------------- X Xcd ../SRC Xrm makefile X/bin/rm *.o X/bin/rm libad.a Xcd DEX Xrm makefile X/bin/rm *.o X/bin/rm *xam X/bin/rm _adol* X/bin/rm adoltemp.xxx Xcd ../EXA Xrm makefile X/bin/rm *.o X/bin/rm *xam X/bin/rm _adol* X/bin/rm adoltemp.xxx Xcd ../.. X END_OF_FILE if test 425 -ne `wc -c <'xxxuninstall'`; then echo shar: \"'xxxuninstall'\" unpacked with wrong size! fi chmod +x 'xxxuninstall' # end of 'xxxuninstall' fi echo shar: End of shell archive. exit 0 C*** src.shar #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'README' <<'END_OF_FILE' X -------------------------------------------------------------- X ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X XThe directory */SRC contains the directories XDEX (documented examples) XEXA (undocumented examples) Xand the files: Xadouble.c drivers.c hos_forward.c taputil1.h tayutil.h Xadouble.h driversc.c hos_reverse.c taputil2.c usrparms.h Xadutils.h dvlparms.h hov_forward.c taputil2.h utils.c Xadutilsc.h fos_reverse.c hov_reverse.c taputil3.c Xavector.c fov_forward.c oplate.h taputil3.h Xavector.h fov_reverse.c taputil1.c tayutil.c X XTo produce the ADOL-C library libad.a use the make command Xafter calling ???install. Read */INS/README for details. X END_OF_FILE if test 789 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi chmod +x 'README' # end of 'README' fi if test -f 'adouble.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'adouble.c'\" else echo shar: Extracting \"'adouble.c'\" \(26915 characters\) sed "s/^X//" >'adouble.c' <<'END_OF_FILE' X/* X -------------------------------------------------------------- X File adouble.c of ADOL-C version 1.6 as of January 1, 1995 X -------------------------------------------------------------- X Adouble.c contains that definitions of procedures used to defined various X badouble, adub, and adouble operations. These operations actually X have two purposes. X The first purpose is to actual compute the function, just as the same X code written for double precision (single precision - complex - interval) X arithmetic would. The second purpose is to write a transcript of the X computation for the reverse pass of automatic differentiation. X*/ X X/* Local Includes */ X X#include "adouble.h" X#include "oplate.h" X X/* Include these routines that are written in straight C. */ X Xextern "C" { X#include "taputil1.h" X} X X/* Include Files */ X X#include X#include X Xvoid condassign(double &res, const double &cond, const double &arg1, const double &arg2) X{ X res=cond ? arg1 : arg2; X} X Xvoid condassign(double &res, const double &cond, const double &arg1) X{ X res=cond ? arg1 : res; X} X X/* Global vars */ X Xdouble* store; Xint trace_flag =0; X Xstatic locint maxloc = sizeof(locint) ==2 ? 65535 : 2147483647; Xstatic locint current_top = 0; // = largest live location + 1 Xstatic locint location_cnt = 0 ; // = maximal # of lives so far Xstatic locint maxtop = 0; // = current size of store Xstatic locint maxtop2; Xstatic locint dealloc = 0; // = # of locations to be freed Xstatic locint deminloc = 0; // = lowest loc to be freed X X/*------------------------------------------------------*/ X/* The first several routines are for memory management */ X/*------------------------------------------------------*/ X X/* X Return the next free location in "adouble" memory X*/ Xlocint next_loc() X{ X/* First deallocate dead adoubles if they form a contiguous tail: */ X#ifdef overwrite X if (dealloc && dealloc+deminloc == current_top) X { X if(trace_flag) write_death(deminloc, current_top - 1); X current_top = deminloc ; X dealloc =0; X deminloc = maxloc; X } X#endif X if ( current_top == location_cnt) ++location_cnt ; X if ( location_cnt > maxtop ) X { X maxtop2 = ++maxtop*2 > maxloc ? maxloc : 2*maxtop; X if (maxtop2 == maxloc ) X { X printf("ADOL-C fatal error !! \n "); X printf("maximal number of live active variables exceeded\n\n"); X printf("Possible remedies :\n\n "); X printf(" 1. Use more automatic local variables and \n"); X printf(" allocate/deallocate adoubles on free store\n"); X printf(" in a strictly last in first out fashion\n\n"); X printf(" 2. Extend the range by redefining the type of \n"); X printf(" locint from unsigned short or int to int or long\n"); X exit(-3); X } X else X { X maxtop = maxtop2; X if(maxtop == 2) X { X store = (double *)malloc(maxtop*sizeof(double)); X deminloc = maxloc; X } X else X { X store = (double *)realloc((char *)store,maxtop*sizeof(double)); X } X if( store == 0) X { X printf("ADOL-C fatal error !! \n"); X printf("Failure to reallocate storage for adouble values\n"); X printf("Possible remedies :\n\n "); X printf(" 1. Use more automatic local variables and \n"); X printf(" allocate/deallocate adoubles on free store\n"); X printf(" in a strictly last in first out fashion\n"); X printf(" 2. Extend the range by redefining the type of\n"); X printf(" locint to unsigned short or int to int or long\n"); X printf(" 3. Enlarge your system stacksize limit\n"); X exit(-3); X } X } X } X return current_top++ ; X} X X Xlocint next_loc(int size) X{ X/* First deallocate dead adoubles if they form a contiguous tail: */ X X#ifdef overwrite X if (dealloc && dealloc+deminloc == current_top) X { X if(trace_flag) write_death(deminloc, current_top - 1); X current_top = deminloc ; X dealloc =0; X deminloc = maxloc; X } X#endif X if ( (current_top+size) >= location_cnt) location_cnt=current_top+size+1; X while ( location_cnt > maxtop ) X { X maxtop2 = ++maxtop*2 > maxloc ? maxloc : 2*maxtop; X if (maxtop2 == maxloc ) X { X printf("ADOL-C fatal error !! \n "); X printf("maximal number of live active variables exceeded\n\n"); X printf("Possible remedies :\n\n "); X printf(" 1. Use more automatic local variables and \n"); X printf(" allocate/deallocate adoubles on free store\n"); X printf(" in a strictly last in first out fashion\n\n"); X printf(" 2. Extend the range by redefining the type of \n"); X printf(" locint from unsigned short or int to int or long\n"); X exit(-3); X } X else X { X maxtop = maxtop2; X if(maxtop == 2) X { X store = (double *)malloc(maxtop*sizeof(double)); X deminloc = maxloc; X } X else X { X /* Allocate the storage */ X double *temp; X temp = (double *)malloc(maxtop*sizeof(double)); X X /* Copy over storage */ X for (int i=0; i 0) write_death(0,current_top - 1); X trace_flag = 0; X return location_cnt; X} X X X/*----------------------------------------------------------------*/ X/* The remaining routines define the badouble,adub,and adouble */ X/* routines. */ X/*----------------------------------------------------------------*/ X X/* Basic constructors */ X/* Xadub::adub(double y) X{ X location = next_loc(); X store[location] = y; X if (trace_flag) write_int_assign_d(location,y); X} X*/ Xadouble::adouble() X{ X location = next_loc(); X X} X Xadouble::adouble(double y) X{ X location = next_loc(); X store[location] = y; X if (trace_flag) write_int_assign_d(location,y); X} X Xadouble::adouble(const adouble& a) X{ X location = next_loc(); X store[location]=store[a.location]; X if (trace_flag) write_int_assign_a(location,a.location); X} X X Xadouble::adouble(const adub& a) X{ X location = next_loc(); X store[location]=store[a.loc()]; X if (trace_flag) write_int_assign_a(location,a.loc()); X} X X/* Destructors */ X X#ifdef overwrite Xadouble::~adouble() X{ X ++dealloc; X if (location < deminloc) deminloc = location; X} X Xadub::~adub() X{ X ++dealloc; X if (location < deminloc) deminloc = location; X} X X#ifdef conditional Xasub::~asub() X{ X ++dealloc; X if (location < deminloc) X deminloc = location; X} X#endif X X#endif X X/* X Member function returns the location of this adouble. X*/ Xlocint badouble::loc() const X{ X return location; X} X X/* X double returns the true floating point value of an adouble variable X*/ Xdouble value(const badouble& x) X{ X return store[x.location]; X} X X/* X Define what it means to assign an adouble variable a constant value. X*/ Xbadouble& badouble::operator = (double y) X{ X if (trace_flag) write_assign_d(location,y); X store[location]=y; X return *this; X} X X/* X Define what it means to assign an adouble variable an independent value. X*/ X Xbadouble& badouble::operator <<= (double y) X{ X if (trace_flag) write_assign_ind(location); X store[location]=y; X return *this; X} X X/* X Define what it means to assign a float variable a dependent adouble value. X*/ Xbadouble& badouble::operator >>= (double& y) X{ X if (trace_flag) write_assign_dep(location); X y = double (store[location]); X return *this; X} X X/* X Define what it means to assign an Badouble variable an Badouble value. X Optionally trace this action. X*/ Xbadouble& badouble::operator = (const badouble& x) X{ X if (trace_flag) write_assign_a(location,x.location); X store[location]=store[x.location]; X return *this; X} Xbadouble& badouble::operator = (const adub& a) X{ X if (trace_flag) write_assign_a(location,a.location); X store[location]=store[a.location] ; X return *this; X} X X/* X Define define what it means to output an adouble value. X No tracing of this action X*/ X Xostream& operator << (ostream& out,const badouble& y) X{ X return out << store[y.location] << "(a)" ; X} X X/* X Define define what it means to input adouble value. X*/ X Xistream& operator >> (istream& in,const badouble& y) X{ X double temp; X in >> temp; X store[y.location]=temp; X if (trace_flag) write_assign_d(y.location,temp); X return in; X} X X Xadub adouble::operator++(int) /* postfix increment */ X{ X locint locat = next_loc(); X store[locat]=store[location]; X if (trace_flag) write_assign_a(locat,location); X if (trace_flag) write_d_same_arg(eq_plus_d,location,1.0); X store[location]++; X return locat ; X} X Xadub adouble::operator--(int) /* postfix decrement */ X{ X locint locat = next_loc(); X store[locat]=store[location]; X if (trace_flag) write_assign_a(locat,location); X if (trace_flag) write_d_same_arg(eq_min_d,location,1.0); X store[location]--; X return locat ; X} X Xbadouble& adouble::operator++() /* prefix increment */ X{ X if (trace_flag) write_d_same_arg(eq_plus_d,location,1.0); X store[location]++; X return *this; X} X Xbadouble& adouble::operator--() /* prefix decrement */ X{ X if (trace_flag) write_d_same_arg(eq_min_d,location,1.0); X store[location]--; X return *this; X} X X X/* X Adding a floating point to an adouble. Optionally trace this action. X*/ Xbadouble& badouble::operator += (double y) X{ X if (trace_flag) write_d_same_arg(eq_plus_d,location,y); X store[location]+=y; X return *this; X} X X X/* X Subtracting a floating point from an adouble. Optionally trace this X activity. X*/ Xbadouble& badouble::operator -= (double y) X{ X if (trace_flag) write_d_same_arg(eq_min_d,location,y); X store[location]-=y; X return *this; X} X X/* X Add an adouble to another adouble. Optionally trace this action. X*/ Xbadouble& badouble::operator += (const badouble& y) X{ X if (trace_flag) write_a_same_arg(eq_plus_a,location,y.location); X store[location]+=store[y.location]; X return *this; X} X X/* X Subtract an adouble from another adouble. Optionally trace this execution. X*/ Xbadouble& badouble::operator -= (const badouble& y) X{ X if (trace_flag) write_a_same_arg(eq_min_a,location,y.location); X store[location]-=store[y.location]; X return *this; X} X X/* X Multiply an adouble by a float. Optionally trace this execution. X*/ Xbadouble& badouble::operator *= (double y) X{ X if (trace_flag) write_d_same_arg(eq_mult_d,location,y); X store[location]*=y; X return *this; X} X X/* X Multiply one badouble by another. Optional trace. X*/ Xbadouble& badouble::operator *= (const badouble& y) X{ X if (trace_flag) write_a_same_arg(eq_mult_a,location,y.location); X store[location]*=store[y.location]; X return *this; X} X Xbadouble& badouble::operator /= (double y) X{ X *this = *this/y; X return *this; X} X Xbadouble& badouble::operator /= (const badouble& y) X{ X *this = *this*(1.0/y); X return *this; X} X X/* The Not Equal Operator (!=) */ X Xint operator != (const badouble& u,const badouble& v) X{ X return store[u.location] != store[v.location]; X} X Xint operator != (double u,const badouble& v) X{ X return u != store[v.location]; X} X Xint operator != (const badouble& v,double u) X{ X return store[v.location] != u; X} X X/* The Equal Operator (==) */ X Xint operator == (const badouble& u,const badouble& v) X{ X return store[u.location] == store[v.location]; X} X Xint operator == (double u,const badouble& v) X{ X return u == store[v.location]; X} X Xint operator == (const badouble& v,double u) X{ X return store[v.location] == u; X} X X/* The Less than or Equal Operator (<=) */ X Xint operator <= (const badouble& u,const badouble& v) X{ X return store[u.location] <= store[v.location]; X} X Xint operator <= (double u,const badouble& v) X{ X return u <= store[v.location]; X} X Xint operator <= (const badouble& v,double u) X{ X return store[v.location] <= u; X} X X/* The Greater than or Equal Operator (>=) */ X Xint operator >= (const badouble& u,const badouble& v) X{ X return store[u.location] >= store[v.location]; X} X Xint operator >= (double u,const badouble& v) X{ X return u >= store[v.location]; X} X Xint operator >= (const badouble& v,double u) X{ X return store[v.location] >= u; X} X X/* The Greater than Operator (>) */ X Xint operator > (const badouble& u,const badouble& v) X{ X return store[u.location] > store[v.location]; X} X Xint operator > (double u,const badouble& v) X{ X return u > store[v.location]; X} X Xint operator > (const badouble& v,double u) X{ X return store[v.location] > u; X} X X/* The Less than Operator (<) */ X Xint operator < (const badouble& u,const badouble& v) X{ X return store[u.location] < store[v.location]; X} X Xint operator < (double u,const badouble& v) X{ X return u < store[v.location]; X} X Xint operator < (const badouble& v,double u) X{ X return store[v.location] < u; X} X X/* X Adding two badoubles. NOTE: calculates address of temporary, and returns X an adub. X*/ X Xadub operator + (const badouble& x, const badouble& y) X{ X locint locat = next_loc(); X store[locat]= store[x.location]+store[y.location]; X if (trace_flag) write_two_a_rec(plus_a_a,locat,x.location,y.location); X return locat; X} X X/* X Adding a badouble and a double. Optional trace. Temporary assignment. X*/ X Xadub operator + (double x, const badouble& y) X{ X locint locat = next_loc(); X store[locat]= x+store[y.location]; X if (trace_flag) write_args_d_a(plus_d_a,locat,x,y.location); X return locat; X} X Xadub operator + (const badouble& y, double x) X{ X locint locat = next_loc(); X store[locat]= x+store[y.location]; X if (trace_flag) write_args_d_a(plus_d_a,locat,x,y.location); X return locat; X} X X/* X Subtraction of two badoubles. Optional Trace. Temporary used. X*/ X Xadub operator - (const badouble& x, const badouble& y) X{ X locint locat = next_loc(); X store[locat]=store[x.location]-store[y.location]; X if (trace_flag) write_two_a_rec(min_a_a,locat,x.location,y.location); X return locat; X} X X/* X Subtract a badouble from a double. Optional trace. Temporary used. X*/ X Xadub operator - (double x, const badouble& y) X{ X locint locat = next_loc(); X store[locat]=x-store[y.location]; X if (trace_flag) write_args_d_a(min_d_a,locat,x,y.location); X return locat; X} X X X/* X Multiply two badouble numbers. Optional trace. Use temporary. X*/ X Xadub operator * (const badouble& x, const badouble& y) X{ X locint locat = next_loc(); X store[locat]=store[x.location]*store[y.location]; X if (trace_flag) write_two_a_rec(mult_a_a,locat,x.location,y.location); X return locat; X} X X/* X Multiply a badouble by a double. Optional Trace. X*/ X Xadub operator * (double x, const badouble& y) X{ X locint locat = next_loc(); X store[locat]=x*store[y.location]; X if (trace_flag) write_args_d_a(mult_d_a,locat,x,y.location); X return locat; X} X X/* X Divide a badouble by an badouble. X*/ X Xadub operator / (const badouble& x, const badouble& y) X{ X locint locat = next_loc(); X store[locat] = store[x.location]/store[y.location]; X if (trace_flag) write_two_a_rec(div_a_a,locat,x.location,y.location); X return locat; X} X X/* X Division double - badouble. X*/ X Xadub operator / (double x, const badouble& y) X{ X locint locat = next_loc(); X store[locat]= x/store[y.location]; X if (trace_flag) write_args_d_a(div_d_a,locat,x,y.location); X return locat; X} X X/* X Compute exponential of badouble. X*/ X Xadub exp (const badouble& x) X{ X locint locat = next_loc(); X store[locat]=exp(store[x.location]); X if (trace_flag) write_single_op(exp_op,locat,x.location); X return locat; X} X X/* X Compute logarithm of badouble. Optional Trace. Use temporary. X*/ X Xadub log (const badouble& x) X{ X locint locat = next_loc(); X store[locat]=log(store[x.location]); X if (trace_flag) write_single_op(log_op,locat,x.location); X return locat; X} X X/* X Compute sqrt of adouble. Optional Trace. Use temporary. X*/ X Xadub sqrt (const badouble& x) X{ X locint locat = next_loc(); X store[locat]=sqrt(store[x.location]); X if (trace_flag) write_single_op(sqrt_op,locat,x.location); X return locat; X} X X/* X Compute sin of badouble. Optional trace. X Note:Sin and Cos are always evaluated together X*/ Xadub sin (const badouble& x) X{ X locint locat = next_loc(); X store[locat]=sin(store[x.location]); X adouble y; X store[y.location]=cos(store[x.location]); X if (trace_flag) write_quad(sin_op,locat,x.location,y.location); X return locat; X} X X/* X Compute cos of badouble. Optional trace. X*/ X Xadub cos (const badouble& x) X{ X locint locat = next_loc(); X store[locat]=cos(store[x.location]); X adouble y; X store[y.location]=sin(store[x.location]); X if (trace_flag) write_quad(cos_op, locat,x.location,y.location); X return locat; X} X Xadub tan (const badouble& x) X{ X return sin(x)/cos(x); X} X X/* X Asin value. -- really a quadrature. Use temporary. Optional trace. X*/ X Xadub asin (const badouble& x) X{ X locint locat = next_loc(); X adouble y = 1.0/sqrt(1.0-x*x); X store[locat]=asin(store[x.location]); X if (trace_flag) write_quad(asin_op,locat,x.location,y.location); X return locat; X} X X/* X Acos value. -- really a quadrature. Use temporary. Optional trace. X*/ X Xadub acos (const badouble& x) X{ X locint locat = next_loc(); X adouble y = -1.0/sqrt(1.0-x*x); X store[locat]=acos(store[x.location]); X if (trace_flag) write_quad(acos_op,locat,x.location,y.location); X return locat; X} X X/* X Atan value. -- really a quadrature. Use temporary. Optional trace. X*/ X Xadub atan (const badouble& x) X{ X locint locat = next_loc(); X adouble y= 1.0/(1.0+x*x); X store[locat]=atan(store[x.location]); X if (trace_flag) write_quad(atan_op,locat,x.location,y.location); X return locat; X} X Xadub atan2(const badouble& y,const badouble& x) X{ X const double pihalf = asin(1.0); X double vx = value(x); X double vy = value(y); X double sy = (vy > 0) ? 1.0 : -1.0 ; X if(fabs(vx) > fabs(vy)) X { X if(vx>0) X return atan(y/x); X else X return atan(y/x)+sy*2*pihalf; X } X else X { X if(vy !=0) X return sy*pihalf-atan(x/y); X else X { /* nodifferentiable case */ X locint locat=next_loc(); X store[locat]=0.0; X if(trace_flag) write_int_assign_d(locat,0.0); X return locat; X } X } X} X X/* X power value. -- adouble/double . X*/ X Xadub pow (const badouble& x,double y) X{ X locint locat = next_loc(); X store[locat] = pow(store[x.location],y); X if (trace_flag) write_args_d_a(pow_op,locat,y,x.location); X return locat; X} X X/* X power value. --- adouble/adouble . X*/ X Xadub pow (const badouble& x,const badouble& y) X{ X double vx = store[x.location]; X if(vx>0) X return exp(y*log(x)); X else X { X double vy = store[y.location]; X if(vx < 0 || vy >= 0) X { X cout << "ADOL-C message: exponent of negative basis deactivated \n"; X return pow(x,value(y)); X } X else X cout << "ADOL-C message: negative exponent and zero basis deactivated \n"; X locint locat=next_loc(); X store[locat]=pow(vx,vy); X if(trace_flag) write_int_assign_d(locat,store[locat]); X return locat; X } X} X X/* X log base 10 of an adouble value. X*/ X Xadub log10 (const badouble& x) X{ X return log(x)/log(10); X} X X/* X Hyperbolic Sine of an adouble value. X*/ X Xad