ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvma_acc.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 #ifndef OPT_LIB
14 
22 {
23  if (i < rowmin())
24  {
25  cerr << "matrix row bound exceeded -- row index " << i
26  << " is lower than " << rowmin() << " in "
27  << __FILE__ << ':' << __LINE__ << ".\n";
28  ad_exit(1);
29  }
30  if (i > rowmax())
31  {
32  cerr << "matrix row bound exceeded -- row index " << i
33  << " is higher than " << rowmax() << " in "
34  << __FILE__ << ':' << __LINE__ << ".\n";
35  ad_exit(1);
36  }
37  dvar_vector* pmi = m + i;
38  if (j < pmi->indexmin())
39  {
40  cerr << "matrix column bound exceeded -- column index " << i
41  << " is lower than " << elem(i).indexmin() << " in "
42  << __FILE__ << ':' << __LINE__ << ".\n";
43  ad_exit(1);
44  }
45  if (j > pmi->indexmax())
46  {
47  cerr << "matrix column bound exceeded -- column index " << i
48  << " is higher than " << elem(i).indexmax() << " in "
49  << __FILE__ << ':' << __LINE__ << ".\n";
50  ad_exit(1);
51  }
52  return pmi->va + j;
53 }
60 {
61  if (i < rowmin())
62  {
63  cerr << "matrix row bound exceeded -- row index " << i
64  << " is lower than " << rowmin() << " in "
65  << __FILE__ << ':' << __LINE__ << ".\n";
66  ad_exit(1);
67  }
68  if (i > rowmax())
69  {
70  cerr << "matrix row bound exceeded -- row index " << i
71  << " is higher than " << rowmax() << " in "
72  << __FILE__ << ':' << __LINE__ << ".\n";
73  ad_exit(1);
74  }
75  return m[i];
76 }
83 const prevariable dvar_matrix::operator()(int i, int j) const
84 {
85  if (i < rowmin())
86  {
87  cerr << "matrix row bound exceeded -- row index " << i
88  << " is lower than " << rowmin() << " in "
89  << __FILE__ << ':' << __LINE__ << ".\n";
90  ad_exit(1);
91  }
92  if (i > rowmax())
93  {
94  cerr << "matrix row bound exceeded -- row index " << i
95  << " is higher than " << rowmax() << " in "
96  << __FILE__ << ':' << __LINE__ << ".\n";
97  ad_exit(1);
98  }
99  dvar_vector* pmi = m + i;
100  if (j < pmi->indexmin())
101  {
102  cerr << "matrix column bound exceeded -- column index " << i
103  << " is lower than " << elem(i).indexmin() << " in "
104  << __FILE__ << ':' << __LINE__ << ".\n";
105  ad_exit(1);
106  }
107  if (j > pmi->indexmax())
108  {
109  cerr << "matrix column bound exceeded -- column index " << i
110  << " is higher than " << elem(i).indexmax() << " in "
111  << __FILE__ << ':' << __LINE__ << ".\n";
112  ad_exit(1);
113  }
114  return pmi->va + j;
115 }
121 const dvar_vector& dvar_matrix::operator[](int i) const
122 {
123  if (i < rowmin())
124  {
125  cerr << "matrix row bound exceeded -- row index " << i
126  << " is lower than " << rowmin() << " in "
127  << __FILE__ << ':' << __LINE__ << ".\n";
128  ad_exit(1);
129  }
130  if (i > rowmax())
131  {
132  cerr << "matrix row bound exceeded -- row index " << i
133  << " is higher than " << rowmax() << " in "
134  << __FILE__ << ':' << __LINE__ << ".\n";
135  ad_exit(1);
136  }
137  return m[i];
138 }
139 #endif
Base class for dvariable.
Definition: fvar.hpp:1315
int rowmax(void) const
Definition: fvar.hpp:2564
dvar_vector & elem(int i)
Definition: fvar.hpp:2507
dvar_vector & operator[](int)
Definition: fvar.hpp:2769
exitptr ad_exit
Definition: gradstrc.cpp:53
ADMB variable vector.
Definition: fvar.hpp:2172
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int rowmin(void) const
Definition: fvar.hpp:2560
int indexmin() const
Definition: fvar.hpp:2287
double_and_int * va
Definition: fvar.hpp:2175
dvar_vector & operator()(int i)
Definition: fvar.hpp:2776
int indexmin(void) const
Definition: fvar.hpp:2568
int indexmax() const
Definition: fvar.hpp:2292
dvar_vector * m
Definition: fvar.hpp:2484