ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a26.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_minuseq(void);
14 
20  {
21  if (indexmin() != v1.indexmin() || indexmax() != v1.indexmax())
22  {
23  cerr << " Incompatible array bounds in "
24  "dvector& operator += (const dvar_vector&)\n";
25  ad_exit(21);
26  }
27 
28  {
29  for (int i=indexmin();i<=indexmax();i++)
30  {
31  elem_value(i) -= v1.elem_value(i);
32  }
33  }
36  save_identifier_string("uuvv");
37  fp->save_dvar_vector_position(*this); // for this->
39  save_identifier_string("wwxx");
40  GRAD_STACK1->set_gradient_stack(dv_minuseq);
41 
42  return *this;
43  }
44 
49 void dv_minuseq(void)
50 {
52 
53  // int ierr=fsetpos(gradient_structure::get_fp(),&filepos);
58  dvector dfthis=-1.*restore_dvar_vector_der_nozero(this_pos);
59  dfthis.save_dvector_derivatives(v1_pos);
60 }
61 
67  {
68  if (indexmin() != v1.indexmin() || indexmax() != v1.indexmax())
69  {
70  cerr << " Incompatible array bounds in "
71  "dvector& operator += (const dvar_vector&)\n";
72  ad_exit(21);
73  }
74 
75  {
76  for (int i=indexmin();i<=indexmax();i++)
77  {
78  elem_value(i) -= v1.elem(i);
79  }
80  }
81  return(*this);
82  }
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
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
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
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
dvar_vector & operator-=(const prevariable &d)
Substracts d from each element of dvar_vector.
Definition: fvar_a30.cpp:17
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
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.
void dv_minuseq(void)
Description not yet available.
Definition: fvar_a26.cpp:49
static _THREAD grad_stack * GRAD_STACK1
int indexmax() const
Definition: fvar.hpp:2292