21 #include <iostream.hpp>
24 #if defined (__WAT32__)
34 #include <sys/types.h>
41 #include <sys/types.h>
45 #if defined(__NDPX__ )
47 int LSEEK(
int,
int,
int);
48 int read(
int,
char*,
int);
62 #define ISZERO(d) ((d)==0.0)
67 void _far * _cdecl _farptr_norm(
void _far *);
68 void _far * _cdecl _farptr_fromlong(
unsigned long);
69 long _cdecl _farptr_tolong(
void _far *);
81 cerr <<
"Error: No instance of gradient data structure.\n";
107 OFF_T lpos =
LSEEK(_GRADFILE_PTR,0L,SEEK_CUR);
113 "warning -- calling funnel_gradcalc when no calculations generating"
114 <<
endl <<
"derivative information have occurred" <<
endl;
138 #if defined (__ZTC__)
154 #ifdef FAST_ASSEMBLER
170 if (funnel_flag)
break;
177 }
while (break_flag);
188 cout <<
"Offset in file at end of gradcalc is " << ttmp
189 <<
" bytes from the beginning\n";
194 constexpr
size_t sizeofdouble =
sizeof(double);
197 unsigned long bytes_needed =
min(
200 size_t _dsize = bytes_needed / sizeofdouble;
202 assert(_dsize <= INT_MAX);
204 int dsize = (int)_dsize;
233 for (
int i1=1;i1<dsize;i1++)
260 for (
int i=0;i<ii;i++)
273 double* pstmpi = stmp.
get_v();
275 for (
int i=0; i < nlinks; ++i)
277 memcpy((
char*)pstmpi, *dlink_addresses, sizeofdouble);
320 for (i=ii-1;i>=0;i--)
328 for (i=dcount-1;i>=0;i--)
342 for (i=0;i<dcount;i++)
345 if (++ic==offset(ii))
358 double* pstmpi = stmp.
get_v();
364 *((
double*)(*dlink_addresses)) += *pstmpi * df;
double restore_prevariable_derivative(const prevariable_position &_pos)
Description not yet available.
Base class for dvariable.
void read(const test_smartlist &, void *, int nsize)
void memcpy(test_smartlist &dest, void *source, const size_t nsize)
memcpy for test_smartlist
Description not yet available.
friend void funnel_derivatives(void)
Description not yet available.
Vector of double precision numbers.
static int no_derivatives
static unsigned long ARRAY_MEMBLOCK_SIZE
Holds derivative information for arithmetic operators and math library functions. ...
dvariable & operator=(const prevariable &)
Description not yet available.
Description not yet available.
void verify_identifier_string(const char *)
Verifies gradient stack string.
void save_int_value(int x)
void funnel_derivatives(void)
Description not yet available.
dvector restore_dvector_value(const dvector_position &tmp)
Holds the data for the prevariable class.
void set_gradient_stack(void(*func)(void), double *dep_addr, double *ind_addr1=NULL, double mult1=0, double *ind_addr2=NULL, double mult2=0)
Description not yet available.
void funnel_gradcalc()
Description not yet available.
humungous_pointer ARRAY_MEMBLOCK_BASE
void save_dvector_position(const dvector &v)
prnstream & endl(prnstream &)
Array of integers(int) with indexes from index_min to indexmax.
unsigned long int max_last_offset
prevariable_position restore_prevariable_position()
size_t PREVIOUS_TOTAL_BYTES
void save_dvector_value(const dvector &v)
unsigned long int get_max_last_offset()
int indexmax() const
Get maximum valid index.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
double restore_double_value()
static _THREAD gradient_structure * _instance
grad_stack_entry * ptr_first
int save_identifier_string(const char *)
Writes a gradient stack verification string.
void ad_begin_funnel(void)
Description not yet available.
dvector_position restore_dvector_position()
dvariable & operator=(const double x)
Assigns a value to a dvariable object.
static _THREAD DF_FILE * fp
void save_variables()
Save variables to a buffer.
int read_grad_stack_buffer(OFF_T &lpos)
Description not yet available.
Stores the adjoint gradient data that will be processed by gradcalc.
void restore_variables()
Restore variables from buffer.
void fwrite(const void *s, const size_t num_bytes)
Reads num_bytes from s and writes to buffer.
void save_arrays()
Compute the gradient from the data stored in the global gradient_structure.
void save_double_value(double x)
static _THREAD grad_stack * GRAD_STACK1
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
void(* func)(void)
< Pointer to function (if any) to be used for derivative calculation
double * dep_addr
Pointer to dependent variable.
Fundamental data type for reverse mode automatic differentiation.
double x
< value of the variable