ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dvect16.cpp
Go to the documentation of this file.
1 
5 #include "fvar.hpp"
6 
13 {
14  int min = indexmin();
15  int max = indexmax();
16 #ifndef OPT_LIB
17  if (min != values.indexmin() || max != values.indexmax())
18  {
19  cerr << " Incompatible array bounds in "
20  << "dvector& operator+=(const dvector&)\n";
21  ad_exit(1);
22  }
23 #endif
24 
25  double* pvi = v + min;
26  const double* pvaluesi = values.get_v() + min;
27  for (int i = min; i <= max; ++i)
28  {
29  *pvi += *pvaluesi;
30  ++pvi;
31  ++pvaluesi;
32  }
33  return *this;
34 }
41 {
42  int min = indexmin();
43  int max = indexmax();
44 #ifndef OPT_LIB
45  if (min != values.indexmin() || max != values.indexmax())
46  {
47  cerr << " Incompatible array bounds in "
48  << "dvector& operator-=(const dvector&)\n";
49  ad_exit(1);
50  }
51 #endif
52  double* pvi = v + min;
53  const double* pvaluesi = values.get_v() + min;
54  for (int i = min; i <= max; ++i)
55  {
56  *pvi -= *pvaluesi;
57  ++pvi;
58  ++pvaluesi;
59  }
60  return *this;
61 }
68 {
69  int min = indexmin();
70  int max = indexmax();
71  double* pvi = v + min;
72  for (int i = min; i <= max; ++i)
73  {
74  *pvi += value;
75  ++pvi;
76  }
77  return *this;
78 }
85 {
86  int min = indexmin();
87  int max = indexmax();
88  double* pvi = v + min;
89  for (int i = min; i <= max; ++i)
90  {
91  *pvi -= value;
92  ++pvi;
93  }
94  return *this;
95 }
double * v
pointer to the data
Definition: dvector.h:53
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
friend double min(const dvector &)
Returns the minimum value of vector vec.
Definition: dvect7.cpp:107
exitptr ad_exit
Definition: gradstrc.cpp:53
friend double max(const dvector &)
Returns the maximum value of vector vec.
Definition: dvect7.cpp:85
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
values
Definition: adjson.h:22
dvector & operator-=(const dvector &v1)
Subtract values from dvector element-wise.
Definition: dvect16.cpp:40
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
double *& get_v(void)
Definition: dvector.h:148
dvector & operator+=(const dvector &v1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dvect16.cpp:12