#ifndef __FILE_SVMOD_H_SEEN__
#define __FILE_SVMOD_H_SEEN__ 

/*-----------------------------------------------------------------------------

Copyright (C) 2012, 2013

A. Ronald Gallant
Post Office Box 659
Chapel Hill NC 27514-0659
USA   

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-----------------------------------------------------------------------------*/

#include "libscl.h"
#include "svmnt.h"
#include "svparms.h"

struct sample {
  REAL x0;
  REAL y0;
  scl::realmat x;
  scl::realmat y;
  sample(INTEGER n) : x(1,n), y(1,n) { }
  REAL get_x0() { return x0; }
  REAL get_y0() { return y0; }
  scl::realmat get_x() { return x; }
  scl::realmat get_y() { return y; }
};
  
class svmod {
private:
  REAL rho;
  REAL phi;
  REAL sigma;
  REAL beta;
  svmnt* mf;
  scl::gmm* gmmobj;
public:
  svmod() : rho(T1), phi(T2), sigma(T3), beta(T4) { }
  svmod(svmnt* mfptr, scl::gmm* gmmptr)
  : rho(T1), phi(T2), sigma(T3), beta(T4), mf(mfptr), gmmobj(gmmptr)
  { gmmobj->set_moment_function(mf); } // insurance, should be redundant
  void set_parms(const scl::realmat& theta);
  scl::realmat get_parms() const;
  REAL draw_x0(INT_32BIT& seed) const;
  REAL draw_xt(REAL xlag, INT_32BIT& seed) const;
  REAL prob_yt(REAL yt, REAL ytlag, REAL xt) const;
  REAL prob_yt(INTEGER t, scl::realmat* particle);
  scl::denval likelihood(INTEGER t, scl::realmat* particle);
  sample draw_sample(INTEGER n, INT_32BIT& seed) const;
};

#endif

