Revision 1101

branches/threaded2/examples/threaded/mforest/mforest-nothreads.p01 (revision 1101)
1
# Number of parameters = 2  Objective function value = 687.132  Maximum gradient component = 0.00986602
2
# log_tau:
3
0.00000000000
4
# log_nu:
5
1.21271532627
6
# beta:
7
0.666666700000
8
# log_sigma:
9
-4.93830291465
branches/threaded2/examples/threaded/mforest/mforest-nothreads.r01 (revision 1101)
1
report:
2
ifn = 18
3
quit_flag = 0
4
ihflag = 0
5
last_phase() 0
6
iexit = 1
7
nsteps = 8
8
f = 687.1321751
9
a
10
 0.04 0.1 0.2 0.4 0.8
11
freq
12
 167 84 61 29
13
S
14
 1.805909313 1.493058051 1.262228055 1.080452693 0.9717929901
15
S/S(1)
16
4 1 0.826762 0.698943 0.598287 0.538118
17
tau 1
18
nu 3.3626
19
beta 0.666667
20
sigma 0.00716675
branches/threaded2/examples/threaded/mforest/dfqromb.cpp (revision 1101)
1
/*
2
 * $Id: dfqromb.cpp 1029 2013-05-31 18:27:30Z jsibert $
3
 *
4
 * Author: David Fournier
5
 * Copyright (c) 2009-2012 ADMB Foundation
6
 */
7
/**
8
  \file dfqromb.cpp 
9
  Contains routines for numerical integration
10
 */
11

  
12
#include <admodel.h>
13
#include "trace.h"
14

  
15
//#define EPS 1.0e-4
16
#define JMAX 50
17
//#define JMAXP JMAX+1
18
//#define K 5
19

  
20
class model_parameters;
21

  
22
dvariable trapzd(dvariable (model_parameters::*func)(const dvariable&),double a,double b,int n);
23
dvariable trapzd(dvariable (model_parameters::*func)(const dvariable&),double a, const dvariable& b,int n);
24
dvariable trapzd(dvariable (model_parameters::*func)(const dvariable&), const dvariable& a, const dvariable& b, int n);
25
dvariable trapzd(dvariable (model_parameters::*func)(const dvariable&), const dvariable& a, double b, int n);
26

  
27
void polint(const dvector& xa, const dvar_vector& ya,int n,double x,
28
  const dvariable& y, const dvariable& dy);
29

  
30
/** Romberg integration.
31
  \param func Pointer to a member function of class model_parameters.
32
  \param a Lower limit of integration.
33
  \param b Upper limit of inegration.
34
  \param ns
35
  \return The integral of the function from a to b using Romberg's method
36
*/
37
dvariable function_minimizer::adromb(dvariable (model_parameters::*func)(const dvariable&),double a,double b,int ns)
38
{
39
  const double base = 4; 
40
  int MAXN = min(JMAX, ns);
41
  dvar_vector s(1,MAXN+1);
42

  
43
  for(int j=1; j<=MAXN+1; j++)
44
  {
45
    s[j] = trapzd(func,a,b,j);
46
  }
47

  
48
  for(int iter=1; iter<=MAXN+1; iter++)
49
  {
50
    for(int j=1; j<=MAXN+1-iter; j++)
51
    {
52
      s[j] = (pow(base,iter)*s[j+1]-s[j])/(pow(base,iter)-1);
53
    }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff