ADMB Documentation  11.1.2192
 All Classes Files Functions Variables Typedefs Friends Defines
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
gradient_structure Class Reference

class for things related to the gradient structures, including dimension of arrays, size of buffers, etc. More...

#include <gradient_structure.h>

Classes

class  arrmemblerr

Public Member Functions

 gradient_structure (long int size=100000L)
 Description not yet available.
 ~gradient_structure (void)
 Description not yet available.

Static Public Member Functions

static double * get_ARRAY_MEMBLOCK_BASE ()
static DF_FILEget_fp (void)
static int get_USE_FOR_HESSIAN (void)
static void jacobcalc (int nvar, const dmatrix &jac)
 Description not yet available.
static void jacobcalc (int nvar, const ofstream &jac)
 Description not yet available.
static void jacobcalc (int nvar, const uostream &jac)
 Description not yet available.
static long int NUM_GRADSTACK_BYTES_WRITTEN (void)
 Description not yet available.
static void restore_arrays (void)
static void restore_variables (void)
 Restore variables from buffer.
static void save_arrays (void)
static void save_dependent_variable_position (const prevariable &v1)
 Description not yet available.
static void save_variables (void)
 Save variables to a buffer.
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 class objects.
static void set_CMPDIF_BUFFER_SIZE (long long int i)
 Set the size in bytes of the buffer used to contain the information generated by the "precompiled" derivative code.
static void set_GRADSTACK_BUFFER_BYTES (long long int i)
 Set (in bytes) the number of entries contained in the buffer used for calculating derivatives.
static void set_GRADSTACK_BUFFER_SIZE (long long int i)
 Set the number of entries contained in the buffer that, in turn, contains the information necessary for calculating derivatives.
static void set_MAX_DLINKS (int i)
 Set the maximum number of dvariable objects that can be in scope at one time.
static void set_MAX_NVAR_OFFSET (unsigned int i)
 Set the the maximum number of independent variables that can be used.
static void set_NO_SAVE_VARIABLES_VALUES ()
 Description not yet available.
static void set_NUM_DEPENDENT_VARIABLES (int i)
 Description not yet available.
static void set_NUM_RETURN_ARRAYS (int i)
 Set the maximum allowable depth of nesting of functions that return autodif variable types.
static void set_RETURN_ARRAYS_SIZE (int i)
 Set the return arrays size controlling the amount of complexity that one line of arithmetic can have.
static void set_USE_FOR_HESSIAN (int i)
static void set_YES_SAVE_VARIABLES_VALUES ()
 Description not yet available.
static long int totalbytes (void)
 Description not yet available.

Static Public Attributes

static arr_listARR_FREE_LIST1 = NULL
static arr_listARR_LIST1 = NULL
static dlistGRAD_LIST
static grad_stackGRAD_STACK1
static double * hessian_ptr = NULL
static int Hybrid_bounded_flag = 0
static long int max_last_offset = 0
static dvariableMAX_RETURN = NULL
static dvariableMIN_RETURN = NULL
static int RETURN_ARRAYS_SIZE = 70
static dvariableRETURN_PTR = NULL

Static Private Member Functions

static void check_set_error (const char *variable_name)
 Produce error if gradient structure hasn't been set.

Private Attributes

int x

Static Private Attributes

static humungous_pointer ARRAY_MEMBLOCK_BASE
static humungous_pointer ARRAY_MEMBLOCK_BASEA
static humungous_pointer ARRAY_MEMBLOCK_SAVE
static unsigned long ARRAY_MEMBLOCK_SIZE = 0L
static long long int CMPDIF_BUFFER_SIZE = 140000000L
static char cmpdif_file_name [61]
static
dependent_variables_information
DEPVARS_INFO = NULL
static DF_FILEfp = NULL
static long long int GRADSTACK_BUFFER_SIZE = 4000000L
static indvar_offset_listINDVAR_LIST = NULL
static int instances = 0
static unsigned int MAX_DLINKS = 5000
static unsigned int MAX_NVAR_OFFSET = 5000
static int NUM_DEPENDENT_VARIABLES = 2000
static int NUM_RETURN_ARRAYS = 25
static long int NVAR = 0
static long int PREVIOUS_TOTAL_BYTES = 0
static dvariable ** RETURN_ARRAYS = NULL
static int RETURN_ARRAYS_PTR
static dvariable ** RETURN_PTR_CONTAINER = NULL
static int save_var_file_flag = 0
static int save_var_flag = 0
static long int TOTAL_BYTES = 0
static long int USE_FOR_HESSIAN = 0
static double * variables_save = NULL

Friends

void allocate_dvariable_space (void)
 Description not yet available.
void arr_free (double_and_int *)
 Description not yet available.
double_and_intarr_new (unsigned int sz)
 Description not yet available.
void cleanup_temporary_files ()
 Close gradient and variable files.
void default_evaluation (void)
 Description not yet available.
class DF_FILE
class dfsdmat
class dlist
class function_minimizer
void funnel_derivatives (void)
 Description not yet available.
void funnel_gradcalc (void)
 Description not yet available.
class grad_stack
void gradcalc (int nvar, const dvector &g)
 Compute the gradient from the data stored in the global gradient_structure.
void gradfree (dlink *v)
 Description not yet available.
double_and_intgradnew ()
 Creates an entry in the gradient structure linked list.
void make_indvar_list (const dvar_vector &t)
 Description not yet available.
dmatrix restore_dvar_matrix_derivatives (void)
dmatrix restore_dvar_matrix_value (void)
dvector restore_dvar_vector_derivatives (void)
dvar_vector_position restore_dvar_vector_position (void)
 Description not yet available.
dvector restore_dvar_vector_value (const dvar_vector_position &tmp)
 Restores the size, address, and value information for a dvar_vector.
void RETURN_ARRAYS_DECREMENT (void)
 Decrements gradient_structure::RETURN_ARRAYS_PTR.
void RETURN_ARRAYS_INCREMENT (void)
 Increments gradient_structure::RETURN_ARRAYS_PTR.
void slave_gradcalc (void)
void wide_funnel_gradcalc (void)

Detailed Description

class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.

Definition at line 96 of file gradient_structure.h.


Constructor & Destructor Documentation

gradient_structure::gradient_structure ( long int  _size = 100000L)

Description not yet available.

Parameters:

Definition at line 273 of file gradstrc.cpp.

Description not yet available.

Parameters:

Definition at line 577 of file gradstrc.cpp.


Member Function Documentation

void gradient_structure::check_set_error ( const char *  variable_name) [static, private]

Produce error if gradient structure hasn't been set.

Parameters:
variable_namestring with variable name

Definition at line 21 of file gs_set.cpp.

Referenced by set_ARRAY_MEMBLOCK_SIZE(), set_MAX_DLINKS(), set_MAX_NVAR_OFFSET(), and set_NUM_RETURN_ARRAYS().

static double* gradient_structure::get_ARRAY_MEMBLOCK_BASE ( ) [inline, static]
static DF_FILE* gradient_structure::get_fp ( void  ) [inline, static]
static int gradient_structure::get_USE_FOR_HESSIAN ( void  ) [inline, static]

Definition at line 155 of file gradient_structure.h.

Referenced by dfsdmat::allocate().

void gradient_structure::jacobcalc ( int  nvar,
const dmatrix _jac 
) [static]

Description not yet available.

Parameters:

Definition at line 82 of file jacobclc.cpp.

void gradient_structure::jacobcalc ( int  nvar,
const ofstream &  _ofs 
) [static]

Description not yet available.

Parameters:

Definition at line 69 of file jacob2.cpp.

void gradient_structure::jacobcalc ( int  nvar,
const uostream ofs 
) [static]

Description not yet available.

Parameters:

Definition at line 69 of file jacob3.cpp.

Description not yet available.

Parameters:

Definition at line 138 of file gradstrc.cpp.

void gradient_structure::restore_arrays ( void  ) [static]

Definition at line 298 of file sgradclc.cpp.

Referenced by funnel_gradcalc(), gradcalc(), and jacobcalc().

void gradient_structure::restore_variables ( void  ) [static]

Restore variables from buffer.

Definition at line 376 of file sgradclc.cpp.

Referenced by funnel_gradcalc(), gradcalc(), and jacobcalc().

void gradient_structure::save_arrays ( void  ) [static]

Definition at line 230 of file sgradclc.cpp.

Referenced by funnel_gradcalc(), and gradcalc().

Description not yet available.

Parameters:

Definition at line 111 of file depvars.cpp.

Referenced by operator<<().

void gradient_structure::save_variables ( void  ) [static]

Save variables to a buffer.

Definition at line 355 of file sgradclc.cpp.

Referenced by funnel_gradcalc(), and gradcalc().

void gradient_structure::set_ARRAY_MEMBLOCK_SIZE ( unsigned long  i) [static]

Set the the maximum amount of memory (in bytes) available for the autodif variable type container class objects.

Parameters:
ivalue in bytes

Definition at line 57 of file gs_set.cpp.

void gradient_structure::set_CMPDIF_BUFFER_SIZE ( long long int  i) [static]

Set the size in bytes of the buffer used to contain the information generated by the "precompiled" derivative code.

Parameters:
ivalue in bytes

Definition at line 75 of file gs_set.cpp.

Referenced by function_minimizer::function_minimizer().

void gradient_structure::set_GRADSTACK_BUFFER_BYTES ( long long int  i) [static]

Set (in bytes) the number of entries contained in the buffer used for calculating derivatives.

This is an alternative to set_GRADSTACK_BUFFER_SIZE which is in units of "gs_size" rather than bytes.

Author:
Ian Taylor
Parameters:
imemory allocation in bytes

Definition at line 171 of file gs_set.cpp.

void gradient_structure::set_GRADSTACK_BUFFER_SIZE ( long long int  i) [static]

Set the number of entries contained in the buffer that, in turn, contains the information necessary for calculating derivatives.

For historical reasons, the actual amount of memory (in bytes) reserved for the buffer is equal to the value of GRADSTACK_BUFFER_SIZE multiplied by the size (in bytes) of an autodif structure, grad_stack_entry. See also set_GRADSTACK_BUFFER_BYTES which performs the same function but with input in units of bytes

Parameters:
imemory allocation in units of "gs_size" (which is about 36 bytes)

Definition at line 118 of file gs_set.cpp.

Referenced by function_minimizer::function_minimizer().

void gradient_structure::set_MAX_DLINKS ( int  i) [static]

Set the maximum number of dvariable objects that can be in scope at one time.

Parameters:
ithe value to set

Definition at line 226 of file gs_set.cpp.

void gradient_structure::set_MAX_NVAR_OFFSET ( unsigned int  i) [static]

Set the the maximum number of independent variables that can be used.

Parameters:
ithe value to set

Definition at line 216 of file gs_set.cpp.

Description not yet available.

Parameters:

Definition at line 728 of file gradstrc.cpp.

Description not yet available.

Parameters:

Definition at line 737 of file gradstrc.cpp.

Set the maximum allowable depth of nesting of functions that return autodif variable types.

Parameters:
inumber of return arrays

Definition at line 46 of file gs_set.cpp.

Set the return arrays size controlling the amount of complexity that one line of arithmetic can have.

Parameters:
isize of return arrays

Definition at line 36 of file gs_set.cpp.

static void gradient_structure::set_USE_FOR_HESSIAN ( int  i) [inline, static]

Definition at line 159 of file gradient_structure.h.

Description not yet available.

Parameters:

Definition at line 719 of file gradstrc.cpp.

long int gradient_structure::totalbytes ( void  ) [static]

Description not yet available.

Parameters:

Definition at line 159 of file gradstrc.cpp.


Friends And Related Function Documentation

void allocate_dvariable_space ( void  ) [friend]

Description not yet available.

Parameters:

Definition at line 218 of file gradstrc.cpp.

void arr_free ( double_and_int varr) [friend]

Description not yet available.

Parameters:

Definition at line 243 of file newdar.cpp.

double_and_int* arr_new ( unsigned int  sz) [friend]

Description not yet available.

Parameters:

Definition at line 87 of file newdar.cpp.

void cleanup_temporary_files ( ) [friend]

Close gradient and variable files.

Free gradient structure memory.

Definition at line 170 of file gradstrc.cpp.

Referenced by gradient_structure().

void default_evaluation ( void  ) [friend]

Description not yet available.

Parameters:

Definition at line 61 of file def_eval.cpp.

friend class DF_FILE [friend]

Definition at line 210 of file gradient_structure.h.

Referenced by gradient_structure().

friend class dfsdmat [friend]

Definition at line 163 of file gradient_structure.h.

friend class dlist [friend]

Definition at line 241 of file gradient_structure.h.

Referenced by gradient_structure().

friend class function_minimizer [friend]

Definition at line 245 of file gradient_structure.h.

void funnel_derivatives ( void  ) [friend]

Description not yet available.

Parameters:
void funnel_gradcalc ( void  ) [friend]

Description not yet available.

Parameters:

Definition at line 73 of file xgradclc.cpp.

friend class grad_stack [friend]

Definition at line 242 of file gradient_structure.h.

Referenced by gradient_structure().

void gradcalc ( int  nvar,
const dvector g 
) [friend]

Compute the gradient from the data stored in the global gradient_structure.

Parameters:
nvarNumber of variables in the gradient.
_gVector from 1 to nvar. On return contains the gradient.

Definition at line 77 of file sgradclc.cpp.

void gradfree ( dlink v) [friend]

Description not yet available.

Parameters:

Definition at line 57 of file fvar2.cpp.

double_and_int* gradnew ( ) [friend]

Creates an entry in the gradient structure linked list.

Returns:
Pointer instance of class double_and_int

Definition at line 33 of file fvar2.cpp.

void make_indvar_list ( const dvar_vector t) [friend]

Description not yet available.

Parameters:

Definition at line 148 of file fvar_arr.cpp.

dmatrix restore_dvar_matrix_value ( void  ) [friend]

Description not yet available.

Parameters:

Definition at line 56 of file cmpdif4.cpp.

Restores the size, address, and value information for a dvar_vector.

Back up the stream and read the number of bytes written in the write function'' corresponding to thisread function''

Parameters:

Definition at line 178 of file cmpdif4.cpp.

void RETURN_ARRAYS_DECREMENT ( void  ) [friend]

Decrements gradient_structure::RETURN_ARRAYS_PTR.

Must be called prior to exit from any functiton that returns a variable object. Calls must balance calls to void RETURN_ARRAYS_INCREMENT(void).

Definition at line 548 of file gradstrc.cpp.

void RETURN_ARRAYS_INCREMENT ( void  ) [friend]

Increments gradient_structure::RETURN_ARRAYS_PTR.

Must be called on entry to any function that returns a variable object. Calls must balance calls to void RETURN_ARRAYS_DECREMENT(void).

Definition at line 516 of file gradstrc.cpp.

void slave_gradcalc ( void  ) [friend]
void wide_funnel_gradcalc ( void  ) [friend]

Member Data Documentation

Definition at line 201 of file gradient_structure.h.

Definition at line 115 of file gradient_structure.h.

Definition at line 116 of file gradient_structure.h.

unsigned long gradient_structure::ARRAY_MEMBLOCK_SIZE = 0L [static, private]

Definition at line 113 of file gradient_structure.h.

Referenced by arr_new(), funnel_gradcalc(), and gradient_structure().

long long int gradient_structure::CMPDIF_BUFFER_SIZE = 140000000L [static, private]

Definition at line 128 of file gradient_structure.h.

Referenced by gradient_structure().

char gradient_structure::cmpdif_file_name [static, private]

Definition at line 98 of file gradient_structure.h.

Referenced by gradient_structure().

DF_FILE * gradient_structure::fp = NULL [static, private]

Definition at line 192 of file gradient_structure.h.

Referenced by acos(), ad_begin_funnel(), asin(), atan(), betacf(), bounded_cumd_norm(), check_derivative_values(), check_derivative_values_break(), choleski_decomp(), choleski_decomp_positive(), cos(), cosh(), cube(), cumd_norm(), daves_kludge1(), default_evaluation(), default_evaluation0(), default_evaluation1(), default_evaluation1m(), default_evaluation2(), default_evaluation3(), default_evaluation3ind(), default_evaluation4(), default_evaluation4ind(), default_evaluation4m(), det(), df_eq_pvdoub(), df_minus_eq_pvpv(), df_plus_eq_pvpv(), dvariable::dvariable(), elem_div(), elem_prod(), empirical_covariance(), exp(), fabs(), first_difference(), fourth(), funnel_gradcalc(), gammlnguts(), grad_chk(), gradcalc(), gradient_structure(), dvar_vector::initialize(), dvar_matrix::initialize(), insert_identifier_string(), inv(), inv_cumd_beta_stable(), inv_cumd_gamma(), inv_cumd_norm_inner(), inv_cumd_normal_logistic_mixture(), inv_cumd_normal_mixture(), jacobcalc(), ldexp(), ln_det(), ln_det_choleski(), ln_det_choleski_error(), log(), log10(), mfexp(), dvar_vector::operator()(), operator*(), prevariable::operator*=(), operator+(), prevariable::operator+=(), dvar_vector::operator+=(), operator-(), dvar_vector::operator-(), prevariable::operator-=(), dvar_vector::operator-=(), operator/(), prevariable::operator/=(), dvar_vector::operator/=(), prevariable::operator=(), dvariable::operator=(), dvar_vector::operator=(), outer_prod(), pow(), grad_stack::read_grad_stack_buffer(), report_derivatives(), reset_gradient_stack(), restore_arrays(), save_arrays(), save_dependent_variable_position(), set_gradstack_flag(), sfabs(), sigmoid(), sin(), sinh(), solve(), sqr(), sqrt(), square(), sum(), tan(), tanh(), trans(), varchol(), and ~gradient_structure().

long long int gradient_structure::GRADSTACK_BUFFER_SIZE = 4000000L [static, private]

Definition at line 129 of file gradient_structure.h.

Referenced by grad_stack::grad_stack().

double * gradient_structure::hessian_ptr = NULL [static]

Definition at line 154 of file gradient_structure.h.

Referenced by dfsdmat::allocate(), and gradient_structure().

int gradient_structure::instances = 0 [static, private]
unsigned int gradient_structure::MAX_DLINKS = 5000 [static, private]
long int gradient_structure::max_last_offset = 0 [static]

Definition at line 244 of file gradient_structure.h.

Referenced by arr_new().

unsigned int gradient_structure::MAX_NVAR_OFFSET = 5000 [static, private]

Definition at line 131 of file gradient_structure.h.

Referenced by gradient_structure(), make_indvar_list(), and set_MAX_NVAR_OFFSET().

int gradient_structure::NUM_DEPENDENT_VARIABLES = 2000 [static, private]
int gradient_structure::NUM_RETURN_ARRAYS = 25 [static, private]
long int gradient_structure::NVAR = 0 [static, private]
long int gradient_structure::PREVIOUS_TOTAL_BYTES = 0 [static, private]
dvariable ** gradient_structure::RETURN_ARRAYS = NULL [static, private]

Definition at line 108 of file gradient_structure.h.

Referenced by gradient_structure(), and ~gradient_structure().

Definition at line 110 of file gradient_structure.h.

Referenced by gradient_structure(), and ~gradient_structure().

int gradient_structure::save_var_file_flag = 0 [static, private]

Definition at line 132 of file gradient_structure.h.

Referenced by restore_arrays(), and save_arrays().

int gradient_structure::save_var_flag = 0 [static, private]
long int gradient_structure::TOTAL_BYTES = 0 [static, private]
long int gradient_structure::USE_FOR_HESSIAN = 0 [static, private]

Definition at line 105 of file gradient_structure.h.

Referenced by get_USE_FOR_HESSIAN(), and set_USE_FOR_HESSIAN().

double * gradient_structure::variables_save = NULL [static, private]

Definition at line 123 of file gradient_structure.h.

int gradient_structure::x [private]

Definition at line 145 of file gradient_structure.h.

List of all members.


The documentation for this class was generated from the following files: