ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fvar_a49.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 #ifdef __TURBOC__
14  #pragma hdrstop
15  #include <iostream.h>
16 #endif
17 
18 #ifdef __ZTC__
19  #include <iostream.hpp>
20 #endif
21 
22 #include <math.h>
23 
29  {
30  dvariable tmp;
33  tmp=norm(v)/sqrt(double(v.size()));
34  dvariable tmp1;
35  tmp1=mean(v);
37  return(tmp*tmp-tmp1*tmp1);
38  }
39 
45  {
46  dvariable tmp;
49  tmp=norm(v)/sqrt(double(v.size()));
50  dvariable tmp1;
51  tmp1=mean(v);
53  return(sqrt(tmp*tmp-tmp1*tmp1));
54  }
55 
60 {
61  dvariable tmp = 0.0;
62  if (allocated(v))
63  {
66  tmp = sum(v) / double(v.size());
68  }
69  return tmp;
70 }
int allocated(const ivector &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: fvar_a59.cpp:13
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr.cpp:21
ADMB variable vector.
Definition: fvar.hpp:2172
unsigned int size() const
Definition: fvar.hpp:2297
double mean(const dvector &vec)
Returns computed mean of vec.
Definition: cranfill.cpp:43
double norm(const d3_array &a)
Return computed norm value of a.
Definition: d3arr2a.cpp:190
double std_dev(const dvector &vec)
Returns the computed standand deviation of vec.
Definition: cranfill.cpp:34
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2c.cpp:11
double var(const dvector &vec)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: cranfill.cpp:23
void RETURN_ARRAYS_INCREMENT()
Definition: gradstrc.cpp:478
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
static _THREAD gradient_structure * _instance
void RETURN_ARRAYS_DECREMENT()
Definition: gradstrc.cpp:511
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