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 :
00048 mtd_core * _mtdcore;
00049
00050 public:
00052
00062 template< class TSeq >
00063 PhasedMTDMarkov( const TSeq & tseq, short mkv_order,
00064 short phase, short initial_phase = 0,
00065 short nbseed = NBSEED, int nbiter_max = NBITERMAX, double eps = EPS,
00066 bool log = false )
00067 : PhasedMarkov( tseq.tell_alphabet_size(), tseq.tell_order(), phase )
00068 {
00069 tseq.count_p_occurencies( phase, initial_phase );
00070 estimate( tseq.get_p_count(), true, mkv_order, phase, initial_phase,
00071 nbseed, nbiter_max, eps, log );
00072 }
00073
00075
00087 PhasedMTDMarkov( unsigned long * * count,
00088 short size,
00089 short mtd_order, short mkv_order,
00090 short phase, short initial_phase = 0,
00091 short nbseed = NBSEED, int nbiter_max = NBITERMAX, double eps = EPS,
00092 bool log = false )
00093 : PhasedMarkov( size, mtd_order, phase )
00094 {
00095 estimate( count, false, mkv_order, phase, initial_phase,
00096 nbseed, nbiter_max, eps, log );
00097 }
00098
00100 void estimate( unsigned long * * count, bool decal_required,
00101 short mkv_order,
00102 short phase, short initial_phase,
00103 short nbseed, int nbiter_max, double eps,
00104 bool log )
00105 {
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