ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
f3arr3.cpp
Go to the documentation of this file.
1 
6 #include "fvar.hpp"
7 
14 {
15  d3_array result;
16  result.allocate(arr3);
17 
18  int min = result.slicemin();
19  int max = result.slicemax();
20 
21  dmatrix* presulti = &result(min);
22  const dvar_matrix* parr3i = &arr3(min);
23  for (int i = min; i <= max; ++i)
24  {
25  *presulti = value(*parr3i);
26 
27  ++presulti;
28  ++parr3i;
29  }
30  return result;
31 }
37 {
38  int sl = d3v.slicemin();
39  int sh = d3v.slicemax();
40  if ((shape = new three_array_shape(sl, sh)) == 0)
41  {
42  cerr << " Error: d3_array unable to allocate memory in "
43  << __FILE__ << ':' << __LINE__ << '\n';
44  ad_exit(1);
45  }
46  if ((t = new dmatrix[slicesize()]) == 0)
47  {
48  cerr << " Error: d3_array unable to allocate memory in "
49  << __FILE__ << ':' << __LINE__ << '\n';
50  ad_exit(1);
51  }
52  t -= sl;
53  dmatrix* pti = t + sl;
54  const dvar_matrix* pd3vi = &d3v(sl);
55  for (int i = sl; i <= sh; ++i)
56  {
57  pti->allocate(*pd3vi);
58  ++pti;
59  ++pd3vi;
60  }
61 }
void allocate(void)
Does NOT allocate, but initializes empty d3_array.
Definition: d3arr10.cpp:11
int slicemin() const
Definition: fvar.hpp:4274
void allocate(void)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: dmat0.cpp:8
three_array_shape * shape
Definition: fvar.hpp:3730
void allocate(const ad_integer &sl, const ad_integer &sh, const index_type &nrl, const index_type &nrh, const index_type &ncl, const index_type &nch)
Allocate array of matrices with dimensions [sl to sh] x [nrl to nrh] x [ncl to nch].
Definition: indextyp.cpp:327
int slicemax() const
Definition: fvar.hpp:4275
Description not yet available.
Definition: fvar.hpp:3698
exitptr ad_exit
Definition: gradstrc.cpp:53
dmatrix * t
Definition: fvar.hpp:3729
int slicemax() const
Definition: fvar.hpp:3830
#define min(a, b)
Definition: cbivnorm.cpp:188
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
Description not yet available.
Definition: fvar.hpp:4197
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
unsigned int slicesize() const
Definition: fvar.hpp:3853
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69
#define max(a, b)
Definition: cbivnorm.cpp:189
Description not yet available.
Definition: fvar.hpp:3727