ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
f4arr2.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  int min = m.indexmin();
23  int max = m.indexmax();
24  dvar4_array tmp;
25  tmp.allocate(m);
26 
27  dvar3_array* ptmpi = &tmp(min);
28  const d3_array* pmi = &m(min);
29  for (int i = min; i <= max; ++i)
30  {
31  *ptmpi = *pmi / d;
32 
33  ++pmi;
34  ++ptmpi;
35  }
37  return tmp;
38  }
39 
44 dvar4_array operator/(const dvar4_array& m, const double d)
45  {
48 
49  int min = m.indexmin();
50  int max = m.indexmax();
51  dvar4_array tmp;
52  tmp.allocate(m);
53 
54  double invd = 1.0 / d;
55 
56  dvar3_array* ptmpi = &tmp(min);
57  const dvar3_array* pmi = &m(min);
58  for (int i = min; i <= max; ++i)
59  {
60  *ptmpi = *pmi * invd;
61 
62  ++pmi;
63  ++ptmpi;
64  }
66  return tmp;
67  }
68 
74  {
77  int min = m.indexmin();
78  int max = m.indexmax();
79  dvar4_array tmp;
80  tmp.allocate(m);
81  dvar3_array* ptmpi = &tmp(min);
82  const dvar3_array* pmi = &m(min);
83  for (int i = min; i <= max; ++i)
84  {
85  *ptmpi = *pmi / d;
86 
87  ++pmi;
88  ++ptmpi;
89  }
91  return tmp;
92  }
93 
99  {
102  int min = indexmin();
103  int max = indexmax();
104  dvar3_array* pti = t + min;
105  for (int i = min; i <= max; ++i)
106  {
107  *pti /= d;
108 
109  ++pti;
110  }
112  }
113 
118 void dvar4_array::operator/=(const double& d)
119  {
122  int min = indexmin();
123  int max = indexmax();
124  dvar3_array* pti = t + min;
125  for (int i = min; i <= max; ++i)
126  {
127  *pti /= d;
128 
129  ++pti;
130  }
132  }
Base class for dvariable.
Definition: fvar.hpp:1315
int indexmax() const
Definition: fvar.hpp:5622
void operator/=(const prevariable &d)
Description not yet available.
Definition: f4arr2.cpp:98
Description not yet available.
Definition: fvar.hpp:5433
Description not yet available.
Definition: fvar.hpp:5161
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 allocate(int hsl, int hsu, int sl, int sh, int nrl, int nrh, int ncl, int nch)
Allocate variable array with dimensions [hsl to hsu] x [sl to sh] x [nrl to nrh] x [ncl to nch]...
Definition: f4arr.cpp:309
Description not yet available.
Definition: fvar.hpp:4197
int indexmin() const
Definition: fvar.hpp:5305
dvar3_array * t
Definition: fvar.hpp:5436
int indexmax() const
Definition: fvar.hpp:5309
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.
Description not yet available.
Definition: fvar.hpp:3727
int indexmin() const
Definition: fvar.hpp:5621