ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ivec9.cpp
Go to the documentation of this file.
1 
6 #include "fvar.hpp"
7 
14 {
15  int min = indexmin();
16  int max = indexmax();
17 #ifndef OPT_LIB
18  if (min != other.indexmin() || max != other.indexmax())
19  {
20  cerr << " Incompatible vector indexes in "
21  << "ivector::operator+=(const ivector&).\n";
22  ad_exit(1);
23  }
24 #endif
25  int* pvi = v + min;
26  int* potheri = other.get_v() + min;
27  for (int i = min; i <= max; ++i)
28  {
29  *pvi += *potheri;
30 
31  ++pvi;
32  ++potheri;
33  }
34  return *this;
35 }
42 {
43  int min = indexmin();
44  int max = indexmax();
45  int* pvi = v + min;
46  for (int i = min; i <= max; ++i)
47  {
48  *pvi += value;
49  ++pvi;
50  }
51  return *this;
52 }
exitptr ad_exit
Definition: gradstrc.cpp:53
ivector & operator+=(const ivector &t)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: ivec9.cpp:13
int * get_v() const
Definition: ivector.h:114
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
#define min(a, b)
Definition: cbivnorm.cpp:188
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 * v
Definition: ivector.h:55
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
#define max(a, b)
Definition: cbivnorm.cpp:189