Example #1
0
	double FMatrix::Det() const
	{
		FMatrix d = Triang();
		FVector v = d.get_d();
		double rez = 1.;
		for ( int i = 1;i <= v.get_size();i++ )
		{
			rez *= v( i );
		}
		return rez;
	}
Example #2
0
void CNoiseReduction::Init(const int iNewBlockLen)
{
	iBlockLen = iNewBlockLen;
	iHalfBlockLen = iBlockLen / 2;
	iBlockLenLong = 2 * iBlockLen;

	/* Block length of signal in frequency domain. "+ 1" because of the Nyquist
	   frequency */
	iFreqBlLen = iBlockLen + 1;

	/* Length of the minimum statistic history */
	iMinStatHistLen = (int) (MIN_STAT_HIST_LENGTH_SEC *
		(CReal) SOUNDCRD_SAMPLE_RATE / iBlockLen);

	/* Lambda for IIR filter */
	rLamPSD = IIR1Lam(TICONST_PSD_EST_SIG_NOISE_RED,
		(CReal) SOUNDCRD_SAMPLE_RATE / iBlockLen);

	/* Init vectors storing time series signals */
	vecrOldSignal.Init(iBlockLen, (CReal) 0.0);
	vecrVeryOldSignal.Init(iBlockLen, (CReal) 0.0);
	vecrFiltResult.Init(iBlockLen);
	vecrOutSig1.Init(iBlockLen);
	vecrLongSignal.Init(iBlockLenLong);
	vecrOptFiltTime.Init(iBlockLenLong);
	vecrOldOutSignal.Init(iHalfBlockLen, (CReal) 0.0);

	/* Init plans for FFT (faster processing of Fft and Ifft commands). FFT
	   plans are initialized with the long length */
	FftPlan.Init(iBlockLenLong);

	/* Init vectors storing data in frequency domain */
	veccOptFilt.Init(iFreqBlLen);

	/* Init signal and noise PDS estimation vectors */
	veccSigFreq.Init(iFreqBlLen);
	vecrSqMagSigFreq.Init(iFreqBlLen);
	vecrSigPSD.Init(iFreqBlLen, (CReal) 0.0);
	vecrNoisePSD.Init(iFreqBlLen, (CReal) 0.0);

	matrMinimumStatHist.Init(iFreqBlLen, iMinStatHistLen, (CReal) 0.0);

	/* Init window for overlap and add */
	vecrTriangWin.Init(iBlockLen);
	vecrTriangWin = Triang(iBlockLen);
}