Esempio n. 1
0
cLogBaumWelch::cLogBaumWelch(const cInParam &theInParam)
{       MESS_CREAT("cLogBaumWelch") 
        mvNSample = theInParam.mNSample ;
        if (mvNSample == 0)
        {       mvT = NULL ;
                mLogVrais.Delete() ;
                mLogAlpha = NULL ;
                mLogBeta = NULL ;
                mLogGamma = NULL ;
                mLogXsi = NULL ;
                mLogRho = NULL ;
                return ;
        }       
        mvT = new uint[mvNSample] ;
        mLogVrais.ReAlloc(mvNSample) ;
        
        mLogAlpha = new cDMatrix[mvNSample] ;
        mLogBeta = new cDMatrix[mvNSample] ;
        mLogGamma = new cDMatrix[mvNSample] ;
        mLogXsi = new cDMatrix*[mvNSample] ;
        mSumLogXsi = new cDMatrix[mvNSample] ;
        mLogRho = new cDVector[mvNSample] ;
        for (register uint n = 0 ; n < mvNSample ; n++)
        {       mvT[n] = (theInParam.mY[n].mSize)/theInParam.mDimObs ;
                mLogAlpha[n].ReAlloc(theInParam.mNClass, mvT[n]) ;
                mLogBeta[n].ReAlloc(theInParam.mNClass, mvT[n]) ;
                mLogGamma[n].ReAlloc(theInParam.mNClass, mvT[n]) ;
                mLogXsi[n] = new cDMatrix[mvT[n]] ;
                for (register uint t=0 ; t < mvT[n] ; t++)
                        mLogXsi[n][t].ReAlloc(theInParam.mNClass, theInParam.mNClass) ;
                mSumLogXsi[n].ReAlloc(theInParam.mNClass, theInParam.mNClass) ;
                mLogRho[n].ReAlloc(mvT[n]) ;
        }       
}
Esempio n. 2
0
cHmm::cHmm(distrDefinitionEnum theDistrType, uint theNClass, uint theDimObs, uint theNMixture, uint theNProba)
{       MESS_CREAT("cHmm")
        mDistrType = theDistrType ;
        mInitProba.ReAlloc(theNClass) ;

        cDMatrix *transMat = new cDMatrix(theNClass,theNClass,0.0);
        mTransMatVector.push_back(*transMat);
//      mTransMat.ReAlloc(theNClass, theNClass) ;

        switch(mDistrType)
        {       case eNormalDistr :
                        mDistrParam = new cUnivariateNormal(theNClass) ;
                break ;
                case eMultiNormalDistr :
                        mDistrParam = new cMultivariateNormal(theNClass, theDimObs) ;
                break ;
                case eMixtUniNormalDistr :
                        mDistrParam = new cMixtUnivariateNormal(theNClass, theNMixture) ;
                break ;
                case eMixtMultiNormalDistr :
                        mDistrParam = new cMixtMultivariateNormal(theNClass, theNMixture, theDimObs) ;
                break ;
                case eDiscreteDistr :
                        mDistrParam = new cDiscrete(theNClass, theNProba) ;
                break ;
                case eUnknownDistr :
                        mDistrParam = (cDistribution *)NULL ;
                break ;
        }
}
Esempio n. 3
0
cTarch::cTarch(int theNTarch):cAbstCondVar(eTarch)
{
	mvCste = 0.0L ;
	mvArchPos.ReAlloc(theNTarch) ;
	mvArchNeg.ReAlloc(theNTarch) ;
	MESS_CREAT("cTarch") ;
}
Esempio n. 4
0
cLogBaumWelch::cLogBaumWelch(uint theNSample, uint* theT, uint theNClass)
{       MESS_CREAT("cLogBaumWelch") 
        mvNSample = theNSample ;
        if (mvNSample == 0)
        {       mvT = NULL ;
                mLogVrais.Delete() ;
                mLogAlpha = NULL ;
                mLogBeta = NULL ;
                mLogGamma = NULL ;
                mLogXsi = NULL ;
                mSumLogXsi = NULL ;
                mLogRho = NULL ;
                return ;
        }
        mvT = new uint[mvNSample] ;
        mLogVrais.ReAlloc(mvNSample) ;
        
        mLogAlpha = new cDMatrix[mvNSample] ;
        mLogBeta = new cDMatrix[mvNSample] ;
        mLogGamma = new cDMatrix[mvNSample] ;
        mLogXsi = new cDMatrix*[mvNSample] ;
        mSumLogXsi = new cDMatrix[mvNSample] ;
        mLogRho = new cDVector[mvNSample] ;
        for (register uint n = 0 ; n < mvNSample ; n++)
        {       mvT[n] = theT[n] ;
                mLogAlpha[n].ReAlloc(theNClass, mvT[n]) ;
                mLogBeta[n].ReAlloc(theNClass, mvT[n]) ;
                mLogGamma[n].ReAlloc(theNClass, mvT[n]) ;
                mLogXsi[n] = new cDMatrix[mvT[n]] ;
                for (register uint t = 0 ; t < mvT[n] ; t++)
                        mLogXsi[n][t].ReAlloc(theNClass, theNClass) ;
                mSumLogXsi[n].ReAlloc(theNClass, theNClass) ;
                mLogRho[n].ReAlloc(mvT[n]) ;
        }       
}
Esempio n. 5
0
cHmm::cHmm(const cInParam &theInParam)
{       MESS_CREAT("cHmm")
        mInitProba.ReAlloc(theInParam.mNClass);
//      mTransMat.ReAlloc(theInParam.mNClass, theInParam.mNClass) ;

        cDMatrix *transMat = new cDMatrix(theInParam.mNClass,theInParam.mNClass,0.0);
        mTransMatVector.push_back(*transMat);
        delete transMat;

        mDistrType = theInParam.mDistrType ;
        switch(mDistrType)
        {       case eNormalDistr :
                        mDistrParam = new cUnivariateNormal(theInParam.mNClass) ;
                break ;
                case eMultiNormalDistr :
                        mDistrParam = new cMultivariateNormal(theInParam.mNClass, theInParam.mDimObs) ;
                break ;
                case eMixtUniNormalDistr :
                        mDistrParam = new cMixtUnivariateNormal(theInParam.mNClass, theInParam.mNMixt) ;
                break ;
                case eMixtMultiNormalDistr :
                        mDistrParam = new cMixtMultivariateNormal(theInParam.mNClass, theInParam.mNMixt, theInParam.mDimObs) ;
                break ;
                case eDiscreteDistr :
                        mDistrParam = new cDiscrete(theInParam.mNClass, theInParam.mNProba) ;
                break ;
                case eUnknownDistr :
                        mDistrParam = (cDistribution *)NULL ;
                break ;
        }
}
Esempio n. 6
0
	/*!
	 * \fn cCondMean::cCondMean(const cCondMean& theCondMean)
	 * \param cCondMean& theCondMean: conditional mean
	 * \details Recopy constructor
	 */
	cCondMean::cCondMean(const cCondMean& theCondMean)
	: mvCondMean(theCondMean.GetNMean())
	{
	uint myNCondMean = (uint)mvCondMean.size();
	vector<cAbstCondMean*> myCondMean = theCondMean.GetCondMean() ;
		for (register uint i = 0; i < myNCondMean; i++)
			mvCondMean.at(i) = myCondMean.at(i)->PtrCopy() ;
		MESS_CREAT("cCondMean") ;
	}
Esempio n. 7
0
cAparch::cAparch(int theNArch, int theNGarch):cAbstCondVar(eAparch)
{
	mvCste = 0.0L ;
	mvDelta = 0.0L ;
	mvArch.ReAlloc(theNArch) ;
	mvGamma.ReAlloc(theNArch) ;
	mvGarch.ReAlloc(theNGarch) ;
	MESS_CREAT("cAparch") ;
}
Esempio n. 8
0
cRegArchValue::cRegArchValue(const cRegArchValue* theValue)
{
	mYt.ReAlloc(theValue->mYt);
	mXt.ReAlloc(theValue->mXt);
	mMt.ReAlloc(theValue->mMt);
	mHt.ReAlloc(theValue->mHt);
	mUt.ReAlloc(theValue->mUt);
	mEpst.ReAlloc(theValue->mEpst);
	MESS_CREAT("cRegArchValue");
}
Esempio n. 9
0
cRegArchParam::cRegArchParam(const cRegArchParam* theParam)
{
	mMean = NULL ;
	mVar = NULL ;
	mResids = NULL ;
	if (theParam != NULL)
	{	AddMean(*(theParam->mMean)) ;
		AddVar(*(theParam->mVar)) ;
		AddResid(theParam->mResids->GetDistrType(), &(theParam->mResids->mLawParam), theParam->mResids->GetForSimul()) ;
	}
 	MESS_CREAT("cRegArchParam") ;
}
Esempio n. 10
0
cRegArchParam::cRegArchParam(cCondMean* theMean, cAbstCondVar* theVar, const cAbstResiduals* theResiduals)
// theMean and theVar cannot be const due to the use of AddMean and AddVar
{	mMean = NULL ;
	mVar = NULL ;
	mResids = NULL ;
	if (theMean != NULL)
		AddMean(*theMean) ;
	if (theVar != NULL)
		AddVar(*theVar) ;
	if (theResiduals != NULL)
		AddResid(*theResiduals) ;

 	MESS_CREAT("cRegArchParam") ;
}
Esempio n. 11
0
cRegArchValue::cRegArchValue(uint theSampleSize, cDMatrix* theXt)
{
	if (theSampleSize > 0)
	{	mYt.ReAlloc(theSampleSize) ;
		if ( (theXt == NULL) || (theXt->GetMat() == NULL) )
			ClearMatrix(mXt) ;
		else
			mXt = *theXt ;
		mMt.ReAlloc(theSampleSize) ;
		mHt.ReAlloc(theSampleSize) ;
		mUt.ReAlloc(theSampleSize) ;
		mEpst.ReAlloc(theSampleSize) ;
	}
	else
	{	mYt.Delete();
		ClearMatrix(mXt) ;
		mMt.Delete() ;
		mHt.Delete() ;
		mUt.Delete() ;
		mEpst.Delete() ;
	}
	MESS_CREAT("cRegArchValue") ;
}
Esempio n. 12
0
cRegArchValue::cRegArchValue(cDVector* theYt, cDMatrix* theXt) // Xt T rows, p columns
{
	if (theYt == NULL)
	{	mYt.Delete() ;
		ClearMatrix(mXt) ;
		mMt.Delete() ;
		mHt.Delete() ;
		mUt.Delete() ;
		mEpst.Delete() ;
	}
	else
	{	mYt = *theYt ;
	uint mySampleSize = mYt.GetSize() ;
		mMt.ReAlloc(mySampleSize) ;
		mHt.ReAlloc(mySampleSize) ;
		mUt.ReAlloc(mySampleSize) ;
		mEpst.ReAlloc(mySampleSize) ;		
		if (theXt == NULL)
			ClearMatrix(mXt) ;
		else
			mXt = *theXt ;
	}
	MESS_CREAT("cRegArchValue") ;
}
Esempio n. 13
0
	/*!
	 * \fn cCondMean::cCondMean(uint theNCondMean)
	 * \param uint theNCondMean: number of conditional means
	 * \details mvCondMean = theNCondMean
	 */
	cCondMean::cCondMean(uint theNCondMean)
	: mvCondMean(theNCondMean)
	{
		MESS_CREAT("cCondMean") ;
	}
Esempio n. 14
0
	/*!
	 * \fn cConst::cConst(double theVal):cAbstCondMean(eConst)
	 * \param double theVal: constant value, default 0.0L.
	 */
	cConst::cConst(double theVal):cAbstCondMean(eConst)
	{	mvConst = theVal ;
		MESS_CREAT("cConst") ;
	}
Esempio n. 15
0
cConstCondVar::cConstCondVar(double theValue):cAbstCondVar(eCste)
{	mvCste = theValue ;
	MESS_CREAT("cConstCondVar");
}
Esempio n. 16
0
	/*!
	 * \fn cConst::cConst(cAbstCondMean& theAbstCondMean)
	 * \param const cAbstCondMean& theAbstCondMean: the cConst source.
	 */
	cConst::cConst(const cConst& theConst):cAbstCondMean(eUnknown)
	{
		*this = theConst;
		MESS_CREAT("cConst") ;
	}
Esempio n. 17
0
cAr::cAr(int theNAr):cAbstCondMean(eAr)
{
	mvAr.ReAlloc(theNAr) ;
	MESS_CREAT("cAR") ;
}