#include "libscl.h"
#include "libgsm.h"
#include "gsmusr.h"
using namespace std;
using namespace scl;
using namespace libgsm;
using namespace gsm;


int main(int argc, char* argp[], char* envp[])
{
  cout << boolalpha;

  two_dim_tinker_toy_sci_mod sci_mod;

  cout << "\t len_parm = " << sci_mod.len_parm() << '\n';
  cout << "\t len_func = " << sci_mod.len_func() << '\n';
  realmat parm(sci_mod.len_parm(),1);
  parm[1] = 1.0;
  parm[2] = 2.0;
  cout << "\t parm = " << parm << '\n';
  sci_mod.set_parm(parm);
  sci_mod.get_parm(parm);
  cout << "\t parm = " << parm << '\n';
  cout << "\t support = " << sci_mod.support(parm) << '\n';
  cout << "\t support = " << sci_mod.support(parm) << '\n';
  sci_mod.set_sim_size(20);
  realmat sim,func;
  sci_mod.gen_sim(sim,func);
  cout << "\n sim = " << sim << '\n';
  cout << "\n func = " << func << '\n';
  den_val dv =  sci_mod.prior(parm,func);
  cout << "\n prior = " << dv.positive << ' ' << dv.log_den << '\n'; 
  ofstream dat_ofs("tt2d.dat");
  if (!dat_ofs) error("Error, file open error");
  for (INTEGER j=1; j<=sim.get_cols(); ++j) {
    dat_ofs << fmt('f',15,8,sim(1,j)) << fmt('f',15,8,sim(2,j)) << '\n';
  }

  return 0;
}
