ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dvect19.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 
13 
20 dvector mfexp(const dvector& v1, const double d)
21 {
22  int mmin=v1.indexmin();
23  int mmax=v1.indexmax();
24  dvector vtmp(mmin,mmax);
25  double* pvtmpi = vtmp.get_v() + mmin;
26  double* pv1i = v1.get_v() + mmin;
27  for (int i=mmin;i<=mmax;i++)
28  {
29  if (*pv1i < d)
30  {
31  *pvtmpi = exp(*pv1i);
32  }
33  else
34  {
35  double x = *pv1i - d;
36  *pvtmpi = exp(d) * (1.0 + 2.0 * x)/(1.0 + x);
37  }
38  ++pvtmpi;
39  ++pv1i;
40  }
41  return vtmp;
42 }
43 
49 dvector mfexp(const dvector& v1)
50 {
51  return mfexp(v1, 60.0);
52 }
#define x
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
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
Get maximum valid index.
Definition: dvector.h:204
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
Definition: d3arr2a.cpp:28
double *& get_v(void)
Definition: dvector.h:148