Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include <iostream>
#include <fstream>
#include <iomanip>
#include <strstream>
#define WANT_STREAM
#define WANT_MATH
#include "newmatstl.h"
#include "newmatap.h"
#include "newmatio.h"
#include <string>
#include <math.h>
#include "glmrand.h"
#include "Volume.h"
#include "Log.h"
#include "histogram.h"
#include "sigproc.h"
#include "t2z.h"
extern "C"
{
#include "libprob.h"
};
#ifndef NO_NAMESPACE
using namespace UTILS;
using namespace NEWMAT;
using namespace SIGPROC;
#endif
int main(int argc, char *argv[])
{
try{
rand();
Log::getInstance().setDir(".");
Matrix mat(2,2);
mat << 0.01 << 0.02 << 0.0003 << 0.00004;
cout << mat << endl;
Log::getInstance().out("sci", mat);
ColumnVector cat(4);
cat << 0.01 << 0.02 << 0.0003 << 0.00004;
cout << cat << endl;
Log::getInstance().out("scim", cat);
RowVector rat(4);
rat << 0.01 << 0.02 << 0.0003 << 0.00004;
cout << rat << endl;
Log::getInstance().out("scir", rat);
/*
Log::getInstance().establishDir("results");
T2z& t2z = T2z::getInstance();
cerr << t2z.convertlogp2z(log(1))<< endl;
Volume randts;
In("./rand+/randts",randts);
cerr << randts.getVolumeSize() << endl;
Histogram hist(randts, randts.getVolumeSize());
hist.generate();
int total = hist.integrateAll();
cerr << total << endl;
float toinf = hist.integrateToInf(1.5);
cerr << toinf << endl;
float prob = toinf/total;
cerr << prob << endl;
float datazs = ndtri(prob);
cerr << datazs << endl;
const int sizeTS = 8;
const int num = 5;
Matrix x(sizeTS,1);
x = 1;
Matrix c(1,1);
c = 1;
Volume cvec(sizeTS);
cvec << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8;
GlmRand glmRand(num,1,c,1);
glmRand.addData(cvec, x);
cerr << "z = " << glmRand.ComputeZStats().AsScalar() << endl;
*/
}
catch(Exception p_excp)
{
cerr << p_excp.what() << endl;
}
return 0;
}