ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_m32.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 // file fvar.cpp
12 // constructors, destructors and misc functions involving class prevariable
13 
14 #include "fvar.hpp"
15 
16 #ifdef __TURBOC__
17  #pragma hdrstop
18  #include <iostream.h>
19 #endif
20 
21 #ifdef __ZTC__
22  #include <iostream.hpp>
23 #endif
24 
25 
26 #include <stdio.h>
27 #ifndef __SUN__
28 #endif
29 #include <math.h>
30 
36 {
37  dvar_matrix tmp;
38 
39  int min = m.indexmin();
40  int max = m.indexmax();
41  tmp.allocate(min, max);
42  dvar_vector* ptmpi = &tmp(min);
43  const dvar_vector* pmi = &m(min);
44  for (int i = min; i <= max; ++i)
45  {
46  *ptmpi = mfexp(*pmi);
47 
48  ++ptmpi;
49  ++pmi;
50  }
51  return tmp;
52 }
53 
58 dvar_matrix mfexp(const dvar_matrix& m, const double d)
59 {
60  dvar_matrix tmp;
61 
62  int min = m.indexmin();
63  int max = m.indexmax();
64  tmp.allocate(min, max);
65  dvar_vector* ptmpi = &tmp(min);
66  const dvar_vector* pmi = &m(min);
67  for (int i = min; i <= max; ++i)
68  {
69  *ptmpi = mfexp(*pmi, d);
70 
71  ++ptmpi;
72  ++pmi;
73  }
74  return tmp;
75 }
ADMB variable vector.
Definition: fvar.hpp:2172
d3_array mfexp(const d3_array &m)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr7.cpp:10
#define min(a, b)
Definition: cbivnorm.cpp:188
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmax(void) const
Definition: fvar.hpp:2572
Class definition of matrix with derivitive information .
Definition: fvar.hpp:2480
void allocate(int nrl, int nrh, int ncl, int nch)
Allocates AD variable matrix with dimensions nrl to nrh by ncl to nch.
Definition: fvar_mat.cpp:216
#define max(a, b)
Definition: cbivnorm.cpp:189
int indexmin(void) const
Definition: fvar.hpp:2568