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


C++ ParameterList::GetNDouble方法代码示例

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


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

示例1: Append

void ParameterList::Append(const ParameterList& addList)
{
	for(int i=0; i<addList.GetNBool(); i++ )
		AddParameter(addList.GetBoolParameter(i));
	for(int i=0; i<addList.GetNInteger(); i++ )
		AddParameter(addList.GetIntegerParameter(i));
	for(int i=0; i<addList.GetNDouble(); i++ )
		AddParameter(addList.GetDoubleParameter(i));
	for(int i=0; i<addList.GetNComplex(); i++ )
		AddParameter(addList.GetComplexParameter(i));
	for(int i=0; i<addList.GetNMultiDouble(); i++ )
		AddParameter(addList.GetMultiDouble(i));
	for(int i=0; i<addList.GetNMultiComplex(); i++ )
		AddParameter(addList.GetMultiComplex(i));
	for(int i=0; i<addList.GetNMultiUnsignedInteger(); i++ )
		AddParameter(addList.GetMultiUnsignedInteger(i));
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例2: DeepCopy

void ParameterList::DeepCopy(const ParameterList& in)
{
	out_=in.out_;
	vMultiComplex_.clear();
	vMultiDouble_.clear();
	vDouble_.clear();
	vInt_.clear();
	vBool_.clear();
	for(unsigned int i=0; i<in.GetNMultiComplex();i++)
		vMultiComplex_.push_back(
				std::shared_ptr<MultiComplex>(
						new MultiComplex(*(in.vMultiComplex_[i]))
				)
		);
	for(unsigned int i=0; i<in.GetNMultiDouble();i++)
		vMultiDouble_.push_back(
				std::shared_ptr<MultiDouble>(
						new MultiDouble(*(in.vMultiDouble_[i]))
				)
		);
	for(unsigned int i=0; i<in.GetNDouble();i++)
		vDouble_.push_back(
				std::shared_ptr<DoubleParameter>(
						new DoubleParameter(*(in.vDouble_[i]))
				)
		);
	for (unsigned int i = 0; i < in.GetNMultiUnsignedInteger(); i++)
		vMultiUnsignedInteger_.push_back(
				std::shared_ptr<MultiUnsignedInteger>(
						new MultiUnsignedInteger(*(in.vMultiUnsignedInteger_[i]))
				)
		);
	for(unsigned int i=0; i<in.GetNInteger();i++)
		vInt_.push_back(
				std::shared_ptr<IntegerParameter>(
						new IntegerParameter(*(in.vInt_[i]))
				)
		);
	for(unsigned int i=0; i<in.GetNBool();i++)
		vBool_.push_back(
				std::shared_ptr<BoolParameter>(
						new BoolParameter(*(in.vBool_[i]))
				)
		);
}
开发者ID:,项目名称:,代码行数:45,代码来源:

示例3: initialParList

std::shared_ptr<FitResult> GenevaIF::exec(ParameterList& par) {
	std::shared_ptr<GenevaResult> result(new GenevaResult());
	ParameterList initialParList(par);

	Go2 go( (configFileDir+"Go2.json"));

	// Initialize a client, if requested
    if(go.clientMode()) {
	  std::cout << "Geneva Client waiting for action!" << std::endl;
	  go.clientRun();
	  return result;
	}

	boost::shared_ptr<GStartIndividual> p( new GStartIndividual(_myData, par) );
	go.push_back(p);

	// Add an evolutionary algorithm to the Go2 class.
	GEvolutionaryAlgorithmFactory ea((configFileDir+"GEvolutionaryAlgorithm.json"), parallelizationMode);
	go & ea();

	// Perform the actual optimization
	boost::shared_ptr<GStartIndividual>
		bestIndividual_ptr = go.optimize<GStartIndividual>();

	// Terminate
	bestIndividual_ptr->getPar(par);
	result->setResult(bestIndividual_ptr);
	result->SetAmplitude(_myData->getAmplitudes().at(0));
	result->setInitialParameters(initialParList);
	result->setFinalParameters(par);
	//int whattodowiththisidontknow =  go.finalize(); //Go2::finalize();

        //write Parameters back
	ParameterList resultPar;
	bestIndividual_ptr->getPar(resultPar);
	for(unsigned int i=0; i<par.GetNDouble(); i++){  //TODO: better way, no cast or check type
	  if(!par.GetDoubleParameter(i)->IsFixed())
	    par.GetDoubleParameter(i)->SetValue(resultPar.GetDoubleParameter(i)->GetValue());
	}

	return result;
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例4: main


//.........这里部分代码省略.........
	//    std::shared_ptr<MultiComplex> ampChild = std::dynamic_pointer_cast<MultiComplex>( AmpNode->getValue() );
	//
	//    BOOST_LOG_TRIVIAL(debug) << "InvMasses first Evt from dataPoint: \t" << myPoint.getVal("m23sq") << " \t " << myPoint.getVal("m13sq");
	//    BOOST_LOG_TRIVIAL(debug) << "InvMasses first Evt from allMasses: \t" << (myEvtMasses.masses_sq[std::make_pair(2,3)])[0] << " \t " << (myEvtMasses.masses_sq[std::make_pair(1,3)])[0];
	//
	//    BOOST_LOG_TRIVIAL(debug) << "First BW first Evt classical: \t" <<  (amps->getFirstBW(myPoint,par));
	//    BOOST_LOG_TRIVIAL(debug) << "First BW first Evt from tree: \t" << (bwChild->GetValue()*adChild->GetValue());
	//
	//    BOOST_LOG_TRIVIAL(debug) << "FirstReso first Evt classical: \t" <<  amps->getFirstReso(myPoint,par);
	//    BOOST_LOG_TRIVIAL(debug) << "FirstReso first Evt from tree: \t" << resoChild->GetValue();
	//
	//    BOOST_LOG_TRIVIAL(debug) << "First Amp first Evt classical: \t" <<  amps->getFirstAmp(myPoint,par);
	//    BOOST_LOG_TRIVIAL(debug) << "First Amp first Evt from tree: \t" << ampChild->GetValue();
	//
	//    BOOST_LOG_TRIVIAL(debug) << "Intensity of first data event classical: \t" << amps->intensity(myPoint,par).GetParameterValue(0);
	//    BOOST_LOG_TRIVIAL(debug) << "Intensity of first data event from tree: \t" << intensChild->GetValue();
	//    BOOST_LOG_TRIVIAL(debug)<<"Finish consistency checks"<<std::endl;
	//  }

	//std::shared_ptr<ControlParameter> esti = MinLogLH::createInstance(amps, myReader, myPHSPReader);
	//std::shared_ptr<Estimator> esti(new MinLogLH(amps, myReader, myPHSPReader));
	std::shared_ptr<Optimizer::Optimizer> opti(new Optimizer::Minuit2::MinuitIF(esti, par));

	ParameterList test;
	/*if(useFctTree)
	 if(!amps->functionTree(test))
	 return 1;*/

	//return 0;
	BOOST_LOG_TRIVIAL(info)<< "LH with optimal parameters: " << esti->controlParameter(par);
	if (useFctTree)
		BOOST_LOG_TRIVIAL(info)<<tree;
		//exit(1);
	double startInt[par.GetNDouble()], optiInt[par.GetNDouble()];
	for (unsigned int i = 0; i < par.GetNDouble(); i++) {
		std::shared_ptr<DoubleParameter> tmp = par.GetDoubleParameter(i);
		optiInt[i] = tmp->GetValue();
		//if (/*i < 2 ||*/ i > 10 /*|| i%4==2 || i%4==3 */) { //omega's and f0 fixed
			//if(i<2 || i>3 || i%2==1){ //omega's and f0 fixed
		//	tmp->FixParameter(true);
		//} else {
		//	tmp->FixParameter(true); if(i==5) tmp->FixParameter(false);
		//	BOOST_LOG_TRIVIAL(debug)<< *tmp;
			//tmp->SetValue(tmp->GetValue()+0.5);			///((i+1)));
		//	tmp->SetError(tmp->GetValue());
		//	if (!tmp->GetValue())
		//		tmp->SetError(1.);
		//}
		startInt[i] = tmp->GetValue();
	}

	BOOST_LOG_TRIVIAL(info)<< "LH with following parameters: " << esti->controlParameter(par);
	for (unsigned int i = 0; i < par.GetNDouble(); i++) {
		BOOST_LOG_TRIVIAL(info)<< par.GetDoubleParameter(i)->GetName() << " = " << par.GetDoubleParameter(i)->GetValue();
	}

	// std::cout << "Fixing 5 of 7 parameters " << std::endl;
	//for(unsigned int i=2; i<par.GetNDouble(); i++){
	//    par.GetDoubleParameter(i).FixParameter(true);
	//  }

	BOOST_LOG_TRIVIAL(info)<< "Start Fit";
	std::shared_ptr<FitResult> genResult = opti->exec(par);
	BOOST_LOG_TRIVIAL(info)<< "Final LH = " << genResult->getResult();

	BOOST_LOG_TRIVIAL(info)<< "Optimierte intensitäten: " << esti->controlParameter(par);
开发者ID:,项目名称:,代码行数:67,代码来源:


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