41 #ifndef __ADMB_GRADIENT_STRUCTURE_H__
42 #define __ADMB_GRADIENT_STRUCTURE_H__
49 #define size_t long int
96 #define _THREAD __thread
98 #define __thread __declspec(thread)
130 void create(
const unsigned int size);
137 #if defined(NO_DERIVS)
233 void jacobcalc(
int nvar,
const ofstream& jac);
241 #if defined(NO_DERIVS)
292 DF_FILE(
const size_t nbytes,
const unsigned int id);
308 void fwrite(
const void *s,
const size_t num_bytes);
309 void fread(
void *s,
const size_t num_bytes);
312 void fread(
const int &);
315 void fread(
const double &);
317 void fread(
void *&ptr);
379 #if defined(_MSC_VER) || defined(__MINGW64__)
Description not yet available.
void save_d3_array_value(const d3_array &a)
d3_array restore_d3_array_value(const d3_array_position &mpos)
indvar_offset_list * INDVAR_LIST
static int NUM_DEPENDENT_VARIABLES
Description not yet available.
Base class for dvariable.
static void set_ARRAY_MEMBLOCK_SIZE(unsigned long i)
Set the the maximum amount of memory (in bytes) available for the autodif variable type container cla...
void gradcalc(int nvar, const dvector &g)
Compute the gradient from the data stored in the global gradient_structure.
friend void default_evaluation(void)
Description not yet available.
void jacobcalc(int nvar, const dmatrix &jac)
Description not yet available.
Description not yet available.
Description not yet available.
static void set_NO_DERIVATIVES(void)
Disable accumulation of derivative information.
double restore_prevariable_derivative()
friend dmatrix restore_dvar_matrix_value(void)
Description not yet available.
void save_ivector_position(const ivector &v)
static void set_GRADSTACK_BUFFER_SIZE(const size_t i)
Set the number of entries contained in the buffer that, in turn, contains the information necessary f...
virtual ~gradient_structure()
Destructor.
dependent_variables_information * DEPVARS_INFO
void create(const unsigned int size)
Allocate array of gradient_structure instances with size elements.
friend void funnel_derivatives(void)
Description not yet available.
static void set_USE_FOR_HESSIAN(const long int i)
DF_FILE()
Default uses gradient_structure::CMPDIF_BUFFER_SIZE.
friend dvector restore_dvar_vector_value(const dvar_vector_position &tmp)
Restores the size, address, and value information for a dvar_vector.
void save_prevariable_value(const prevariable &v)
void save_imatrix_position(const imatrix &m)
Vector of double precision numbers.
ivector_position restore_ivector_position()
void save_dmatrix_position(const dmatrix &m)
static int no_derivatives
static unsigned long ARRAY_MEMBLOCK_SIZE
Description not yet available.
static long int USE_FOR_HESSIAN
char cmpdif_file_name[81]
Description not yet available.
dmatrix_position restore_dmatrix_position()
friend void cleanup_temporary_files()
Close gradient and variable files and free gradient structure memory.
imatrix restore_imatrix_value(const imatrix_position &mpos)
static unsigned int NUM_RETURN_ARRAYS
Description not yet available.
void save_dmatrix_value(const dmatrix &m)
static void check_set_error(const char *variable_name)
Produce error if gradient structure hasn't been set.
void save_dependent_variable_position(const prevariable &)
Description not yet available.
int operator==(void *p)
Description not yet available.
friend dvar_vector_position restore_dvar_vector_position(void)
Description not yet available.
static void set_NUM_RETURN_ARRAYS(unsigned int i)
Set the maximum allowable depth of nesting of functions that return autodif variable types...
gradient_structure(const long int size)
static unsigned int get_MAX_DLINKS()
void save_int_value(int x)
static unsigned int MAX_NVAR_OFFSET
humungous_pointer & operator=(void *p)
Description not yet available.
dvector restore_dvector_value(const dvector_position &tmp)
dmatrix restore_dmatrix_value(const dmatrix_position &mpos)
friend void slave_gradcalc(void)
Holds the data for the prevariable class.
void write_cmpdif_stack_buffer()
Description not yet available.
friend dmatrix restore_dvar_matrix_derivatives(void)
void read_cmpdif_stack_buffer(OFF_T &lpos)
Description not yet available.
DF_FILE(const size_t nbytes)
User defined size with default id.
dmatrix restore_dvar_matrix_value(const dvar_matrix_position &mpos)
static unsigned int RETURN_ARRAYS_SIZE
static void set_MAX_NVAR_OFFSET(unsigned int i)
Set the the maximum number of independent variables that can be used.
size_t totalbytes(void)
Description not yet available.
void save_dvector_position(const dvector &v)
Array of integers(int) with indexes from index_min to indexmax.
Description not yet available.
unsigned long int max_last_offset
prevariable_position restore_prevariable_position()
static dvariable * next_RETURN_PTR()
static unsigned long get_ARRAY_MEMBLOCK_SIZE()
size_t PREVIOUS_TOTAL_BYTES
void save_prevariable_position(const prevariable &v)
static DF_FILE * get_fp()
void save_dvector_value(const dvector &v)
dvector restore_dvar_vector_value(const dvar_vector_position &tmp)
void save_dvar_vector_value(const dvar_vector &v)
dvar_vector_position restore_dvar_vector_position()
void RETURN_ARRAYS_INCREMENT()
friend void wide_funnel_gradcalc(void)
Description not yet available.
size_t NUM_GRADSTACK_BYTES_WRITTEN()
Description not yet available.
void clean()
Delete gradient_structure instances.
Description not yet available.
void make_indvar_list(const dvar_vector &t)
char fourb[sizeof(OFF_T)]
static gradient_structure * reset(gradient_structure *)
double restore_double_value()
humungous_pointer operator+(unsigned long int &offset)
Note that pointer addition is in bytes not the size of the object pointed to.
static _THREAD gradient_structure * _instance
dvariable ** RETURN_PTR_CONTAINER
void adjust(const size_t)
Description not yet available.
Description not yet available.
Description not yet available.
gradient_structure * set(const unsigned int id)
Set _instance of gradient_structure from instances with id.
void save_d3_array_position(const d3_array &a)
static void set_CMPDIF_BUFFER_SIZE(const size_t i)
Set the size in bytes of the buffer used to contain the information generated by the "precompiled" de...
static long int get_USE_FOR_HESSIAN()
friend void allocate_dvariable_space(void)
Description not yet available.
humungous_pointer & operator+=(unsigned long int &offset)
Note that pointer addition is in bytes not the size of the object pointed to.
dvector_position restore_dvector_position()
static void set_GRADSTACK_BUFFER_BYTES(const size_t i)
Set (in bytes) the number of entries contained in the buffer used for calculating derivatives...
void save_dvar_vector_position(const dvar_vector &v)
dvar_matrix_position restore_dvar_matrix_position()
static _THREAD DF_FILE * fp
static void set_YES_SAVE_VARIABLES_VALUES()
Description not yet available.
static void set_NUM_DEPENDENT_VARIABLES(int i)
Description not yet available.
dvariable ** RETURN_ARRAYS
static grad_stack * get_GRAD_STACK1()
void save_variables()
Save variables to a buffer.
void save_dvar_matrix_position(const dvar_matrix &m)
static int Hybrid_bounded_flag
static void set_RETURN_ARRAYS_SIZE(unsigned int i)
Set the return arrays size controlling the amount of complexity that one line of arithmetic can have...
static void set_NO_SAVE_VARIABLES_VALUES()
Description not yet available.
Class definition of matrix with derivitive information .
unsigned int RETURN_ARRAYS_PTR
Stores the adjoint gradient data that will be processed by gradcalc.
void * restore_pointer_value()
static size_t get_GRADSTACK_BUFFER_SIZE()
void restore_variables()
Restore variables from buffer.
int operator!=(void *p)
Description not yet available.
ivector restore_ivector_value(const ivector_position &tmp)
d3_array_position restore_d3_array_position()
void fwrite(const void *s, const size_t num_bytes)
Reads num_bytes from s and writes to buffer.
double restore_prevariable_value()
void save_dvar_matrix_value(const dvar_matrix &m)
void fread(void *s, const size_t num_bytes)
Reads num_bytes from buffer and copies to s.
Description not yet available.
static void set_YES_DERIVATIVES(void)
Enable accumulation of derivative information.
void save_arrays()
Compute the gradient from the data stored in the global gradient_structure.
void RETURN_ARRAYS_DECREMENT()
static unsigned int MAX_DLINKS
friend void gradfree(dlink *v)
Description not yet available.
void save_pointer_value(void *ptr)
void save_double_value(double x)
humungous_pointer()
Default constructor.
void save_imatrix_value(const imatrix &m)
static size_t GRADSTACK_BUFFER_SIZE
Description not yet available.
static _THREAD grad_stack * GRAD_STACK1
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
Description not yet available.
DF_FILE & operator=(const DF_FILE &)=delete
Do not allow assignment operator.
void free()
Description not yet available.
friend dvector restore_dvar_vector_derivatives(void)
imatrix_position restore_imatrix_position()
friend double_and_int * gradnew()
Creates an entry in the gradient structure linked list.
Description not yet available.
gradient_structure & operator=(const gradient_structure &)=delete
Fundamental data type for reverse mode automatic differentiation.
void save_ivector_value(const ivector &v)
gradient_structure ** gradients
static void set_MAX_DLINKS(int i)
Set the maximum number of dvariable objects that can be in scope at one time.
grad_stack * _GRAD_STACK1
unsigned int gradients_size
Description not yet available.
static size_t CMPDIF_BUFFER_SIZE