• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ vector_float类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: size

/*---------------------------------------------------------------
						squareErrorVector
  ---------------------------------------------------------------*/
void  TMatchingPairList::squareErrorVector(const CPose2D &q, vector_float &out_sqErrs ) const
{
	out_sqErrs.resize( size() );
	// *    \f[ e_i = | x_{this} -  q \oplus x_{other}  |^2 \f]

	const float ccos = cos(q.phi());
	const float csin = sin(q.phi());
	const float qx   = q.x();
	const float qy   = q.y();
	float  xx, yy;		// Transformed points

	const_iterator 			corresp;
	vector_float::iterator	e_i;
	for (corresp=begin(), e_i = out_sqErrs.begin();corresp!=end();corresp++, e_i++)
	{
		xx = qx + ccos * corresp->other_x - csin * corresp->other_y;
		yy = qy + csin * corresp->other_x + ccos * corresp->other_y;
		*e_i = square( corresp->this_x - xx ) + square( corresp->this_y - yy );
	}
}
开发者ID:Aharobot,项目名称:mrpt,代码行数:23,代码来源:TMatchingPair.cpp


示例2: resetUniform

/*---------------------------------------------------------------
						resetUniform
 ---------------------------------------------------------------*/
void  CPosePDFParticlesExtended::resetUniform(
			  float x_min,  float x_max,
			  float y_min,  float y_max,
			  vector_float	state_min,
			  vector_float	state_max,
			  float phi_min,float phi_max,
			  int	particlesCount)
{
	MRPT_START

	ASSERT_( state_min.size() == state_max.size() );

	if (particlesCount>0)
	{
		clear();
		m_particles.resize(particlesCount);
		for (int i=0;i<particlesCount;i++)
			m_particles[i].d = new TExtendedCPose2D();
	}

	size_t		i,M = m_particles.size();
	for (i=0;i<M;i++)
	{
		m_particles[i].d->pose.x(  randomGenerator.drawUniform( x_min, x_max ));
		m_particles[i].d->pose.y(  randomGenerator.drawUniform( y_min, y_max ));
		m_particles[i].d->pose.phi(randomGenerator.drawUniform( phi_min, phi_max ));
		m_particles[i].d->state.resize(state_min.size());
		m_particles[i].d->state.resize(state_max.size());

		for (int k=0;k<state_min.size();k++)
			m_particles[i].d->state[k] = randomGenerator.drawUniform( state_min[k], state_max[k] );

		m_particles[i].log_w=0;
	}

	MRPT_END
}
开发者ID:gamman,项目名称:MRPT,代码行数:40,代码来源:CPosePDFParticlesExtended.cpp


示例3: srotm

 /**
  * C++ version of gsl_blas_srotm().
  * @param X A vector
  * @param Y A vector
  * @param P An array
  * @return Error code on failure
  */
 int srotm( vector_float& X, vector_float& Y, float const P[] ){
   return gsl_blas_srotm( X.get(), Y.get(), P ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:9,代码来源:blas.hpp


示例4: srot

 /**
  * C++ version of gsl_blas_srot().
  * @param X A vector
  * @param Y A vector
  * @param c A constant
  * @param s A constant
  * @return Error code on failure
  */
 int srot( vector_float& X, vector_float& Y, float c, float s ){
   return gsl_blas_srot( X.get(), Y.get(), c, s );
 }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:11,代码来源:blas.hpp


示例5: saxpy

 /**
  * C++ version of gsl_blas_saxpy().
  * @param alpha A vector
  * @param X A vector
  * @param Y A vector
  * @return Error code on failure
  */
 int saxpy( float alpha, vector_float const& X, vector_float& Y ){
   return gsl_blas_saxpy( alpha, X.get(), Y.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:9,代码来源:blas.hpp


示例6: plot

// Add / Modify a 2D plot using a MATLAB-like format string
void CWindowDialogPlots::plot(
	const vector_float &x,
	const vector_float &y,
	const std::string  &lineFormat,
	const std::string  &plotName)
{
	mpFXYVector  *theLayer;

	wxString    lyName = _U(plotName.c_str());
	bool        updateAtTheEnd = false; // If we update an existing layer, update manually to refresh the changes!

	// Already existing layer?
	mpLayer* existingLy = m_plot->GetLayerByName( lyName );

	if (existingLy)
	{
		// Assure the class:
		mpFXYVector  *lyPlot2D = static_cast<mpFXYVector*> ( existingLy );

		if (!lyPlot2D)
		{
			cerr << "[CWindowDialogPlots::plot] Plot name '" << plotName << "' is not of expected class mpFXYVector!."<< endl;
			return;
		}

		// Ok:
		theLayer = lyPlot2D;
		updateAtTheEnd = true;
	}
	else
	{
		// Create it:
		theLayer = new mpFXYVector( lyName );
		m_plot->AddLayer( theLayer );
	}

	// Set data:
	{
		std::vector<float> x_(x.size()),y_(x.size());
		::memcpy(&x_[0],&x[0],sizeof(x[0])*x_.size());
		::memcpy(&y_[0],&y[0],sizeof(y[0])*y_.size());
		theLayer->SetData( x_,y_ );
	}

	// Line style:
	// -------------------
	bool isContinuous=true;
	int  lineColor[] = {0,0,255};
	int  lineWidth = 1;
	int  lineStyle = wxSOLID;

	// parse string:
	if ( string::npos != lineFormat.find(".") )		{ isContinuous=false; }
	if ( string::npos != lineFormat.find("-") )		{ isContinuous=true; lineStyle = wxSOLID; }
	if ( string::npos != lineFormat.find(":") )		{ isContinuous=true; lineStyle = wxLONG_DASH; }

	if ( string::npos != lineFormat.find("r") )		{ lineColor[0]=0xFF; lineColor[1]=0x00; lineColor[2]=0x00; }
	if ( string::npos != lineFormat.find("g") )		{ lineColor[0]=0x00; lineColor[1]=0xFF; lineColor[2]=0x00; }
	if ( string::npos != lineFormat.find("b") )		{ lineColor[0]=0x00; lineColor[1]=0x00; lineColor[2]=0xFF; }
	if ( string::npos != lineFormat.find("k") )		{ lineColor[0]=0x00; lineColor[1]=0x00; lineColor[2]=0x00; }
	if ( string::npos != lineFormat.find("m") )		{ lineColor[0]=192; lineColor[1]=0; lineColor[2]=192; }
	if ( string::npos != lineFormat.find("c") )		{ lineColor[0]=0; lineColor[1]=192; lineColor[2]=192; }

	if ( string::npos != lineFormat.find("1") )		{ lineWidth=1; }
	if ( string::npos != lineFormat.find("2") )		{ lineWidth=2; }
	if ( string::npos != lineFormat.find("3") )		{ lineWidth=3; }
	if ( string::npos != lineFormat.find("4") )		{ lineWidth=4; }
	if ( string::npos != lineFormat.find("5") )		{ lineWidth=5; }
	if ( string::npos != lineFormat.find("6") )		{ lineWidth=6; }
	if ( string::npos != lineFormat.find("7") )		{ lineWidth=7; }
	if ( string::npos != lineFormat.find("8") )		{ lineWidth=8; }
	if ( string::npos != lineFormat.find("9") )		{ lineWidth=9; }

	theLayer->SetContinuity(isContinuous);

	wxPen  pen( wxColour(lineColor[0],lineColor[1],lineColor[2]), lineWidth, lineStyle );
	theLayer->SetPen(pen);

	theLayer->ShowName(false);

	if (updateAtTheEnd)
		m_plot->Refresh(false);

}
开发者ID:Aharobot,项目名称:mrpt,代码行数:85,代码来源:CDisplayWindowPlots.cpp


示例7: dsdot

 /**
  * C++ version of gsl_blas_dsdot().
  * @param X First vector
  * @param Y Second vector
  * @param result Vector product
  * @return Error code on failure
  */
 int dsdot( vector_float const& X, vector_float const& Y, double* result ){
   return gsl_blas_dsdot( X.get(), Y.get(), result ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:9,代码来源:blas.hpp


示例8: sger

 /**
  * C++ version of gsl_blas_sger().
  * @param alpha A constant
  * @param X A vector
  * @param Y A vector
  * @param A A matrix
  * @return Error code on failure
  */
 int sger( float alpha, vector_float const& X, vector_float const& Y, matrix_float& A ){
   return gsl_blas_sger( alpha, X.get(), Y.get(), A.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:10,代码来源:blas.hpp


示例9: strsv

    /**
     * C++ version of gsl_blas_strsv().
     * @param Uplo Upper or lower triangular
     * @param TransA Transpose type
     * @param Diag Diagonal type
     * @param A A matrix
     * @param X A vector
     * @return Error code on failure
     */
    int strsv( CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA,
	       CBLAS_DIAG_t Diag, matrix_float const& A, vector_float& X ){
      return gsl_blas_strsv( Uplo, TransA, Diag, A.get(), X.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:12,代码来源:blas.hpp


示例10: snrm2

 /**
  * C++ version of gsl_blas_snrm2().
  * @param X A vector
  * @return The Euclidean norm
  */
 float snrm2( vector_float const& X ){ return gsl_blas_snrm2( X.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:6,代码来源:blas.hpp


示例11: vector_float_inverse

      /**
       * C++ version of gsl_permute_vector_float_inverse().
       * @param p A permutation
       * @param v A vector
       * @return Error code on failure
       */
      inline int vector_float_inverse( permutation const& p, vector_float& v ){
	return gsl_permute_vector_float_inverse( p.get(), v.get() ); } 
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:8,代码来源:permute_vector.hpp


示例12: unpack

      inline int unpack( vector_float const& real_float_coefficient,
		  vector_complex_float& complex_coefficient ){
	size_t n = std::max( real_float_coefficient.size(), complex_coefficient.size() );
	return gsl_fft_real_float_unpack( real_float_coefficient.data(), complex_coefficient.data(),
					  1, n ); }
开发者ID:Bhare8972,项目名称:RFD_modelling,代码行数:5,代码来源:fft_real_float.hpp


示例13: unpack

      inline int unpack( vector_float const& real_coefficient, vector_complex_float& complex_coefficient,
			 size_t const stride ){
	size_t n = std::max( real_coefficient.size(), complex_coefficient.size() );
	return gsl_fft_halfcomplex_float_unpack( real_coefficient.data(), complex_coefficient.data(),
					   stride, n ); }
开发者ID:Bhare8972,项目名称:RFD_modelling,代码行数:5,代码来源:fft_halfcomplex_float.hpp


示例14: plotEllipse

// Add / Modify a 2D ellipse
// x[0,1]: Mean
// y[0,1,2]: Covariance matrix (0,0),(1,1),(0,1)
void CWindowDialogPlots::plotEllipse(
	const vector_float &x,
	const vector_float &y,
	const std::string  &lineFormat,
	const std::string  &plotName,
	bool showName)
{
	mpCovarianceEllipse  *theLayer;

	if (x.size()!=3 || y.size()!=3)
	{
		cerr << "[CWindowDialogPlots::plotEllipse] vectors do not have expected size!!" << endl;
		return;
	}

	wxString    lyName = _U(plotName.c_str());
	bool        updateAtTheEnd = false; // If we update an existing layer, update manually to refresh the changes!

	// Already existing layer?
	mpLayer* existingLy = m_plot->GetLayerByName( lyName );

	if (existingLy)
	{
		// Assure the class:
		mpCovarianceEllipse  *lyPlotEllipse = static_cast<mpCovarianceEllipse*> ( existingLy );

		if (!lyPlotEllipse)
		{
			cerr << "[CWindowDialogPlots::plotEllipse] Plot name '" << plotName << "' is not of expected class mpCovarianceEllipse!."<< endl;
			return;
		}

		// Ok:
		theLayer = lyPlotEllipse;
		updateAtTheEnd = true;
	}
	else
	{
		// Create it:
		theLayer = new mpCovarianceEllipse( 1,1,0,2,32, lyName );
		m_plot->AddLayer( theLayer );
	}

	// Set data:
	theLayer->SetCovarianceMatrix(y[0],y[2],y[1]);
	theLayer->SetCoordinateBase(x[0],x[1]);
	theLayer->SetQuantiles(x[2]);
	theLayer->ShowName(showName);

	// Line style:
	// -------------------
	bool isContinuous=true;
	int  lineColor[] = {0,0,255};
	int  lineWidth = 1;
	int  lineStyle = wxSOLID;

	// parse string:
	if ( string::npos != lineFormat.find(".") )		{ isContinuous=false; }
	if ( string::npos != lineFormat.find("-") )		{ isContinuous=true; lineStyle = wxSOLID; }
	if ( string::npos != lineFormat.find(":") )		{ isContinuous=true; lineStyle = wxLONG_DASH; }

	if ( string::npos != lineFormat.find("r") )		{ lineColor[0]=0xFF; lineColor[1]=0x00; lineColor[2]=0x00; }
	if ( string::npos != lineFormat.find("g") )		{ lineColor[0]=0x00; lineColor[1]=0xFF; lineColor[2]=0x00; }
	if ( string::npos != lineFormat.find("b") )		{ lineColor[0]=0x00; lineColor[1]=0x00; lineColor[2]=0xFF; }
	if ( string::npos != lineFormat.find("k") )		{ lineColor[0]=0x00; lineColor[1]=0x00; lineColor[2]=0x00; }
	if ( string::npos != lineFormat.find("m") )		{ lineColor[0]=192; lineColor[1]=0; lineColor[2]=192; }
	if ( string::npos != lineFormat.find("c") )		{ lineColor[0]=0; lineColor[1]=192; lineColor[2]=192; }

	if ( string::npos != lineFormat.find("1") )		{ lineWidth=1; }
	if ( string::npos != lineFormat.find("2") )		{ lineWidth=2; }
	if ( string::npos != lineFormat.find("3") )		{ lineWidth=3; }
	if ( string::npos != lineFormat.find("4") )		{ lineWidth=4; }
	if ( string::npos != lineFormat.find("5") )		{ lineWidth=5; }
	if ( string::npos != lineFormat.find("6") )		{ lineWidth=6; }
	if ( string::npos != lineFormat.find("7") )		{ lineWidth=7; }
	if ( string::npos != lineFormat.find("8") )		{ lineWidth=8; }
	if ( string::npos != lineFormat.find("9") )		{ lineWidth=9; }

	theLayer->SetContinuity(isContinuous);

	wxPen  pen( wxColour(lineColor[0],lineColor[1],lineColor[2]), lineWidth, lineStyle );
	theLayer->SetPen(pen);

	if (updateAtTheEnd)
		m_plot->Refresh(false);
}
开发者ID:Aharobot,项目名称:mrpt,代码行数:89,代码来源:CDisplayWindowPlots.cpp


示例15: sscal

 /**
  * C++ version of gsl_blas_sscal().
  * @param alpha A constant
  * @param X A vector
  */
 void sscal( float alpha, vector_float& X ){ gsl_blas_sscal( alpha, X.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:6,代码来源:blas.hpp


示例16: sgemv

    /**
     * C++ version of gsl_blas_sgemv().
     * @param TransA Transpose type
     * @param alpha A constant
     * @param A A matrix
     * @param X A vector
     * @param beta Another constant
     * @param Y A vector
     * @return Error code on failure
     */
    int sgemv( CBLAS_TRANSPOSE_t TransA, float alpha, matrix_float const& A,
	       vector_float const& X, float beta, vector_float& Y ){
      return gsl_blas_sgemv( TransA, alpha, A.get(), X.get(), beta, Y.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:13,代码来源:blas.hpp


示例17: sasum

 /**
  * C++ version of gsl_blas_sasum().
  * @param X A vector
  * @return The absolute sum of the elements
  */
 float sasum( vector_float const& X ){ return gsl_blas_sasum( X.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:6,代码来源:blas.hpp


示例18: ssymv

    /**
     * C++ version of gsl_blas_ssymv().
     * @param Uplo Upper or lower triangular
     * @param alpha A constant
     * @param A A matrix
     * @param X A vector
     * @param beta Another constant
     * @param Y A vector
     * @return Error code on failure
     */
    int ssymv( CBLAS_UPLO_t Uplo, float alpha, matrix_float const& A,
	       vector_float const& X, float beta, vector_float& Y ){
      return gsl_blas_ssymv( Uplo, alpha, A.get(), X.get(), beta, Y.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:13,代码来源:blas.hpp


示例19: isamax

 /**
  * C++ version of gsl_blas_isamax().
  * @param X A vector
  * @return Index of the largest-magnitude element
  */
 CBLAS_INDEX_t isamax( vector_float const& X ){ return gsl_blas_isamax( X.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:6,代码来源:blas.hpp


示例20: ssyr2

    /**
     * C++ version of gsl_blas_ssyr2().
     * @param Uplo Upper or lower triangular
     * @param alpha A constant
     * @param X A vector
     * @param Y A vector
     * @param A A matrix
     * @return Error code on failure
     */
    int ssyr2( CBLAS_UPLO_t Uplo, float alpha, vector_float const& X, vector_float const& Y,
	       matrix_float& A ){ return gsl_blas_ssyr2( Uplo, alpha, X.get(), Y.get(), A.get() ); }
开发者ID:fujiisoup,项目名称:MyLibrary,代码行数:11,代码来源:blas.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ vector_fp类代码示例发布时间:2022-05-31
下一篇:
C++ vector_expression类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap