From b2a7c92fc49bed7dccc0a332cdba15b3dbceb2f3 Mon Sep 17 00:00:00 2001 From: Mark Woolrich <woolrich@fmrib.ox.ac.uk> Date: Wed, 6 Sep 2000 13:13:12 +0000 Subject: [PATCH] Initial revision --- quick.cc | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 quick.cc diff --git a/quick.cc b/quick.cc new file mode 100644 index 0000000..61ad0b3 --- /dev/null +++ b/quick.cc @@ -0,0 +1,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; +} + + + + + + + + + + + + -- GitLab