ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
f3arr4.cpp
Go to the documentation of this file.
1 
6 #include "fvar.hpp"
7 
12 dvar3_array operator-(const double d, const dvar3_array& m2)
13  {
16  dvar3_array tmp;
17  tmp.allocate(m2);
18  for (int i=tmp.slicemin();i<=tmp.slicemax();i++)
19  {
20  tmp(i)=d-m2(i);
21  }
23  return tmp;
24  }
29 {
30  dvariable tmp;
31  const unsigned int count = size_count(m);
32  if (count > 0)
33  {
34  tmp = sum(m) / count;
35  }
36  else
37  {
38  cerr << "Error[" << __FILE__ << ':' << __LINE__ << "]:"
39  "Division by zero in mean(dvar3_array)."
40  << '\n';
41  ad_exit(1);
42  }
43  return tmp;
44 }
int slicemin() const
Definition: fvar.hpp:4274
void allocate(int sl, int sh, int nrl, int nrh, int ncl, int nch)
Allocate variable vector of matrices with dimensions [sl to sh] x ([nrl to nrh] x [ncl to nch]) where...
Definition: f3arr.cpp:91
d3_array operator-(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements addition of a(i, j, k) + b(i, j, k).
Definition: d3arr2a.cpp:152
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr.cpp:21
int slicemax() const
Definition: fvar.hpp:4275
exitptr ad_exit
Definition: gradstrc.cpp:53
double mean(const dvector &vec)
Returns computed mean of vec.
Definition: cranfill.cpp:43
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
static _THREAD gradient_structure * _instance
Description not yet available.
Definition: fvar.hpp:4197
unsigned int size_count(const dvector &x)
Returns total size of elements in vector x.
Definition: dsize.cpp:17
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518