ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a25.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 dv_pluseq(void);
14 
20 {
21  int min = v1.indexmin();
22  int max = v1.indexmax();
23 
24 #ifndef OPT_LIB
25  if (indexmin() != v1.indexmin() || indexmax() != v1.indexmax())
26  {
27  cerr << " Incompatible array bounds in dvector& operator+=(const dvar_vector&)\n";
28  ad_exit(21);
29  }
30 #endif
31 
32  double_and_int* pvai = va + min;
33  double_and_int* pv1i = v1.va + min;
34  for (int i = min; i <= max; ++i)
35  {
36  pvai->x += pv1i->x;
37 
38  ++pvai;
39  ++pv1i;
40  }
41 
44  //save_identifier_string("uuvv");
45  fp->save_dvar_vector_position(*this); // for this->
47  //save_identifier_string("wwxx");
48  GRAD_STACK1->set_gradient_stack(dv_pluseq);
49 
50  return *this;
51 }
52 
57 void dv_pluseq(void)
58 {
60 
61  // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
62  //verify_identifier_string("wwxx");
65  //verify_identifier_string("uuvv");
66  dvector dfthis=restore_dvar_vector_der_nozero(this_pos);
67  dfthis.save_dvector_derivatives(v1_pos);
68 }
69 
75 {
76  int min = v1.indexmin();
77  int max = v1.indexmax();
78  if (indexmin() != v1.indexmin() || indexmax() != v1.indexmax())
79  {
80  cerr << " Incompatible array bounds in dvector& operator+=(const dvar_vector&)\n";
81  ad_exit(21);
82  }
83  double* pv1i = v1.get_v() + min;
84  for (int i = min; i <= max; ++i)
85  {
86  elem_value(i) += *pv1i;
87 
88  ++pv1i;
89  }
90  return *this;
91 }
Description not yet available.
Definition: fvar.hpp:920
double & elem_value(int i)
Definition: fvar.hpp:2226
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
void dv_pluseq(void)
Description not yet available.
Definition: fvar_a25.cpp:57
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
exitptr ad_exit
Definition: gradstrc.cpp:53
ADMB variable vector.
Definition: fvar.hpp:2172
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
dvar_vector_position restore_dvar_vector_position()
Definition: cmpdif4.cpp:69
#define min(a, b)
Definition: cbivnorm.cpp:188
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
dvar_vector & operator+=(const prevariable &d)
Adds d to each element of dvar_vector.
Definition: fvar_a30.cpp:55
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvector restore_dvar_vector_der_nozero(const dvar_vector_position &tmp)
Description not yet available.
Definition: cmpdif5.cpp:185
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.
double_and_int * va
Definition: fvar.hpp:2175
static _THREAD grad_stack * GRAD_STACK1
#define max(a, b)
Definition: cbivnorm.cpp:189
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