ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
imat1.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 <cassert>
13 
19 bool imatrix::is_valid_row(const int i) const
20 {
21  const bool valid = index_min <= i && i <= index_max;
22  if (!valid)
23  {
24  cerr << "Error: Used invalid i = " << i << " for imatrix rows bounded by ["
25  << index_min << ", " << index_max << "].\n";
26  }
27  return valid;
28 }
29 #if !defined(OPT_LIB)
30 
37 {
38  if (!is_valid_row(i))
39  {
40  ad_exit(1);
41  }
42 
43  return elem(i);
44 }
51 const ivector& imatrix::operator()(int i) const
52 {
53  if (!is_valid_row(i))
54  {
55  ad_exit(1);
56  }
57 
58  return elem(i);
59 }
60 #endif
ivector & elem(int i)
Definition: imatrix.h:233
int index_max
Definition: imatrix.h:73
exitptr ad_exit
Definition: gradstrc.cpp:53
ivector & operator()(int)
Definition: imatrix.h:205
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int index_min
Definition: imatrix.h:72
bool is_valid_row(const int i) const
Check index i is in matrix row bounds [index_min, index_max].
Definition: imat1.cpp:19