ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_op4.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 // file: fvar_ops.cpp
12 // operators involving prevariables
13 
14 //#undef OPT_LIB
15 #include "fvar.hpp"
16 
17 #ifdef __TURBOC__
18  #pragma hdrstop
19  #include <iostream.h>
20 #endif
21 
22 #ifdef __ZTC__
23  #include <iostream.hpp>
24 #endif
25 
26 #include <stdio.h>
27 #include <math.h>
28 
29 #ifndef OPT_LIB
30 
36  {
37  if (i<indexmin())
38  {
39  cerr << "array bound exceeded -- index too low in "
40  "prevariable::operator[]";
41  ad_exit(1);
42  }
43  if (i>indexmax())
44  {
45  cerr << "array bound exceeded -- index too high in "
46  "prevariable::operator[]";
47  ad_exit(1);
48  }
49  //((va+i)->nc)++;
50  return (va+i);
51  }
52 
58  {
59  if (i<indexmin())
60  {
61  cerr << "array bound exceeded -- index too low in "
62  "prevariable::operator()";
63  ad_exit(1);
64  }
65  if (i>indexmax())
66  {
67  cerr << "array bound exceeded -- index too high in "
68  "prevariable::operator()";
69  ad_exit(1);
70  }
71  //((va+i)->nc)++;
72  return (va+i);
73  }
74 
79 const prevariable dvar_vector::operator[](int i) const
80  {
81  if (i<indexmin())
82  {
83  cerr << "array bound exceeded -- index too low in "
84  "prevariable::operator[]";
85  ad_exit(1);
86  }
87  if (i>indexmax())
88  {
89  cerr << "array bound exceeded -- index too high in "
90  "prevariable::operator[]";
91  ad_exit(1);
92  }
93  //((va+i)->nc)++;
94  return (va+i);
95  }
96 
101 const prevariable dvar_vector::operator()(int i) const
102  {
103  if (i<indexmin())
104  {
105  cerr << "array bound exceeded -- index too low in "
106  "prevariable::operator()";
107  ad_exit(1);
108  }
109  if (i>indexmax())
110  {
111  cerr << "array bound exceeded -- index too high in "
112  "prevariable::operator()";
113  ad_exit(1);
114  }
115  //((va+i)->nc)++;
116  return (va+i);
117  }
118 #endif
Base class for dvariable.
Definition: fvar.hpp:1315
prevariable operator[](int i)
Definition: fvar.hpp:2327
exitptr ad_exit
Definition: gradstrc.cpp:53
dvar_vector operator()(int lb, int ub)
Definition: fvar.hpp:2202
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: fvar.hpp:2287
double_and_int * va
Definition: fvar.hpp:2175
int indexmax() const
Definition: fvar.hpp:2292