ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
f7arr1.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 
18  {
21 
22  dvar7_array tmp;
23  tmp.allocate(m);
24  for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
25  {
26  tmp(i)=m(i)/d;
27  }
29  return tmp;
30  }
31 
36 dvar7_array operator/(const dvar7_array& m, const double d)
37  {
40  dvar7_array tmp;
41  tmp.allocate(m);
42  for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
43  {
44  tmp(i)=m(i)/d;
45  }
47  return tmp;
48  }
49 
55  {
58  dvar7_array tmp;
59  tmp.allocate(m);
60  for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
61  {
62  tmp(i)=m(i)/d;
63  }
65  return tmp;
66  }
67 
73  {
76  for (int i=indexmin();i<=indexmax();i++)
77  {
78  (*this)(i)/=d;
79  }
81  }
82 
87 void dvar7_array::operator/=(const double& d)
88  {
91  for (int i=indexmin();i<=indexmax();i++)
92  {
93  (*this)(i)/=d;
94  }
96  }
97 
103 {
106  dvariable tmp=0.;
107  int min = m.indexmin();
108  int max = m.indexmax();
109  const dvar6_array* pmi = &m(min);
110  for (int i = min; i <= max; ++i)
111  {
112  tmp += sum(*pmi);
113 
114  ++pmi;
115  }
117  return tmp;
118 }
Base class for dvariable.
Definition: fvar.hpp:1315
Description not yet available.
Definition: fvar.hpp:7054
Description not yet available.
Definition: fvar.hpp:6861
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr.cpp:21
int indexmax() const
Definition: fvar.hpp:7455
void allocate(int hhsl, int hhsu)
Allocate a vector of d6_array types with dimension [l7, u7].
Definition: f7arr.cpp:36
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
#define min(a, b)
Definition: cbivnorm.cpp:188
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
static _THREAD gradient_structure * _instance
void operator/=(const prevariable &d)
Description not yet available.
Definition: f7arr1.cpp:72
int indexmin() const
Definition: fvar.hpp:7451
Description not yet available.
Definition: fvar.hpp:7262
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
d3_array operator/(const d3_array &m, const double d)
Author: David Fournier.
Definition: d3arr2b.cpp:14
#define max(a, b)
Definition: cbivnorm.cpp:189
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