ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
f5arr1.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  dvariable tmp=0.;
23 
24  int min = m.indexmin();
25  int max = m.indexmax();
26  const dvar4_array* pmi = &m(min);
27  for (int i = min; i <= max; ++i)
28  {
29  tmp+=sum(*pmi);
30 
31  ++pmi;
32  }
34  return tmp;
35 }
36 
37 
43 {
46  dvar5_array tmp;
47  tmp.allocate(m);
48  for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
49  {
50  tmp(i)=sqrt(m(i));
51  }
53  return tmp;
54 }
55 
61 {
64  dvar5_array tmp;
65  tmp.allocate(m);
66  for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
67  {
68  tmp(i)=exp(m(i));
69  }
71  return tmp;
72 }
73 
79 {
82  dvar5_array tmp;
83  tmp.allocate(m);
84  for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
85  {
86  tmp(i)=mfexp(m(i));
87  }
89  return tmp;
90 }
91 
97 {
100  dvar5_array tmp;
101  tmp.allocate(m);
102  for (int i=tmp.indexmin();i<=tmp.indexmax();i++)
103  {
104  tmp(i)=log(m(i));
105  }
107  return tmp;
108 }
Description not yet available.
Definition: fvar.hpp:5433
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr.cpp:21
d3_array mfexp(const d3_array &m)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr7.cpp:10
int indexmax() const
Definition: fvar.hpp:6650
void allocate(int hhsl, int hhsu, int hsl, int hsu, int sl, int sh, int nrl, int nrh, int ncl, int nch)
Allocate dvar5_array with dimensions [hsl to hsu] x [sl to sh] x [nrl to nrh] x [ncl to nch] x [l5 to...
Definition: f5arr.cpp:435
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2c.cpp:11
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
#define min(a, b)
Definition: cbivnorm.cpp:188
Description not yet available.
Definition: fvar.hpp:6498
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: fvar.hpp:6646
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
static _THREAD gradient_structure * _instance
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
#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
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2a.cpp:13