ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a38.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_dv_dble_prod(void);
14 
20 {
23 
25 
26  int min = t1.indexmin();
27  int max = t1.indexmax();
28  dvar_vector tmp(min, max);
29  //save_identifier_string("ccbb");
32 
33  const double valuex = value(x);
34  double_and_int* ptmpi = tmp.va + min;
35  double_and_int* pt1i = t1.va + min;
36  for (int i = min; i <= max; ++i)
37  {
38  ptmpi->x = pt1i->x * valuex;
39  ++ptmpi;
40  ++pt1i;
41  }
42 
43  fp->save_dvar_vector_value(t1);
46  //save_identifier_string("DDaa");
48 
50 
51  return tmp;
52 }
53 
58 void DF_dv_dble_prod(void)
59 {
61 
62  //verify_identifier_string("DDaa");
67  double x=fp->restore_prevariable_value();
69  int min = t1_pos.indexmin();
70  int max = t1_pos.indexmax();
71  dvector dft1(min, max);
72  //verify_identifier_string("ccbb");
73  double dfx = 0.0;
74  double* pdftmpi = dftmp.get_v() + max;
75  double* pdft1i = dft1.get_v() + max;
76  double* pt1i = t1.get_v() + max;
77  for (int i = max; i >= min; --i)
78  {
79  //tmp.elem_value(i)=value(x)*t1.elem_value(i)*value(x);
80  dfx += *pdftmpi * *pt1i;
81  *pdft1i = *pdftmpi * x;
82 
83  --pdftmpi;
84  --pdft1i;
85  --pt1i;
86  }
87  save_double_derivative(dfx,xpos);
88  dft1.save_dvector_derivatives(t1_pos);
89 }
90 
96  {
97  return t1*x;
98  }
Base class for dvariable.
Definition: fvar.hpp:1315
Description not yet available.
Definition: fvar.hpp:4440
#define x
void save_prevariable_value(const prevariable &v)
Definition: cmpdif8.cpp:76
Vector of double precision numbers.
Definition: dvector.h:50
void save_dvector_derivatives(const dvar_vector_position &pos) const
Puts the derivative values in a dvector into a dvar_vector&#39;s guts.
Definition: cmpdif5.cpp:212
Description not yet available.
Definition: fvar.hpp:4814
int indexmin() const
Definition: fvar.hpp:4827
ADMB variable vector.
Definition: fvar.hpp:2172
dmatrix operator*(const d3_array &t, const dvector &v)
Description not yet available.
Definition: d3arr12.cpp:17
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
void save_dvar_vector_value(const dvar_vector &v)
Definition: cmpdif4.cpp:106
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
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
static _THREAD gradient_structure * _instance
dvector restore_dvar_vector_value(const dvar_vector_position &tmp)
Restores the size, address, and value information for a dvar_vector.
Definition: cmpdif4.cpp:227
void DF_dv_dble_prod(void)
Description not yet available.
Definition: fvar_a38.cpp:58
int indexmin() const
Definition: fvar.hpp:2287
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
double restore_prevariable_value()
Definition: cmpdif8.cpp:168
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
int indexmax() const
Definition: fvar.hpp:2292
double x
&lt; value of the variable
Definition: fvar.hpp:195