ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dmat8.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 dmatrix::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 dmatrix rows bounded by ["
25  << index_min << ", " << index_max << "].\n";
26  }
27  return valid;
28 }
29 #if !defined(OPT_LIB)
30 
37 {
38 #ifndef OPT_LIB
39  //check that index i is in range
40  assert(index_min <= i && i <= index_max);
41 #endif
42 
43  return *(m + i);
44 }
45 #endif
46 
47 #if !defined(OPT_LIB) || defined(__INTEL_COMPILER)
48 
55 double& dmatrix::operator()(int i, int j)
56 {
57 #ifndef OPT_LIB
58  //check that index i is in range
59  assert(index_min <= i && i <= index_max);
60 #endif
61 
62  dvector* pmi = m + i;
63 
64 #ifndef OPT_LIB
65  //check that index j is in range
66  assert(pmi->is_valid_index(j));
67 #endif
68 
69  return *(pmi->get_v() + j);
70 }
78 const double& dmatrix::operator()(int i, int j) const
79 {
80 #ifndef OPT_LIB
81  //check that index i is in range
82  assert(index_min <= i && i <= index_max);
83 #endif
84 
85  dvector* pmi = m + i;
86 
87 #ifndef OPT_LIB
88  //check that index j is in range
89  assert(pmi->is_valid_index(j));
90 #endif
91 
92  return *(pmi->get_v() + j);
93 }
94 #endif
int index_min
Definition: fvar.hpp:2822
dvector & operator()(int i)
Definition: fvar.hpp:3083
bool is_valid_row(const int i) const
Check index i is in matrix row bounds [index_min, index_max].
Definition: dmat8.cpp:19
Vector of double precision numbers.
Definition: dvector.h:50
int index_max
Definition: fvar.hpp:2823
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvector * m
Definition: fvar.hpp:2824
double *& get_v(void)
Definition: dvector.h:148
bool is_valid_index(const int i) const
Check index i is in dvector bounds [index_min, index_max].
Definition: dvec_acc.cpp:17