ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a32.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 #ifndef OPT_LIB
14  #include <cassert>
15  #include <climits>
16 #endif
17 
18 void dv_subassign(void);
19 
25  {
26  dvar_vector tmp(u.indexmin(),u.indexmax());
27 
28  for (int i=u.indexmin();i<=u.indexmax();i++)
29  {
30  tmp.elem_value(i)=elem_value(u(i));
31  }
32 
36  fp->save_dvar_vector_position(*this);
38  fp->save_ivector_value(u);
39  fp->save_ivector_position(u);
41  GRAD_STACK1->set_gradient_stack(dv_subassign);
42 
43  return tmp;
44  }
45 
51 {
53 
54  // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
61  dvector dft(t_pos.indexmin(),t_pos.indexmax());
63  dft.initialize();
64  int mmin=dftmp.indexmin();
65  int mmax=dftmp.indexmax();
66  for (int i=mmin;i<=mmax;i++)
67  {
68  //tmp.elem_value(i)=this->elem_value(u(i));
69  dft.elem(u(i))+=dftmp.elem(i);
70  }
71  dft.save_dvector_derivatives(t_pos);
72 }
73 
79  {
80  dvar_vector tmp(u.indexmin(),u.indexmax());
81  for ( int i=u.indexmin(); i<=u.indexmax(); i++)
82  {
83 #ifdef OPT_LIB
84  tmp(i)=(*this)((int)u(i));
85 #else
86  const AD_LONG_INT ui = u(i);
87  assert(ui <= INT_MAX);
88  tmp(i)=(*this)((int)ui);
89 #endif
90  }
91  return tmp;
92  }
Description not yet available.
Definition: fvar.hpp:920
double & elem(int i)
Definition: dvector.h:152
double & elem_value(int i)
Definition: fvar.hpp:2226
void save_ivector_position(const ivector &v)
Definition: cmpdif3.cpp:198
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
ivector_position restore_ivector_position()
Definition: cmpdif4.cpp:49
int indexmin() const
Definition: fvar.hpp:676
void dv_subassign(void)
Description not yet available.
Definition: fvar_a32.cpp:50
Description not yet available.
Definition: fvar.hpp:656
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
int indexmax() const
Definition: fvar.hpp:681
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
dvar_vector operator()(int lb, int ub)
Definition: fvar.hpp:2202
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
int indexmax() const
Definition: fvar.hpp:4831
dvar_vector_position restore_dvar_vector_position()
Definition: cmpdif4.cpp:69
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
Description not yet available.
Definition: fvar.hpp:4947
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: ivector.h:99
int indexmax() const
Definition: ivector.h:104
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
ivector restore_ivector_value(const ivector_position &tmp)
Description not yet available.
Definition: cmpdif4.cpp:198
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
#define AD_LONG_INT
Definition: fvar.hpp:81
static _THREAD grad_stack * GRAD_STACK1
void save_ivector_value(const ivector &v)
Definition: cmpdif4.cpp:152