当前位置: 首页>>代码示例>>C++>>正文


C++ Gaussian类代码示例

本文整理汇总了C++中Gaussian的典型用法代码示例。如果您正苦于以下问题:C++ Gaussian类的具体用法?C++ Gaussian怎么用?C++ Gaussian使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Gaussian类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AnalyticConditionalGaussian

  /** @note Because of the virtual public inheritance, we create the Pdf
      baseclass ourselves
  */
  CondGausAddNoise::CondGausAddNoise(const Gaussian& additiveNoise,
				     int num_conditional_arguments)
    : AnalyticConditionalGaussian(additiveNoise.DimensionGet(),
			  num_conditional_arguments)
    , _additiveNoise_Mu   (additiveNoise.ExpectedValueGet())
    , _additiveNoise_Sigma(additiveNoise.CovarianceGet())
  {}
开发者ID:Zy75,项目名称:ardrone_swarm,代码行数:10,代码来源:analyticconditionalgaussian_additivenoise.cpp

示例2: Gaussian

void SumFactor::_internal_update(
    Variable* var,
    std::vector<Gaussian*> y,
    std::vector<Gaussian*> fy,
    std::vector<double>* a) {

    double sum_pi = 0.0, sum_tau = 0.0, new_pi, new_tau, da;
    unsigned int i = 0, size = a->size();
    Gaussian gy, gfy;

    for (i = 0; i < size; ++i) {
        da = (*a)[i];
        gy = *y[i];
        gfy = *fy[i];

        sum_pi = sum_pi + ((da * da) / (gy.pi - gfy.pi));
        sum_tau = sum_tau + (da * (gy.tau - gfy.tau) / (gy.pi - gfy.pi));
    }

    new_pi = 1.0 / sum_pi;
    new_tau = new_pi * sum_tau;

    Gaussian* gaussian = new Gaussian();
    gaussian->init_pi_tau(new_pi, new_tau);
    var->update_message(this, gaussian);
}
开发者ID:JesseBuesking,项目名称:trueskill,代码行数:26,代码来源:trueskill.cpp

示例3: drawGaussian

//----------------------------------------------------------------------------------------------------------------------  
void SMCEnvironmentViz::drawGaussian(const Gaussian& g) const
{
  const int numPoints = 50;
  ci::Vec2f start, end;
  
  // Three sigmas cover approx. 99% of the gaussian
  float a = -3.0 * g.getW();
  float inc = 6.0 * g.getW() / numPoints;
  
  ci::Path2d path;
  path.moveTo(g.getPointAt(a));
  for(int i = 0; i < numPoints; ++i)
  {
    end = g.getPointAt((a+inc));
    path.lineTo(end);
    a += inc;
  }
  path.close();
  
  glColor4f(0.5,0.5,0.5,0.25);
  glDisable(GL_CULL_FACE);
  glDisable(GL_DEPTH_TEST);
  ci::gl::drawSolid(path);
  glEnable(GL_CULL_FACE);
  glEnable(GL_DEPTH_TEST);
}
开发者ID:buhrmann,项目名称:dynmx,代码行数:27,代码来源:SMCEnvironmentViz.cpp

示例4: is_approx

    bool is_approx(const Gaussian<OtherVariate>& other)
    {


        return fl::are_similar(mean(), other.mean()) &&
               fl::are_similar(covariance(), other.covariance());
    }
开发者ID:filtering-library,项目名称:fl,代码行数:7,代码来源:gaussian.hpp

示例5: assert

// load the HMM from a file
void HMMState::load(FileInput &file, unsigned char iEstimationMethod) {

	// phonetic symbol
	char strPhone[MAX_PHONETIC_SYMBOL_LENGTH+1];	
	IOBase::readBytes(file.getStream(),reinterpret_cast<char*>(strPhone),MAX_PHONETIC_SYMBOL_LENGTH+1);
	m_iPhone = m_phoneSet->getPhoneIndex(strPhone);
	assert(m_iPhone != UCHAR_MAX);
	
	// state
	IOBase::read(file.getStream(),&m_iState);
	assert(m_iState < NUMBER_HMM_STATES);
	
	// within word position (DEPRECATED)
	IOBase::read(file.getStream(),&m_iPosition);
	
	// Gaussian components
	int iGaussianComponents = -1;
	IOBase::read(file.getStream(),&iGaussianComponents);
	for(int iGaussian = 0 ; iGaussian < iGaussianComponents ; ++iGaussian) {
	
		Gaussian *gaussian = new Gaussian(m_iDim,m_iCovarianceModeling);	
		
		IOBase::read(file.getStream(),&gaussian->weight());
		gaussian->mean().readData(file.getStream());		
		if (m_iCovarianceModeling == COVARIANCE_MODELLING_TYPE_DIAGONAL) {
			gaussian->covarianceDiag().readData(file.getStream());
		} else {
			gaussian->covarianceFull().readData(file.getStream());
		}	
		m_gaussianMixture->addGaussianComponent(gaussian);
	}
}
开发者ID:nlphacker,项目名称:bavieca,代码行数:33,代码来源:HMMState.cpp

示例6: memset

// store the HMM into a file
void HMMState::store(FileOutput &file) {
	
	// phonetic symbol
	char strPhone[MAX_PHONETIC_SYMBOL_LENGTH+1];
	memset(strPhone,0,MAX_PHONETIC_SYMBOL_LENGTH+1);
	strcpy(strPhone,m_phoneSet->getStrPhone(m_iPhone));	
	IOBase::writeBytes(file.getStream(),reinterpret_cast<char*>(strPhone),MAX_PHONETIC_SYMBOL_LENGTH+1);
	
	// state
	IOBase::write(file.getStream(),m_iState);
	
	// within word position (DEPRECATED)
	IOBase::write(file.getStream(),m_iPosition);

	// Gaussian components
	int iGaussianComponents = m_gaussianMixture->getNumberComponents();
	IOBase::write(file.getStream(),iGaussianComponents);
	for(int iGaussian = 0 ; iGaussian < iGaussianComponents ; ++iGaussian) {
		Gaussian *gaussian = (*m_gaussianMixture)(iGaussian); 
		IOBase::write(file.getStream(),gaussian->weight());
		gaussian->mean().writeData(file.getStream());
		if (m_iCovarianceModeling == COVARIANCE_MODELLING_TYPE_DIAGONAL) {
			gaussian->covarianceDiag().writeData(file.getStream());
		} else {
			gaussian->covarianceFull().writeData(file.getStream());
		}
	}
}
开发者ID:nlphacker,项目名称:bavieca,代码行数:29,代码来源:HMMState.cpp

示例7: ocl_filterGaussian_init

void OpenCLExecuter::ocl_filterGaussian_init(float sigma, float size)
{
	Gaussian gauss;
	gauss.sigma = sigma;
	gauss.size = size;
	filter_width = (size-1)/2.0;
	filter_kernel = gauss.gaussianmask1Df(gauss.sigma, gauss.size);
}
开发者ID:ut666,项目名称:VolViewer,代码行数:8,代码来源:OpenCLExecuter.cpp

示例8: testGaussianNumerics

void testGaussianNumerics(){
  
  std::cout.precision(16);
  std::cout << std::scientific;
    
  Gaussian g = Gaussian(5, 1);
  for(unsigned i = 0; i < 100; i++){
    std::cout << i << ": L: " << g.likelihood((fracfloat_t)i) << " -LL: " << (-INV_LN_2 * log(g.likelihood(i))) << ", S: " << g.surprisal((fracfloat_t)i) << std::endl;
  }
}
开发者ID:bfisch02,项目名称:csax_cpp,代码行数:10,代码来源:unittest.cpp

示例9: defaultAonly

void GMMfitData::defaultAonly(Gaussian &g)
{
    Vector2d mu;
    mu<< 1.0, 0.1;
    g.setMu(mu);

    Matrix2d sigma;
    sigma<< 0.020,   -0.001,
           -0.001,    0.005;
    g.setSigma(sigma);
}
开发者ID:jkriege2,项目名称:QuickFit3,代码行数:11,代码来源:alexdata.cpp

示例10: defaultDonly

void GMMfitData::defaultDonly(Gaussian &g)
{
    Vector2d mu;
    mu<< 0.0, 0.98;
    g.setMu(mu);

    Matrix2d sigma;
    sigma<< 0.0012,    0.0000,
            0.0000,    0.0015;
    g.setSigma(sigma);
}
开发者ID:jkriege2,项目名称:QuickFit3,代码行数:11,代码来源:alexdata.cpp

示例11: defaultLowFRET

void GMMfitData::defaultLowFRET(Gaussian &g)
{
    Vector2d mu;
    mu<< 0.15, 0.5;
    g.setMu(mu);

    Matrix2d sigma;
    sigma<< 0.050,    0.000,
            0.000,    0.020;
    g.setSigma(sigma);
}
开发者ID:jkriege2,项目名称:QuickFit3,代码行数:11,代码来源:alexdata.cpp

示例12: vwcgaussProcessParameter

void vwcgauss
(const RealArray& energy, const RealArray& parameter, 
 /*@[email protected]*/ int spectrum, RealArray& flux, /*@[email protected]*/ RealArray& fluxError,
 /*@[email protected]*/ const string& init)
{
  fluxError.resize (0);
  Real LineEnergy, Sigma;
  vwcgaussProcessParameter (parameter, LineEnergy, Sigma);
  Gaussian G (energy, LineEnergy, Sigma);
  G.getFlux (flux);
  return;
}
开发者ID:mauriceleutenegger,项目名称:windprofile,代码行数:12,代码来源:GaussianModels.cpp

示例13: RunCannyTest

void Test::RunCannyTest(const RGBImage* in) {
	Gaussian smoother;
	Sobel sobel;
	Canny canny;
	StudentPreProcessing converter;

	double sigma = 1.6;
	int kernelSize = 5;

	// Convert RGB to Intensity
	IntensityImage* grey = ImageFactory::newIntensityImage(in->getWidth(), in->getHeight());
	grey = converter.stepToIntensityImage(*in);

	BaseTimer timer;
	int total = 0;
	for (int i = 0; i < 10; ++i) {
		timer.start();

		/* Start of Canny */

		// 1. Smooth Intensity with Gaussian
		IntensityImage* gaussian = ImageFactory::newIntensityImage(in->getWidth() - kernelSize, in->getHeight() - kernelSize);
		smoother.smoothImage(grey, gaussian, sigma, kernelSize);

		// 2. Find edges with Sobel (convolve X and Y separately for Canny)
		int sobelKernelSize = 3;
		IntensityImage* sobelX = ImageFactory::newIntensityImage(gaussian->getWidth() - sobelKernelSize, gaussian->getHeight() - sobelKernelSize);
		IntensityImage* sobelY = ImageFactory::newIntensityImage(gaussian->getWidth() - sobelKernelSize, gaussian->getHeight() - sobelKernelSize);
		sobel.filterXY(gaussian, sobelX, sobelY);

		// 3. Apply non-maximum suppresion
		IntensityImage* nonMaxSuppression = ImageFactory::newIntensityImage(sobelX->getWidth(), sobelX->getHeight());
		canny.nonMaximumSurpression(sobelX, sobelY, nonMaxSuppression);

		// 4. Apply hysteresis threshold
		IntensityImage* hysteresisThreshold = ImageFactory::newIntensityImage(sobelX->getWidth(), sobelX->getHeight());
		canny.threshold(nonMaxSuppression, hysteresisThreshold, 60, 70);

		timer.stop();
		std::cout << timer.elapsedMilliSeconds() << " ms" << std::endl;
		total += timer.elapsedMilliSeconds();
		timer.reset();

		if (i == 9)
			ImageIO::saveIntensityImage(*hysteresisThreshold, ImageIO::getDebugFileName("Canny.png"));
	}
	std::cout << "Average time per Canny edge detection: " << (total / 10) << " ms" << std::endl;
	std::cout << "Press the X in the console window to exit program" << std::endl;
}
开发者ID:matman476,项目名称:HU-Vision-1415-Base,代码行数:49,代码来源:Test.cpp

示例14: createTdData

/**
 * Create a time series of input data.
 *
 * Description:\n
 * 	Creates a time series of complex floats representing a signal at
 * 	a given frequency.
 */
ComplexFloat32 *
createTdData(float64_t fMHz, float64_t driftHz, int32_t samples,
		float64_t noise)
{
	size_t size = samples * sizeof(ComplexFloat32);
	ComplexFloat32 *td = static_cast<ComplexFloat32 *> (fftwf_malloc(size));
	float64_t dfMHz = fMHz - centerFreqMHz;
	float64_t widthMHz = subchannels * subchannelWidthMHz;
	Gaussian gen;
	// no noise, just signal
	gen.setup(0, widthMHz, noise);
	gen.addCwSignal(dfMHz, driftHz, 1);
	gen.getSamples(td, samples);
	return (td);
}
开发者ID:Abhishekpatil,项目名称:SonATA,代码行数:22,代码来源:test.cpp

示例15: assert

  // constructor
  NonLinearAnalyticConditionalGaussian_Ginac::NonLinearAnalyticConditionalGaussian_Ginac
  (const GiNaC::matrix& func,
   const vector<GiNaC::symbol>& u,
   const vector<GiNaC::symbol>& x,
   const Gaussian& additiveNoise,
   const vector<GiNaC::symbol>& cond )
    :AnalyticConditionalGaussianAdditiveNoise(additiveNoise,3),
     func_sym        (func),
     cond_sym        (cond),
     u_sym           (u),
     x_sym           (x),
     cond_size       (cond_sym.size()),
     u_size          (u_sym.size()),
     x_size          (x_sym.size()),
     func_size       (func_sym.rows()),
     dfunc_dcond     (cond_size),
     dfunc_dx        (x_size)
  {
    // test for consistent input
    assert (func_sym.cols() == 1);
    assert (additiveNoise.DimensionGet() == cond_size);

    // derive func to cond
    for (unsigned int i=0; i < cond_size; i++)
      dfunc_dcond[i] = func_sym.diff(cond_sym[i]);

    // derive func to x
    for (unsigned int i=0; i < x_size; i++)
      dfunc_dx[i] = func_sym.diff(x_sym[i]);
  }
开发者ID:Zy75,项目名称:ardrone_swarm,代码行数:31,代码来源:nonlinearanalyticconditionalgaussian_ginac.cpp


注:本文中的Gaussian类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。