Skip to content
Snippets Groups Projects
quick.cc 1.95 KiB
Newer Older
Mark Woolrich's avatar
Mark Woolrich committed
#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;
}