3 |
Copyright (C) 1993 Joseph James Zaher |
Copyright (C) 1993 Joseph James Zaher |
4 |
Copyright (C) 1993, 1994 Benjamin Andrew Allan, Joseph James Zaher |
Copyright (C) 1993, 1994 Benjamin Andrew Allan, Joseph James Zaher |
5 |
Copyright (C) 1996 Benjamin Andrew Allan, Kenneth Tyner |
Copyright (C) 1996 Benjamin Andrew Allan, Kenneth Tyner |
6 |
Copyright (C) 2006 Carnegie Mellon University |
Copyright (C) 2006, 2010 Carnegie Mellon University |
7 |
|
|
8 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
9 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
59 |
/*----------- static function declarations & defines --------------*/ |
/*----------- static function declarations & defines --------------*/ |
60 |
static void TapeList_set_current(TapeList *tapes, unsigned index); |
static void TapeList_set_current(TapeList *tapes, unsigned index); |
61 |
static Element *TapeList_get_active_tape(TapeList *tapes); |
static Element *TapeList_get_active_tape(TapeList *tapes); |
62 |
static void TapeList_set_element(TapeList *tapes, Element *element); |
|
63 |
|
|
64 |
static Element *TapeList_current_tape_insert(TapeList *tapes); |
static Element *TapeList_current_tape_insert(TapeList *tapes); |
65 |
static Element *Element_insert(Element **element); |
static Element *Element_insert(Element **element); |
66 |
static Redouble MakeIndepv(double value,unsigned long sindex,Element *tape,enum Expr_enum expr_type); |
static Redouble MakeIndepv(double value,unsigned long sindex,Element *tape,enum Expr_enum expr_type); |
68 |
static int AccumulateAdjoints(Element *trace, double* gradients); |
static int AccumulateAdjoints(Element *trace, double* gradients); |
69 |
static int ReturnSweepSafe(Element *trace, int both_sides,enum safe_err *serr); |
static int ReturnSweepSafe(Element *trace, int both_sides,enum safe_err *serr); |
70 |
static int AccumulateAdjointsSafe(Element *trace,double *gradients,enum safe_err *serr); |
static int AccumulateAdjointsSafe(Element *trace,double *gradients,enum safe_err *serr); |
71 |
|
|
72 |
|
#ifdef INCLUDE_UNUSED_FUNCTIONS |
73 |
|
static void TapeList_set_element(TapeList *tapes, Element *element); |
74 |
static int check_inst_and_res(struct Instance *i, double *res); |
static int check_inst_and_res(struct Instance *i, double *res); |
75 |
static void PrintTape(Element *trace); |
static void PrintTape(Element *trace); |
76 |
static Element* TapeRewind(Element *trace); |
static Element* TapeRewind(Element *trace); |
77 |
|
#endif |
78 |
|
|
79 |
static Element* TapeRewindInitFwd(Element *trace,unsigned long var_index); |
static Element* TapeRewindInitFwd(Element *trace,unsigned long var_index); |
80 |
static int ReturnSweep2ndDeriv(Element *trace); |
static int ReturnSweep2ndDeriv(Element *trace); |
81 |
static int AccumulateDeriv2nd(Element *trace,double *deriv2nd,unsigned long num_var,int hessian_calc); |
static int AccumulateDeriv2nd(Element *trace,double *deriv2nd,unsigned long num_var,int hessian_calc); |
639 |
return tapes->tape[tapes->active]; |
return tapes->tape[tapes->active]; |
640 |
} |
} |
641 |
|
|
642 |
|
#ifdef INCLUDE_UNUSED_FUNCTIONS |
643 |
static void TapeList_set_element(TapeList *tapes, Element *element){ |
static void TapeList_set_element(TapeList *tapes, Element *element){ |
644 |
tapes->tape[tapes->active] = element; |
tapes->tape[tapes->active] = element; |
645 |
} |
} |
646 |
|
#endif |
647 |
|
|
648 |
/** |
/** |
649 |
Insert a new element at start of stack, return the new element so that it |
Insert a new element at start of stack, return the new element so that it |
943 |
return 0; |
return 0; |
944 |
} |
} |
945 |
|
|
946 |
|
#ifdef INCLUDE_UNUSED_FUNCTIONS |
947 |
/** |
/** |
948 |
Prints the contents of the tape for Debugging Purposes. |
Prints the contents of the tape for Debugging Purposes. |
949 |
@param trace is the tape on which the trace has been logged. |
@param trace is the tape on which the trace has been logged. |
971 |
tracer = tracer->next; |
tracer = tracer->next; |
972 |
} |
} |
973 |
} |
} |
974 |
|
#endif |
975 |
|
|
976 |
/**----------------------Second Derivative Routines -----------------------------*/ |
/**----------------------Second Derivative Routines -----------------------------*/ |
977 |
|
|
1463 |
} |
} |
1464 |
|
|
1465 |
/**------------------------------------------------------------------------------- */ |
/**------------------------------------------------------------------------------- */ |
1466 |
|
#ifdef INCLUDE_UNUSED_FUNCTIONS |
1467 |
/** |
/** |
1468 |
Rewinds the tape |
Rewinds the tape |
1469 |
@param trace is the tape on which trace information has been recorded |
@param trace is the tape on which trace information has been recorded |
1476 |
} |
} |
1477 |
return head; |
return head; |
1478 |
} |
} |
1479 |
|
#endif |
1480 |
|
|
1481 |
/** |
/** |
1482 |
Rewinds the tape & prepares it for a forward sweep by clearing values for |
Rewinds the tape & prepares it for a forward sweep by clearing values for |
1586 |
unsigned long dimension) |
unsigned long dimension) |
1587 |
{ |
{ |
1588 |
Element* hess_tape; |
Element* hess_tape; |
1589 |
Element* temp_tape; |
// Element* temp_tape; |
1590 |
double residual; |
double residual; |
1591 |
double *row_pointer=NULL; |
double *row_pointer=NULL; |
1592 |
unsigned long i; |
unsigned long i; |
1626 |
enum safe_err *serr) |
enum safe_err *serr) |
1627 |
{ |
{ |
1628 |
Element* hess_tape; |
Element* hess_tape; |
1629 |
Element* temp_tape; |
// Element* temp_tape; |
1630 |
double residual; |
double residual; |
1631 |
double *row_pointer; |
double *row_pointer; |
1632 |
unsigned long i; |
unsigned long i; |
1679 |
|
|
1680 |
/**---------------------------------------------------------------------------*/ |
/**---------------------------------------------------------------------------*/ |
1681 |
/* extra stuff from relation_util.c, just copied temporarily? -- JP */ |
/* extra stuff from relation_util.c, just copied temporarily? -- JP */ |
1682 |
|
#ifdef INCLUDE_UNUSED_FUNCTIONS |
1683 |
#ifndef NDEBUG |
#ifndef NDEBUG |
1684 |
/** |
/** |
1685 |
Utility function to perform debug checking of (input) instance and residual |
Utility function to perform debug checking of (input) instance and residual |
1711 |
return 1; |
return 1; |
1712 |
return 1; |
return 1; |
1713 |
} |
} |
|
|
|
1714 |
#endif |
#endif |
1715 |
|
#endif |
1716 |
|
|