本文整理汇总了C++中intVector::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ intVector::begin方法的具体用法?C++ intVector::begin怎么用?C++ intVector::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类intVector
的用法示例。
在下文中一共展示了intVector::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CBKInfEngine::
Get1_5Clusters(int nnodesPerSlice, intVector& interfNds, intVecVector& clusters,
intVecVector* clusters1_5Sl) const
{
int nInterfNds = interfNds.size();
clusters1_5Sl->assign( clusters.begin(), clusters.end() );
clusters1_5Sl->insert( clusters1_5Sl->end(), clusters.begin(), clusters.end() );
int nClusters = clusters.size();
int i,j;
for( i = 0; i < nClusters; i++ )
{
int nnodesPerClust = clusters[i].size();
for( j = 0; j < nnodesPerClust; j++ )
{
intVector::iterator loc = std::find( interfNds.begin(),
interfNds.end(), clusters[i][j] );
(*clusters1_5Sl)[i][j] = loc - interfNds.begin();
(*clusters1_5Sl)[i + nClusters][j] += nInterfNds;
}
}
}
示例2: ranges
CMlStaticStructLearn::CMlStaticStructLearn(CStaticGraphicalModel *pGrModel,
ELearningTypes LearnType,
EOptimizeTypes AlgorithmType,
EScoreFunTypes ScoreType, int nMaxFanIn,
intVector& vAncestor, intVector& vDescent)
:CStaticLearningEngine(pGrModel, LearnType),
m_pResultBNet(NULL), m_pResultDAG(NULL)
{
int nnodes = pGrModel->GetNumberOfNodes();
m_nNodes = nnodes;
int i;
for (i = 0; i<nnodes; i++) m_vResultRenaming.push_back(i);
m_ScoreType = ScoreType;
m_Algorithm = AlgorithmType;
m_nMaxFanIn = nMaxFanIn;
m_ScoreMethod = MaxLh;
m_priorType = Dirichlet;
m_K2alfa = 0;
m_vAncestor.assign(vAncestor.begin(), vAncestor.end());
m_vDescent.assign(vDescent.begin(),vDescent.end());
PNL_CHECK_RANGES(nMaxFanIn, 1, nnodes);
intVector ranges(nMaxFanIn);
for(i=0; i<nMaxFanIn; i++) ranges[i] = nnodes+1;
float max = 0.0f;
m_pNodeScoreCache = (CSparseMatrix<float>**)malloc(nnodes * sizeof(CSparseMatrix<float>*));
for(i=0; i<nnodes; i++)
{
m_pNodeScoreCache[i] = CSparseMatrix<float>::Create(nMaxFanIn,
&ranges.front(), max, 0);
}
}
示例3: intVector
CFactor::CFactor( EDistributionType dt,
EFactorType pt,
const int *domain, int nNodes, CModelDomain* pMD,
const intVector& obsIndices )
: m_Domain( domain, domain + nNodes )
{
/*fill enum fields:*/
m_DistributionType = dt;
m_FactorType = pt;
m_pMD = pMD;
m_factNumInHeap = m_pMD->AttachFactor(this);
int i;
pConstNodeTypeVector nt;
intVector dom = intVector( domain, domain+nNodes );
pMD->GetVariableTypes( dom, &nt );
m_obsPositions.assign( obsIndices.begin(), obsIndices.end() );
int numObsNodesHere = obsIndices.size();
switch (dt)
{
case dtScalar:
{
if( pt == ftCPD )
{
PNL_THROW( CInvalidOperation, "scalar is only potential - to multiply" );
}
//if there are observed nodes - get corresponding node types
if( numObsNodesHere )
{
if ( numObsNodesHere != nNodes )
{
PNL_THROW( CInconsistentType,
"all nodes in scalar distribution must be observed" )
}
//need to find observed nodes in domain and check including their changed types
for( i = 0; i < numObsNodesHere; i++ )
{
nt[obsIndices[i]] = nt[obsIndices[i]]->IsDiscrete() ? pMD->GetObsTabVarType():
pMD->GetObsGauVarType();
}
}
m_CorrespDistribFun = CScalarDistribFun::Create(nNodes, &nt.front());
break;
}
case dtTree:
{
if( pt != ftCPD )
{
PNL_THROW( CInvalidOperation, "Tree is only CPD" );
}
m_CorrespDistribFun = CTreeDistribFun::Create(nNodes, &nt.front());
break;
}
case dtTabular:
{
if(( pt == ftPotential )&&( numObsNodesHere ))
{
//need to find observed nodes in domain and check including their changed types
for( i = 0; i < numObsNodesHere; i++ )
{
//change node type for this node
nt[obsIndices[i]] = nt[obsIndices[i]]->IsDiscrete() ? pMD->GetObsTabVarType():
pMD->GetObsGauVarType();
}
}
//check all node types corresponds Tabular distribution
for( i = 0; i < nNodes; i++ )
{
if((!(( nt[i]->IsDiscrete() )||
( !nt[i]->IsDiscrete()&&(nt[i]->GetNodeSize() == 0)))))
{
PNL_THROW( CInconsistentType,
"node types must corresponds Tabular type" );
}
}
m_CorrespDistribFun = CTabularDistribFun::Create( nNodes,
&nt.front(), NULL );
break;
}
case dtGaussian:
{
switch (pt)
{
case ftPotential:
{
//need to find observed nodes in domain and check including their changed types
for( i = 0; i < numObsNodesHere; i++ )
{
//change node type for this node
nt[obsIndices[i]] = nt[obsIndices[i]]->IsDiscrete() ?
pMD->GetObsTabVarType():pMD->GetObsGauVarType();
}
for( i = 0; i < nNodes; i++ )
{
if( nt[i]->IsDiscrete() && (nt[i]->GetNodeSize() != 1))
{
PNL_THROW( CInvalidOperation,
"Gaussian potential must be of Gaussian nodes only" )
}
}
//.........这里部分代码省略.........