ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a54.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include "fvar.hpp"
12 
13  void DF_v_xdble_diff(void);
14 
20  {
24 
25  int min = t1.indexmin();
26  int max = t1.indexmax();
27  dvar_vector tmp(min, max);
30 
31  double_and_int* ptmp = tmp.va + min;
32  double* pt1 = t1.get_v() + min;
33  double value_x = value(x);
34  for (int i = min; i <= max; ++i)
35  {
36  //tmp.elem_value(i)=t1.elem(i)-value(x);
37  ptmp->x = *pt1 - value_x;
38  ++ptmp;
39  ++pt1;
40  }
45  return(tmp);
46  }
47 
52  void DF_v_xdble_diff(void)
53  {
55 
61  //double xinv=1./x;
62  int min = tmp_pos.indexmin();
63  int max = tmp_pos.indexmax();
64  double dfx = 0.0;
65  double* pdftmp = dftmp.get_v() + max;
66  for (int i = max; i >= min; --i)
67  {
68  // tmp.elem_value(i)=t1.elem(i)-value(x);
69  //dfx -= dftmp(i);
70  dfx -= *pdftmp;
71  --pdftmp;
72  }
73  save_double_derivative(dfx,xpos);
74  }
Base class for dvariable.
Definition: fvar.hpp:1315
Description not yet available.
Definition: fvar.hpp:4440
void DF_v_xdble_diff(void)
Description not yet available.
Definition: fvar_a54.cpp:52
d3_array operator-(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements addition of a(i, j, k) + b(i, j, k).
Definition: d3arr2a.cpp:152
#define x
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
Description not yet available.
Definition: fvar.hpp:4814
int indexmin() const
Definition: fvar.hpp:4827
ADMB variable vector.
Definition: fvar.hpp:2172
void verify_identifier_string(const char *)
Verifies gradient stack string.
Definition: cmpdif3.cpp:149
Holds the data for the prevariable class.
Definition: fvar.hpp:191
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.
Definition: fvar.hpp:1045
prevariable_position restore_prevariable_position()
Definition: cmpdif8.cpp:43
void save_prevariable_position(const prevariable &v)
Definition: cmpdif8.cpp:60
int indexmax() const
Definition: fvar.hpp:4831
dvar_vector_position restore_dvar_vector_position()
Definition: cmpdif4.cpp:69
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
#define min(a, b)
Definition: cbivnorm.cpp:188
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
static _THREAD gradient_structure * _instance
int save_identifier_string(const char *)
Writes a gradient stack verification string.
Definition: cmpdif2.cpp:315
void save_dvar_vector_position(const dvar_vector &v)
Definition: cmpdif3.cpp:214
static _THREAD DF_FILE * fp
Stores the adjoint gradient data that will be processed by gradcalc.
dvector restore_dvar_vector_derivatives(const dvar_vector_position &tmp)
Description not yet available.
Definition: cmpdif5.cpp:150
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
double_and_int * va
Definition: fvar.hpp:2175
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
void save_double_derivative(const double x, const prevariable_position &_pos)
Description not yet available.
Definition: cmpdif8.cpp:28
static _THREAD grad_stack * GRAD_STACK1
#define max(a, b)
Definition: cbivnorm.cpp:189
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
double *& get_v(void)
Definition: dvector.h:148
double x
&lt; value of the variable
Definition: fvar.hpp:195