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


C++ ColumnVector::size方法代码示例

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


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

示例1: getArea

//---------------------------------------------------------------------------
double TEstimation::getArea(ColumnVector densities, ColumnVector theta){
   double area=0;
   for(int i=1; i<densities.size();++i){
	  area+=(theta(i+1)-theta(i))*(densities(i+1)+densities(i))/2;
   }
   return area;
}
开发者ID:sakeel,项目名称:ABCtoolbox,代码行数:8,代码来源:TEstimation.cpp

示例2: constant_vector

 void constant_vector(
     T1 x, const ColumnVector<T2> & y,
     const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y,
     ColumnInt64::Container & result)
 {
     const auto & y_data = y.getData();
     for (size_t i = 0, size = y.size(); i < size; ++i)
         result[i] = calculate<Transform>(x, y_data[i], timezone_x, timezone_y);
 }
开发者ID:filimonov,项目名称:ClickHouse,代码行数:9,代码来源:dateDiff.cpp

示例3: vector_constant

 void vector_constant(
     const ColumnVector<T1> & x, T2 y,
     const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y,
     ColumnInt64::Container & result)
 {
     const auto & x_data = x.getData();
     for (size_t i = 0, size = x.size(); i < size; ++i)
         result[i] = calculate<Transform>(x_data[i], y, timezone_x, timezone_y);
 }
开发者ID:filimonov,项目名称:ClickHouse,代码行数:9,代码来源:dateDiff.cpp

示例4: save_column_vector

 void ExplicitSystemManager::save_column_vector(const ColumnVector &vec, std::string filename) {
     std::ofstream out_file(filename);
     if (out_file.is_open()) {
         for (int i = 0; i < vec.size(); ++i) {
             out_file << std::setprecision(15) << vec[i] << "\n";
         }
         out_file.close();
     }
     else {
         throw std::runtime_error((boost::format("Unable to open %s.") % filename).str());
     }
 }
开发者ID:latture,项目名称:explicit-beam-fea,代码行数:12,代码来源:explicit_system_manager.cpp

示例5: loadHuber

void LoadDNSSCD::loadHuber(ITableWorkspace_sptr tws) {
  ColumnVector<double> huber = tws->getVector("Huber(degrees)");
  // set huber[0] for each run in m_data
  for (auto &ds : m_data) {
    ds.huber = huber[0];
  }
  // dublicate runs for each huber in the table
  std::vector<ExpData> old(m_data);
  for (size_t i = 1; i < huber.size(); ++i) {
    for (auto &ds : old) {
      ds.huber = huber[i];
      m_data.push_back(ds);
    }
  }
}
开发者ID:stuartcampbell,项目名称:mantid,代码行数:15,代码来源:LoadDNSSCD.cpp

示例6: optppConstraint

//constraint, gradient approximated with central difference
//opt++ has bug in approximating gradient with finite difference, so I compute it myself
void optppConstraint(int mode, int n, const ColumnVector &x, ColumnVector &c_x, Matrix &c_grad_x, int &result)
{
    //constraint: A^T*A=I,B^T*B=I ==> A^T*A-I=0,B^T*B-I=0
    //Note: A^T*A and B^T*B are both symmetric matrices, inactive constraints need to be removed
    //      otherwise it leads to singular jacobian of optimization system
    int col=CoupledQuasiHarmonics::static_col;
    int new_col=n/(2*col);
    if(CoupledQuasiHarmonics::static_objective_type==CoupledQuasiHarmonics::ONLY_A)
	new_col=n/col;
    //function evaluation
    if(mode&NLPFunction)
    {
	int idx_1d=1;
	for(int i=1;i<=new_col;++i)
	    for(int j=1;j<=i;++j)
	    {
		c_x(idx_1d)=0;
		for(int k=1;k<=col;++k)
		    c_x(idx_1d)+=x((i-1)*col+k)*x((j-1)*col+k);
		if(i==j)
		    c_x(idx_1d)-=1.0;
		++idx_1d;
	    }
	if(CoupledQuasiHarmonics::static_objective_type==CoupledQuasiHarmonics::A_AND_B)
	{
	    int bias=new_col*col;
	    for(int i=1;i<=new_col;++i)
		for(int j=1;j<=i;++j)
		{
		    c_x(idx_1d)=0;
		    for(int k=1;k<=col;++k)
			c_x(idx_1d)+=x((i-1)*col+k+bias)*x((j-1)*col+k+bias);
		    if(i==j)
			c_x(idx_1d)-=1.0;
		    ++idx_1d;
		}
	}
	result=NLPFunction;
    }
    //gradient evaluation
    if(mode&NLPGradient)
    {
	ColumnVector temp_x=x;
	ColumnVector fplus(c_x.size()),fminus(c_x.size());
	Matrix c_grad_x_t(c_x.size(),n);
	Matrix temp_grad(n,c_x.size());
	int temp_result;
	double perturb=1.0e-8;
	for(int i=1;i<=n;++i)
	{
	    temp_x(i)+=perturb;
	    optppConstraint(NLPFunction,n,temp_x,fplus,temp_grad,temp_result);
	    temp_x(i)-=2*perturb;
	    optppConstraint(NLPFunction,n,temp_x,fminus,temp_grad,temp_result);
	    c_grad_x_t.Column(i)=(fplus-fminus)/(2*perturb);
	    temp_x(i)=x(i);
	}
	c_grad_x=c_grad_x_t.t();
	result=NLPGradient;
    }
}
开发者ID:FeiZhu,项目名称:RealTimeExampleBasedLBDeformer,代码行数:63,代码来源:coupled_quasi_harmonics.cpp


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