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


C++ CModel::DeleteAll方法代码示例

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


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

示例1: TableShotgunSearch

void TableShotgunSearch(FILE* out,LPTable dataTable,
					    int ShotgunChainReplicates,double ShotgunCutoffMax,double ShotgunCutoffMin,double ShotgunProbMax, int nconfs)
{
	int i;
	
	if(dataTable->nDimens<=(2+nconfs))
	{
		fprintf(out,"0");
		for(i=1;i<dataTable->Total;i++)
		{
			fprintf(out," 1");
		}
		fprintf(out," 1.0\n");
		return;
	}
	
	int** VarSets = NULL;
	int* lenVarSets = NULL;
	int nVarSets = -1;

	int** DownLinks = NULL;
	int* nDownLinks = NULL;
	int** UpLinks = NULL;
	int* nUpLinks = NULL;
	
	LPTable priorTable = new Table;
	InitPriorTable(priorTable,dataTable,-1);

	InitVarSets(dataTable->nDimens,
	            VarSets,lenVarSets,nVarSets);
	InitLattice(dataTable->nDimens,
				VarSets,lenVarSets,nVarSets,
				DownLinks,nDownLinks, 
				UpLinks,nUpLinks);

	LPTable datapriorTable = new Table;
	if(!datapriorTable->Alloc(dataTable->Dimens,dataTable->nDimens))
	{
		printf("Failed to allocate data+prior table.\n"); exit(1);
	}
	for(i=0;i<datapriorTable->Total;i++)
	{
		datapriorTable->Data[i] = dataTable->Data[i]+priorTable->Data[i];
	}

	//this is where we store all the models we identify
	CModel* models = new CModel;
	models->SetCutoffs(ShotgunCutoffMax,ShotgunCutoffMax);
	
	for(int astartpoint=1;astartpoint<=ShotgunChainReplicates;astartpoint++)
	{
		CModel* localmodels = new CModel;
		localmodels->SetCutoffs(ShotgunCutoffMax,ShotgunCutoffMin);
		
		doRJMCMCstart(models,localmodels,astartpoint,
		              dataTable,priorTable,datapriorTable,
		              VarSets,lenVarSets,nVarSets,
				      DownLinks,nDownLinks,UpLinks,nUpLinks,
					  mystream);
						
		localmodels->DeleteAll();
		delete localmodels; localmodels = NULL;
	}

	//save the best model identified
	models->NormalizeWeights();
	models->SaveBestModel(out);

	//clean memory
	models->DeleteAll();
	delete models; models = NULL;
	datapriorTable->Reset(); delete datapriorTable; datapriorTable = NULL;
	priorTable->Reset(); delete priorTable; priorTable = NULL;
	DeleteLattice(VarSets,lenVarSets,nVarSets,
				  DownLinks,nDownLinks, 
				  UpLinks,nUpLinks);
	DeleteVarSets(VarSets,lenVarSets,nVarSets);			  
	return;
}
开发者ID:,项目名称:,代码行数:79,代码来源:


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