ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dmat_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 #include "admb_messages.h"
13 
14 #if !defined(OPT_LIB)
15 
20 {
21  if (i < rowmin())
22  {
23  ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too low",
24  "dvector& dmatrix::operator[] (int i)", rowmin(), rowmax(), i);
25  }
26  if (i > rowmax())
27  {
28  ADMB_ARRAY_BOUNDS_ERROR("matrix bound exceeded -- row index too high",
29  "dvector& dmatrix::operator[] (int i)", rowmin(), rowmax(), i);
30  }
31  return *(m + i);
32 }
37 const dvector& dmatrix::operator[](int i) const
38 {
39  if (i < rowmin())
40  {
41  cerr << "matrix bound exceeded -- row index too low in "
42  "dmatrix::operator[]" << "value was" << i;
43  ad_exit(21);
44  }
45  if (i > rowmax())
46  {
47  cerr << "matrix bound exceeded -- row index too high in "
48  "dmatrix::operator[]" << "value was" << i;
49  ad_exit(22);
50  }
51  return *(m + i);
52 }
53 #endif
Vector of double precision numbers.
Definition: dvector.h:50
exitptr ad_exit
Definition: gradstrc.cpp:53
dvector & operator[](int)
Definition: fvar.hpp:3087
int rowmax() const
Definition: fvar.hpp:2929
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvector * m
Definition: fvar.hpp:2824
#define ADMB_ARRAY_BOUNDS_ERROR(message, function, lower_bounds, upper_bounds, index)
Definition: admb_messages.h:47
int rowmin() const
Definition: fvar.hpp:2925