ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
d3arr8.cpp
Go to the documentation of this file.
1 
5 #include "fvar.hpp"
6 
7 #ifndef OPT_LIB
8 
16 const double& d3_array::operator()(int i, int j, int k) const
17 {
18  if (i < slicemin())
19  {
20  cerr << "array bound exceeded -- slice index too low in "
21  << "d3_array::operator(int, int, int)";
22  ad_exit(1);
23  }
24  if (i > slicemax())
25  {
26  cerr << "array bound exceeded -- slice index too high in "
27  << "d3_array::operator(int, int, int)";
28  ad_exit(1);
29  }
30  return elem(i)(j,k);
31 }
38 const dvector& d3_array::operator()(int i, int j) const
39 {
40  if (i < slicemin())
41  {
42  cerr << "array bound exceeded -- slice index too low in "
43  << "d3_array::operator(int, int)";
44  ad_exit(1);
45  }
46  if (i > slicemax())
47  {
48  cerr << "array bound exceeded -- slice index too high in "
49  << "d3_array::operator(int, int)";
50  ad_exit(1);
51  }
52  return elem(i)(j);
53 }
59 const dmatrix& d3_array::operator[](int i) const
60 {
61  if (i < slicemin())
62  {
63  cerr << "matrix bound exceeded -- row index too low in "
64  << "d3_array::operator[]" << "value was" << i;
65  ad_exit(1);
66  }
67  if (i > slicemax())
68  {
69  cerr << "matrix bound exceeded -- row index too high in "
70  << "d3_array::operator[]" << "value was" << i;
71  ad_exit(1);
72  }
73  return t[i];
74 }
75 #endif
76 
83 {
84  if (slicemin() != values.slicemin() || slicemax() != values.slicemax())
85  {
86  cerr << " Incompatible array bounds in "
87  << "d3_array& operator=(const d3_array&)\n";
88  ad_exit(1);
89  }
90 
91  // check for condition that both matrices
92  // don't point to the same object
93  if (t != values.t)
94  {
95  for (int i = slicemin(); i <= slicemax(); ++i)
96  {
97  elem(i) = values.elem(i);
98  }
99  }
100  return *this;
101 }
108 {
109  for (int i = slicemin(); i <= slicemax(); ++i)
110  {
111  elem(i) = value;
112  }
113  return *this;
114 }
friend d3_array value(const dvar3_array &ar)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: f3arr3.cpp:13
Vector of double precision numbers.
Definition: dvector.h:50
exitptr ad_exit
Definition: gradstrc.cpp:53
dmatrix * t
Definition: fvar.hpp:3729
int slicemax() const
Definition: fvar.hpp:3830
int j
Definition: fvar.hpp:3636
d3_array & operator=(const d3_array &m1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr8.cpp:82
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int slicemin() const
Definition: fvar.hpp:3826
Description not yet available.
Definition: fvar.hpp:2819
values
Definition: adjson.h:22
dmatrix & operator[](int i)
Definition: fvar.hpp:3934
double & operator()(int k, int i, int j)
Definition: fvar.hpp:3922
dmatrix & elem(int k)
Definition: fvar.hpp:3870
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
Description not yet available.
Definition: fvar.hpp:3727