ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dvec_acc.cpp
Go to the documentation of this file.
1 
8 #include "fvar.hpp"
9 #include <cassert>
10 
11 
17 bool dvector::is_valid_index(const int i) const
18 {
19  bool valid = index_min <= i && i <= index_max;
20  if (!valid)
21  {
22 #if defined(USE_EXCEPTIONS)
24 #else
25  cerr << "Error: Used invalid i = " << i << " for dvector bounded by ["
26  << index_min << ", " << index_max << "].\n";
27 #endif
28  }
29  return valid;
30 }
31 #if !defined(OPT_LIB)
32 
37 double& dvector::operator[](int i)
38 {
39  assert((index_min <= i && i <= index_max));
40 
41  return *(v + i);
42 }
48 double& dvector::operator()(int i)
49 {
50  assert((index_min <= i && i <= index_max));
51 
52  return *(v + i);
53 }
59 const double& dvector::operator[](int i) const
60 {
61  assert((index_min <= i && i <= index_max));
62 
63  return *(v + i);
64 }
70 const double& dvector::operator()(int i) const
71 {
72  assert((index_min <= i && i <= index_max));
73 
74  return *(v + i);
75 }
76 #endif
double * v
pointer to the data
Definition: dvector.h:53
Description not yet available.
Definition: fvar.hpp:7926
double & operator[](int i)
Definition: dvector.h:343
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int index_min
minimum valid subscript
Definition: dvector.h:54
int index_max
maximum valid subscript
Definition: dvector.h:55
dvector operator()(int lb, int ub)
Get subvector.
Definition: dvector.h:108
bool is_valid_index(const int i) const
Check index i is in dvector bounds [index_min, index_max].
Definition: dvec_acc.cpp:17