version 1.3, 2013/02/21 07:30:56 |
version 1.5, 2013/02/21 12:14:08 |
|
|
#include <string.h> |
#include <string.h> |
#include "sfile.h" |
#include "sfile.h" |
/* |
/* |
$OpenXM: OpenXM/src/hgm/mh/src/jack-n.c,v 1.2 2013/02/20 07:53:44 takayama Exp $ |
$OpenXM: OpenXM/src/hgm/mh/src/jack-n.c,v 1.4 2013/02/21 07:51:57 takayama Exp $ |
Ref: copied from this11/misc-2011/A1/wishart/Prog |
Ref: copied from this11/misc-2011/A1/wishart/Prog |
jack-n.c, translated from mh.rr or tk_jack.rr in the asir-contrib. License: LGPL |
jack-n.c, translated from mh.rr or tk_jack.rr in the asir-contrib. License: LGPL |
Koev-Edelman for higher order derivatives. |
Koev-Edelman for higher order derivatives. |
|
|
/****** from mh-n.c *****/ |
/****** from mh-n.c *****/ |
static int JK_byFile=1; |
static int JK_byFile=1; |
#define M_n_default 3 |
#define M_n_default 3 |
|
#define Sample_default 1 |
static int M_n=0; |
static int M_n=0; |
/* global variables. They are set in setParam() */ |
/* global variables. They are set in setParam() */ |
static int Mg; /* n */ |
static int Mg; /* n */ |
Line 36 static double Ef; /* exponential factor at beta*x0 * |
|
Line 37 static double Ef; /* exponential factor at beta*x0 * |
|
static double Hg; /* step size of rk defined in rk.c */ |
static double Hg; /* step size of rk defined in rk.c */ |
static int Dp; /* Data sampling period */ |
static int Dp; /* Data sampling period */ |
static double Xng=0.0; /* the last point */ |
static double Xng=0.0; /* the last point */ |
static int Sample = 1; |
static int Sample = Sample_default; |
|
|
/* for sample inputs */ |
/* for sample inputs */ |
static double *Iv2; |
static double *Iv2; |
Line 53 static double Ef2; |
|
Line 54 static double Ef2; |
|
#define M_nmx M_m_MAX /* maximal of M_n */ |
#define M_nmx M_m_MAX /* maximal of M_n */ |
#define A_LEN 1 /* (a_1) , (a_1, ..., a_p)*/ |
#define A_LEN 1 /* (a_1) , (a_1, ..., a_p)*/ |
#define B_LEN 1 /* (b_1) */ |
#define B_LEN 1 /* (b_1) */ |
static int Debug = 0; |
static int Debug = 1; |
static int Alpha = 2;; |
static int Alpha = 2; /* 2 implies the zonal polynomial */ |
static int *Darray = NULL; |
static int *Darray = NULL; |
static int **Parray = NULL; /* array of partitions of size M_n */ |
static int **Parray = NULL; /* array of partitions of size M_n */ |
static int *ParraySize = NULL; /* length of each partitions */ |
static int *ParraySize = NULL; /* length of each partitions */ |
Line 191 int jk_initializeWorkArea() { |
|
Line 192 int jk_initializeWorkArea() { |
|
for (i=0; i<M_nmx; i++) M_kap[i]=HS_mu[i]=0; |
for (i=0; i<M_nmx; i++) M_kap[i]=HS_mu[i]=0; |
for (i=0; i<M_nmx; i++) M_x[i]=0; |
for (i=0; i<M_nmx; i++) M_x[i]=0; |
for (i=0; i<M_nmx; i++) for (j=0; j<M_m_MAX; j++) Xarray[i][j]=0; |
for (i=0; i<M_nmx; i++) for (j=0; j<M_m_MAX; j++) Xarray[i][j]=0; |
|
for (i=0; i<M_nmx; i++) M_beta_kap[i]=0; |
M_m=M_m_MAX-2; |
M_m=M_m_MAX-2; |
Alpha = 2; |
Alpha = 2; |
HS_n=M_nmx; |
HS_n=M_nmx; |
Line 201 int jk_initializeWorkArea() { |
|
Line 203 int jk_initializeWorkArea() { |
|
M_df=1; |
M_df=1; |
M_2n=0; |
M_2n=0; |
M_rel_error=0.0; |
M_rel_error=0.0; |
|
Sample = Sample_default; |
|
Xng=0.0; |
|
M_n=0; |
} |
} |
|
|
static void *mymalloc(int size) { |
static void *mymalloc(int size) { |
Line 1061 static genJack(int M,int N) { |
|
Line 1066 static genJack(int M,int N) { |
|
int *Kap,*Mu; |
int *Kap,*Mu; |
double Jack,Beta_km; |
double Jack,Beta_km; |
int Nk,JJ; |
int Nk,JJ; |
|
if (Debug) printf("genJack(%d,%d)\n",M,N); |
M_jack = (double **) mymalloc(sizeof(double *)*(N+2)); |
M_jack = (double **) mymalloc(sizeof(double *)*(N+2)); |
M_2n = imypower(2,N); |
M_2n = imypower(2,N); |
Pmn = pmn(M,N); /*P_pmn is initializeded. |
Pmn = pmn(M,N); /*P_pmn is initializeded. |
Line 1151 static genJack(int M,int N) { |
|
Line 1157 static genJack(int M,int N) { |
|
} |
} |
} |
} |
aM_jack(Nv,J,K) = Jack; |
aM_jack(Nv,J,K) = Jack; |
|
if (Debug) printf("aM_jack(%d,%d,%d) = %lf\n",Nv,J,K,Jack); |
} /* end of J loop */ |
} /* end of J loop */ |
} |
} |
} |
} |
Line 1324 struct MH_RESULT *jk_main(int argc,char *argv[]) { |
|
Line 1331 struct MH_RESULT *jk_main(int argc,char *argv[]) { |
|
int idata=0; |
int idata=0; |
JK_byFile = 1; |
JK_byFile = 1; |
jk_initializeWorkArea(); |
jk_initializeWorkArea(); |
Debug = 0; |
|
UseTable = 1; |
UseTable = 1; |
Mapprox=6; |
Mapprox=6; |
for (i=1; i<argc; i++) { |
for (i=1; i<argc; i++) { |