ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
df1b2funx.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 <df1b2fun.h>
12 
18 {
20  df1b2variable z;
21  double x=value(_xx);
22  double f=sin(x);
23  double dfx=cos(x);
24  double d2f=-f;
25  double d3f=-dfx;
26  double * xd=xx.get_u_dot();
27  double * zd=z.get_u_dot();
28  *z.get_u()=f;
29  for (unsigned int i=0;i<df1b2variable::nvar;i++)
30  {
31  *zd++ =dfx * *xd++;
32  }
34  f1b2gradlist->write_pass1(&xx,&z,dfx,d2f,d3f);
35 
36  return z;
37 }
38 
44 {
46  df1b2variable z;
47  double x=value(_xx);
48  double f=cos(x);
49  double dfx=-sin(x);
50  double d2f=-f;
51  double d3f=-dfx;
52  double * xd=xx.get_u_dot();
53  double * zd=z.get_u_dot();
54  *z.get_u()=f;
55  for (unsigned int i=0;i<df1b2variable::nvar;i++)
56  {
57  *zd++ =dfx * *xd++;
58  }
60  f1b2gradlist->write_pass1(&xx,&z,dfx,d2f,d3f);
61 
62  return z;
63 }
df1b2_gradlist * f1b2gradlist
Definition: df1b2glo.cpp:49
double * get_u() const
Definition: df1b2fun.h:228
#define x
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
Definition: fvar.hpp:140
d3_array sin(const d3_array &arr3)
Returns d3_array results with computed sin from elements in arr3.
Definition: d3arr2a.cpp:43
Description not yet available.
Definition: df1b2fun.h:266
double * get_u_dot() const
Definition: df1b2fun.h:229
static int no_derivatives
Definition: df1b2fun.h:759
int write_pass1(const df1b2variable *px, const df1b2variable *py, df1b2variable *pz, df1b2function2 *pf)
Description not yet available.
Definition: df1b2f12.cpp:17
d3_array cos(const d3_array &arr3)
Returns d3_array results with computed cos from elements in arr3.
Definition: d3arr2a.cpp:58
static unsigned int nvar
Definition: df1b2fun.h:290
Description not yet available.
dvector value(const df1_one_vector &v)
Definition: df11fun.cpp:69