1 /**************************************************************
2  *** RHmm package
3  ***
4  *** File: cBaumWelchInParam.cpp
5  ***
6  *** Author: Ollivier TARAMASCO <Ollivier.Taramasco@imag.fr>
7  *** Author: Sebastian BAUER <sebastian.bauer@charite.de>
8  ***
9  **************************************************************/
10 
11 #include "StdAfxRHmm.h"
12 
13 
cBaumWelchInParam(uint theNSample,uint theDimObs,cDVector * theY,distrDefinitionEnum theDistrType,uint theNClass,uint theNMixt,uint theNProba)14 cBaumWelchInParam::cBaumWelchInParam(uint theNSample, uint theDimObs, cDVector* theY, distrDefinitionEnum theDistrType, uint theNClass, uint theNMixt, uint theNProba):cInParam(theNSample, theDimObs, theY, theDistrType, theNClass, theNMixt, theNProba)
15 {       MESS_CREAT("cBaumWelchInParam")
16         SetDefault() ;
17 }
~cBaumWelchInParam()18 cBaumWelchInParam::~cBaumWelchInParam()
19 {       MESS_DESTR("cBaumWelchInParam")
20 }
SetDefault(void)21 void cBaumWelchInParam::SetDefault(void)
22 {
23         mInitType = eRandom ;
24         mNMaxIter = 100 ;
25         mTol = 1e-6 ;
26         mNInitIter = 5 ;
27         mNMaxIterInit = 10 ;
28         mVerbose = 0 ;
29 }
30 
operator =(const cBaumWelchInParam & theSrc)31 cBaumWelchInParam &cBaumWelchInParam::operator =(const cBaumWelchInParam &theSrc)
32 {       mInitType = theSrc.mInitType ;
33         mNMaxIter = theSrc.mNMaxIter ;
34         mTol = theSrc.mTol ;
35         mNInitIter = theSrc.mNMaxIterInit ;
36         mNMaxIterInit = theSrc.mNMaxIterInit ;
37         mVerbose = theSrc.mVerbose ;
38 
39         mDistrType = theSrc.mDistrType ;
40         mNClass = theSrc.mNClass ;
41         if (mNSample > 0)
42         {       for (register uint i = 0 ; i < mNSample ; i++)
43                         mY[i].Delete() ;
44                 delete mY ;
45         }
46         mY = new cDVector[theSrc.mNSample] ;
47         mNSample = theSrc.mNSample ;
48         mDimObs = theSrc.mDimObs ;
49         mNProba = theSrc.mNProba ;
50         mNMixt = theSrc.mNMixt ;
51         for (register uint i = 0 ; i < mNSample ; i++)
52                 mY[i] = theSrc.mY[i] ;
53         return *this ;
54 }
55 
Print(void)56 void cBaumWelchInParam::Print(void)
57 {
58         Rprintf("NbSample = %d\n", mNSample) ;
59         for (register uint n = 0 ; n < mNSample ; n++)
60                 Rprintf("mT[%d]=%d\n", n, (mY[n].mSize)/mDimObs) ;
61 }
62