samplemodeler.cpp

来自「Octane v1.01.20 The Open Compression To」· C++ 代码 · 共 33 行

CPP
33
字号
/// @file samplemodeler.cpp
/// A sample modeler which basically assigns fixed equal probabilities to every symbol.
///
/// @author mouser
/// @date   2003.07.29
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
#include "samplemodeler.hpp"
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
// MODELLER PUBLIC API
bool SampleModeler::CreateModelUsingParser(OctaneParser *parserp)
	{
	// initialize vector with proper number of symbols as specified by the parser
	int symbolcount=parserp->GetSymbolCount();
	weightvector.SetSymbolCount(symbolcount);

	// set them all equal
	for (int index=0;index<symbolcount;++index)
		weightvector.SetSymbolWeight(index,1);

	// normalize to probability distribution
	weightvector.NormalizeToProbabilityDistribution();

	// success
	return true;
	}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?