ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a24.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 
18  {
19  if (!(!(*this))) // only initialize allocated objects
20  {
21  for (int i=indexmin();i<=indexmax();i++)
22  {
23  //this->elem(i)=0.0;
24  va[i].x=0.0;
25  }
29  fp->save_dvar_vector_position(*this);
31  GRAD_STACK1->set_gradient_stack(dv_init);
32  }
33  }
34 
35 
40 void dv_init(void)
41 {
43 
44  // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
48  dvector dftmp(tmp_pos.indexmin(),tmp_pos.indexmax());
49  for (int i=dftmp.indexmin();i<=dftmp.indexmax();i++)
50  {
51  //vtmp.elem(i)=value(v1.elem(i))+value(v2.elem(i));
52  dftmp.elem(i)=0.0;
53  }
54  dftmp.save_dvector_derivatives_na(tmp_pos);
55  //ierr=fsetpos(gradient_structure::get_fp(),&filepos);
56 }
57 
58 
64  {
65  if (indexmin() != ww.indexmin() || indexmax() != ww.indexmax())
66  {
67  cerr << "Index bounds do not match in "
68  "void dvar_vector::initialize(const dvector& ww)"<<endl;
69  ad_exit(1);
70  }
71 
72  for (int i=indexmin();i<=indexmax();i++)
73  {
74  //this->elem(i)=0.0;
75  va[i].x=ww.elem(i);
76  }
80  fp->save_dvar_vector_position(*this);
82  GRAD_STACK1->set_gradient_stack(dv_init);
83  }
Description not yet available.
Definition: fvar.hpp:920
double & elem(int i)
Definition: dvector.h:152
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
void dv_init(void)
Description not yet available.
Definition: fvar_a24.cpp:40
Description not yet available.
Definition: fvar.hpp:4814
int indexmin() const
Definition: fvar.hpp:4827
exitptr ad_exit
Definition: gradstrc.cpp:53
void verify_identifier_string(const char *)
Verifies gradient stack string.
Definition: cmpdif3.cpp:149
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
prnstream & endl(prnstream &)
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
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int save_identifier_string(const char *)
Writes a gradient stack verification string.
Definition: cmpdif2.cpp:315
int indexmin() const
Definition: fvar.hpp:2287
void save_dvar_vector_position(const dvar_vector &v)
Definition: cmpdif3.cpp:214
void initialize(void)
Description not yet available.
Definition: fvar_a24.cpp:17
static _THREAD DF_FILE * fp
Stores the adjoint gradient data that will be processed by gradcalc.
double_and_int * va
Definition: fvar.hpp:2175
static _THREAD grad_stack * GRAD_STACK1
int indexmax() const
Definition: fvar.hpp:2292
double x
&lt; value of the variable
Definition: fvar.hpp:195