本文整理汇总了C++中intVector类的典型用法代码示例。如果您正苦于以下问题:C++ intVector类的具体用法?C++ intVector怎么用?C++ intVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了intVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Get1_5Clusters
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;
}
}
}
开发者ID:Kanwaldeep,项目名称:OpenPNL,代码行数:28,代码来源:pnlBKInferenceEngine.cpp
示例2: GetObsDimsWithVls
void CSamplingInfEngine::
GetObsDimsWithVls(intVector &domain, int nonObsNode, const CEvidence* pEv,
intVector *dims, intVector *vls) const
{
int nnodes = domain.size();
dims->resize(nnodes - 1);
vls->resize(nnodes - 1);
int* it = &domain.front();
int* itDims = &dims->front();
int* itVls = &vls->front();
int i;
for( i = 0; i < nnodes; i++, it++ )
{
if( *it != nonObsNode )
{
*itDims = i;
*itVls = pEv->GetValueBySerialNumber(*it)->GetInt();//only if all nds are tabular!!
itDims++;
itVls++;
}
}
}
开发者ID:lspatial,项目名称:spstatics_parallel,代码行数:25,代码来源:pnlSamplingInferenceEngine.cpp
示例3: CheckClustersValidity
bool CBKInfEngine::
CheckClustersValidity( intVecVector& clusters, intVector& interfNds )
{
if( clusters.empty() )
{
return false;
}
intVector::iterator interfNdsLit = interfNds.begin();
intVector::iterator interfNdsRit = interfNds.end();
int i;
for( i = 0; i < clusters.size(); i++ )
{
if( clusters[i].empty() )
{
return false;
}
else
{
int j;
for( j = 0; j < clusters[i].size(); j++ )
{
if( std::find(interfNdsLit, interfNdsRit, clusters[i][j]) == interfNdsRit )
{
return false;
}
}
}
}
return true;
}
开发者ID:Kanwaldeep,项目名称:OpenPNL,代码行数:33,代码来源:pnlBKInferenceEngine.cpp
示例4: m_pResultBNet
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);
}
}
开发者ID:PyOpenPNL,项目名称:OpenPNL,代码行数:32,代码来源:pnlMlStaticStructLearn.cpp
示例5: eliminateSpecificSurface
// enforce epicardium properties on boundary nodes (boundary between
// epicardium and endocardium mesh)
void AnisotropyGenerator::eliminateSpecificSurface(InputFileData* InputData,
AnisotropyCondition& condition,
intVector& surfElems,
int surfID,
std::ofstream& logFile) {
using namespace std;
vector<ConditionParticle>& ptcls = condition.getParticles();
vector<ConditionElement>& elems = condition.getElements();
bool notSame = false;
for(int j = 1;j < surfElems.size();j++) {
if(elems[surfElems[j - 1]].getSurfaceID()
!= elems[surfElems[j]].getSurfaceID()) {
notSame = true;
}
}
if(notSame == true) {
intVector dummyVec;
for(int k = 0;k < surfElems.size();k++) {
if(elems[surfElems[k]].getSurfaceID() == surfID) {
dummyVec.push_back(surfElems[k]);
}
}
surfElems = dummyVec;
}
}
开发者ID:3rguy,项目名称:Orion,代码行数:34,代码来源:AnisotropyGenerator.C
示例6:
/**********************************************************************************
* AUTHOR : Naveen Sundar G.
* DATE : 10-AUGUST-2007
* NAME : toIntVector
* DESCRIPTION : This method converts the feature instance to an intVector.
* ARGUMENTS : The integer vector passed by reference
* RETURNS : 0 on success.
* NOTES :
* CHANGE HISTROY
* Author Date Description of change
*************************************************************************************/
int L7ShapeFeature::toIntVector(intVector& intVec)
{
intVec.push_back(m_x);
intVec.push_back(m_y);
intVec.push_back(m_xFirstDerv);
intVec.push_back(m_yFirstDerv);
intVec.push_back(m_xSecondDerv);
intVec.push_back(m_ySecondDerv);
intVec.push_back(m_curvature);
intVec.push_back(m_penUp);
return SUCCESS;
}
开发者ID:amitdo,项目名称:Lipitk,代码行数:24,代码来源:L7ShapeFeature.cpp
示例7: CreateTabularPotential
void CMNet::CreateTabularPotential( const intVector& domain,
const floatVector& data )
{
AllocFactor( domain.size(), &domain.front() );
pFactorVector factors;
int numFactors = GetFactors( domain.size(), &domain.front(), &factors );
if( numFactors != 1 )
{
PNL_THROW( CInconsistentSize,
"domain must be the same as corresponding domain size got from graph" );
}
factors[0]->AllocMatrix( &data.front(), matTable );
}
开发者ID:lspatial,项目名称:spstatics_parallel,代码行数:14,代码来源:pnlMNet.cpp
示例8: BuildCurrentEvidenceMatrix
//-------------------------------------------------------------------------------
void CSoftMaxCPD::BuildCurrentEvidenceMatrix(float ***full_evid, float ***evid,intVector family,int numEv)
{
int i, j;
*evid = new float* [family.size()];
for (i = 0; i < family.size(); i++)
{
(*evid)[i] = new float [numEv];
}
for (i = 0; i < numEv; i++)
{
for (j = 0; j < family.size(); j++)
{
(*evid)[j][i] = (*full_evid)[family[j]][i];
}
}
}
开发者ID:lspatial,项目名称:spstatics_parallel,代码行数:18,代码来源:pnlSoftMaxCPD.cpp
示例9:
bool
DatabaseCorrelation::GetCorrelatedTimeStates(int state, intVector &states) const
{
bool retval = false;
if(state >= 0 && state < numStates)
{
states.clear();
int index = state;
for(size_t i = 0; i < databaseNames.size(); ++i)
{
states.push_back(indices[index]);
index += numStates;
}
retval = true;
}
return retval;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:19,代码来源:DatabaseCorrelation.C
示例10:
void
Dyna3DFile::GetMaterials(intVector &matnos, stringVector &matnames, doubleVector &matdens)
{
for(int i = 0; i < materialCards.size(); ++i)
{
matnos.push_back(materialCards[i].materialNumber);
matnames.push_back(materialCards[i].materialName);
matdens.push_back(materialCards[i].density);
}
}
开发者ID:EricAlex,项目名称:ThirdParty-dev,代码行数:10,代码来源:Dyna3DFile.cpp
示例11: AllocDistribution
void CGaussianCPD::AllocDistribution( const floatVector& mean,
const floatVector& cov, float normCoeff,
const floatVecVector& weights,
const intVector& parentCombination )
{
if( weights.size() )
{
pnlVector<const float*> pWeights;
int numWeights = weights.size();
pWeights.resize( numWeights );
for( int i = 0; i < numWeights; i++ )
{
pWeights[i] = &weights[i].front();
}
AllocDistribution( &mean.front(), &cov.front(), normCoeff,
&pWeights.front(), &parentCombination.front() );
}
else
{
AllocDistribution( &mean.front(), &cov.front(), normCoeff, NULL,
&parentCombination.front() );
}
}
开发者ID:lspatial,项目名称:spstatics_parallel,代码行数:23,代码来源:pnlGaussianCPD.cpp
示例12: SM_ComputeDistribution
// compute the distribution of correspondence statuses in this order:
// connected, paused, observed, expected, blacklisted, alternate, silent
void SM_ComputeDistribution( intVector &dist )
{
// reset the distribution
dist.clear();
for (int i=0; i<3; i++)
dist.push_back( 0 );
// populate the distribution
for ( corresVector::iterator iter = cq.begin(); iter != cq.end(); iter++ ) {
switch ( iter->status() ) {
case _CONNECTED:
dist[0]++;
break;
case _EXPECTED:
dist[1]++;
break;
case _BLACKLISTED:
dist[2]++;
break;
default:
assert( false );
}
}
}
开发者ID:oakfr,项目名称:omni3d,代码行数:26,代码来源:state.cpp
示例13: AttributeSubject
avtSpeciesMetaData::avtSpeciesMetaData(const std::string &n,
const std::string &meshn, const std::string &matn,
int nummat, const intVector &ns, const std::vector<stringVector> &sn)
: AttributeSubject(avtSpeciesMetaData::TypeMapFormatString)
{
// Initialize all.
*this = avtSpeciesMetaData();
// Override members
name = n;
originalName = name;
meshName = meshn;
materialName = matn;
numMaterials = nummat;
ClearSpecies();
for (size_t i=0; i<ns.size(); i++)
AddSpecies(avtMatSpeciesMetaData(ns[i], sn[i]));
validVariable = true;
}
开发者ID:OSCCAR-PFM,项目名称:OSCCAR-dev,代码行数:20,代码来源:avtSpeciesMetaData.C
示例14: PNL_CHECK_RANGES
float CMlStaticStructLearn::ScoreFamily(intVector vFamily)
{
int nParents = vFamily.size() - 1;
PNL_CHECK_RANGES(nParents, 0, m_nMaxFanIn);
intVector indexes(m_nMaxFanIn,0);
int i;
for(i=0; i<nParents; i++)
{
indexes[i] = vFamily[i]+1;
}
int node = vFamily[nParents];
float score;
float defval = m_pNodeScoreCache[node]->GetDefaultValue();
score = m_pNodeScoreCache[node]->GetElementByIndexes(&indexes.front());
if(score == defval)
{
score = ComputeFamilyScore(vFamily);
m_pNodeScoreCache[node]->SetElementByIndexes(score, &indexes.front());
}
return score;
}
开发者ID:PyOpenPNL,项目名称:OpenPNL,代码行数:21,代码来源:pnlMlStaticStructLearn.cpp
示例15: MarginalNodes
void CGibbsSamplingInfEngine::
MarginalNodes( const intVector& queryNdsIn, int notExpandJPD )
{
MarginalNodes( &queryNdsIn.front(), queryNdsIn.size(), notExpandJPD );
}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:5,代码来源:pnlGibbsSamplingInferenceEngine.cpp
示例16: MarginalNodes
void CExInfEngine< INF_ENGINE, MODEL, FLAV, FALLBACK_ENGINE1, FALLBACK_ENGINE2 >::MarginalNodes( intVector const &queryNds, int notExpandJPD )
{
MarginalNodes(&queryNds.front(), queryNds.size(), notExpandJPD );
}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:4,代码来源:pnlExInferenceEngine.hpp
示例17: m_Domain
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" )
}
}
//.........这里部分代码省略.........
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:101,代码来源:pnlFactor.cpp
示例18: SetCoefficientVec
void CGaussianCPD::SetCoefficientVec( float coeff,
const intVector& parentCombination )
{
SetCoefficient( coeff, &parentCombination.front() );
}
开发者ID:lspatial,项目名称:spstatics_parallel,代码行数:5,代码来源:pnlGaussianCPD.cpp
示例19: AllocFactor
void CGraphicalModel::AllocFactor( const intVector& domainIn)
{
AllocFactor( domainIn.size(), &domainIn.front() );
};
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:4,代码来源:pnlGraphicalModel.cpp
示例20: switch
float CMlStaticStructLearn::ComputeFamilyScore(intVector vFamily)
{
int nFamily = vFamily.size();
CCPD* iCPD = this->CreateRandomCPD(nFamily, &vFamily.front(), m_pGrModel);
CTabularDistribFun *pDistribFun;
int ncases = m_Vector_pEvidences.size();
const CEvidence * pEv;
float score;
float pred = 0;
EDistributionType NodeType;
switch (m_ScoreMethod)
{
case MaxLh :
if ( !((iCPD->GetDistribFun()->GetDistributionType() == dtSoftMax)
|| (iCPD->GetDistribFun()->GetDistributionType() == dtCondSoftMax)))
{
iCPD->UpdateStatisticsML( &m_Vector_pEvidences.front(), ncases );
score = iCPD->ProcessingStatisticalData(ncases);
}
else
{
float **evid = NULL;
float **full_evid = NULL;
BuildFullEvidenceMatrix(&full_evid);
CSoftMaxCPD* SoftMaxFactor = static_cast<CSoftMaxCPD*>(iCPD);
SoftMaxFactor->BuildCurrentEvidenceMatrix(&full_evid, &evid,
vFamily,m_Vector_pEvidences.size());
SoftMaxFactor->InitLearnData();
SoftMaxFactor->SetMaximizingMethod(mmGradient);
SoftMaxFactor->MaximumLikelihood(evid, m_Vector_pEvidences.size(),
0.00001f, 0.01f);
SoftMaxFactor->CopyLearnDataToDistrib();
if (SoftMaxFactor->GetDistribFun()->GetDistributionType() == dtSoftMax)
{
score = ((CSoftMaxDistribFun*)SoftMaxFactor->GetDistribFun())->CalculateLikelihood(evid,ncases);
}
else
{
score = ((CCondSoftMaxDistribFun*)SoftMaxFactor->GetDistribFun())->CalculateLikelihood(evid,ncases);
};
for (int k = 0; k < SoftMaxFactor->GetDomainSize(); k++)
{
delete [] evid[k];
}
delete [] evid;
int i;
intVector obsNodes;
(m_Vector_pEvidences[0])->GetAllObsNodes(&obsNodes);
for (i=0; i<obsNodes.size(); i++)
{
delete [] full_evid[i];
}
delete [] full_evid;
};
break;
case PreAs :
int i;
NodeType = iCPD->GetDistributionType();
switch (NodeType)
{
case dtTabular :
for(i = 0; i < ncases; i++)
{
pConstEvidenceVector tempEv(0);
tempEv.push_back(m_Vector_pEvidences[i]);
iCPD->UpdateStatisticsML(&tempEv.front(), tempEv.size());
iCPD->ProcessingStatisticalData(tempEv.size());
pred += log(((CTabularCPD*)iCPD)->GetMatrixValue(m_Vector_pEvidences[i]));
}
break;
case dtGaussian :
for(i = 0; i < ncases; i += 1 )
{
pConstEvidenceVector tempEv(0);
tempEv.push_back(m_Vector_pEvidences[i]);
iCPD->UpdateStatisticsML(&tempEv.front(), tempEv.size());
float tmp = 0;
if (i != 0)
{
tmp =iCPD->ProcessingStatisticalData(1);
pred +=tmp;
}
}
break;
case dtSoftMax:
PNL_THROW(CNotImplemented,
"This type score method has not been implemented yet");
break;
default:
PNL_THROW(CNotImplemented,
"This type score method has not been implemented yet");
break;
};
//.........这里部分代码省略.........
开发者ID:PyOpenPNL,项目名称:OpenPNL,代码行数:101,代码来源:pnlMlStaticStructLearn.cpp
注:本文中的intVector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论