ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a55.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_ccv_dble_prod(void);
14 
20 {
24 
25  int min = t1.indexmin();
26  int max = t1.indexmax();
27  dvar_vector tmp(min, max);
29  //x.save_prevariable_value();
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  ptmp->x = *pt1 * value_x;
37  ++ptmp;
38  ++pt1;
39  }
40  fp->save_dvector_value(t1);
42  fp->save_dvector_position(t1);
46  return tmp;
47 }
48 
54 {
58 
59  int min = t1.indexmin();
60  int max = t1.indexmax();
61  dvar_vector tmp(min, max);
63  //x.save_prevariable_value();
65  double_and_int* ptmp = tmp.va + min;
66  double* pt1 = t1.get_v() + min;
67  double value_x = value(x);
68  for (int i = min; i <= max; ++i)
69  {
70  ptmp->x = value_x * (*pt1);
71  ++ptmp;
72  ++pt1;
73  }
74  fp->save_dvector_value(t1);
76  fp->save_dvector_position(t1);
80  return tmp;
81 }
82 
87 void DF_ccv_dble_prod(void)
88 {
90 
96  //double x=restore_prevariable_value();
98  //dvector dft1(t1_pos.indexmin(),t1_pos.indexmax());
100  double dfx=0.;
101  int min = t1_pos.indexmin();
102  int max = t1_pos.indexmax();
103  double* pdftmp = dftmp.get_v() + max;
104  double* pt1 = t1.get_v() + max;
105  for (int i = max; i >= min; --i)
106  {
107  //tmp.elem_value(i)=value(x)*t1.elem_value(i)*value(x);
108  dfx += *pdftmp * (*pt1);
109  --pdftmp;
110  --pt1;
111  //dft1(i)=dftmp(i)*x;
112  }
113  save_double_derivative(dfx,xpos);
114  //dft1.save_dvector_derivatives(t1_pos);
115 }
Base class for dvariable.
Definition: fvar.hpp:1315
int indexmax() const
Definition: fvar.hpp:4936
Description not yet available.
Definition: fvar.hpp:4440
#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
Description not yet available.
Definition: fvar.hpp:4923
ADMB variable vector.
Definition: fvar.hpp:2172
void verify_identifier_string(const char *)
Verifies gradient stack string.
Definition: cmpdif3.cpp:149
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
void save_dvector_position(const dvector &v)
Definition: cmpdif4.cpp:32
prevariable_position restore_prevariable_position()
Definition: cmpdif8.cpp:43
void save_prevariable_position(const prevariable &v)
Definition: cmpdif8.cpp:60
void save_dvector_value(const dvector &v)
Definition: cmpdif4.cpp:130
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
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
dvector_position restore_dvector_position()
Definition: cmpdif4.cpp:88
void save_dvar_vector_position(const dvar_vector &v)
Definition: cmpdif3.cpp:214
static _THREAD DF_FILE * fp
int indexmin() const
Definition: fvar.hpp:4932
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
void DF_ccv_dble_prod(void)
Description not yet available.
Definition: fvar_a55.cpp:87