00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00028 #ifndef SEQPP_PHASEDMTDMARKOV_H
00029 #define SEQPP_PHASEDMTDMARKOV_H
00030
00031 #include <seqpp/PhasedMarkov.h>
00032 #include <seqpp/mtd_core.h>
00033
00045 class PhasedMTDMarkov : public PhasedMarkov
00046 {
00047 protected :
00049 mtd_core * _mtdcore;
00050
00051 public:
00053
00063 template< class TSeq >
00064 PhasedMTDMarkov( const TSeq & tseq, short mkv_order,
00065 short phase, short initial_phase = 0,
00066 short nbseed = NBSEED, int nbiter_max = NBITERMAX, double eps = EPS,
00067 bool log = false )
00068 : PhasedMarkov( tseq.tell_alphabet_size(), tseq.tell_order(), phase )
00069 {
00070 tseq.count_p_occurencies( phase, initial_phase );
00071 estimate( tseq.get_p_count(), true, mkv_order, phase, initial_phase,
00072 nbseed, nbiter_max, eps, log );
00073 }
00074
00076
00088 PhasedMTDMarkov( unsigned long * * count,
00089 short size,
00090 short mtd_order, short mkv_order,
00091 short phase, short initial_phase = 0,
00092 short nbseed = NBSEED, int nbiter_max = NBITERMAX, double eps = EPS,
00093 bool log = false )
00094 : PhasedMarkov( size, mtd_order, phase )
00095 {
00096 estimate( count, false, mkv_order, phase, initial_phase,
00097 nbseed, nbiter_max, eps, log );
00098 }
00099
00101 void estimate( unsigned long * * count, bool decal_required,
00102 short mkv_order,
00103 short phase, short initial_phase,
00104 short nbseed, int nbiter_max, double eps,
00105 bool log )
00106 { _mtdcore = new mtd_core( _size, _order, mkv_order );
00107
00108 _nb_param = 0;
00109
00110 for (int i=0; i<phase; i++){
00111 _nb_param += _mtdcore->nb_params();
00112 _mtdcore->estimate( count[i], decal_required,
00113 nbseed, nbiter_max, eps, log );
00114 _mtdcore->mtd_to_matrix( _Pis[i] );
00115 }
00116 delete _mtdcore;
00117 }
00118
00120 ~PhasedMTDMarkov(){}
00121 };
00122 #endif