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


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

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


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

示例1: 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

示例2: 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

示例3:

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

示例4:

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

示例5: 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

示例6: 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

示例7: ScoreFamily

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

示例8: RenderSetup

avtDataObject_p
IceTNetworkManager::Render(
    bool checkThreshold, intVector networkIds,
    bool getZBuffer, int annotMode, int windowID,
    bool leftEye)
{
    int t0 = visitTimer->StartTimer();
    DataNetwork *origWorkingNet = workingNet;
    avtDataObject_p retval;

    EngineVisWinInfo &viswinInfo = viswinMap[windowID];
    viswinInfo.markedForDeletion = false;
    VisWindow *viswin = viswinInfo.viswin;
    std::vector<avtPlot_p>& imageBasedPlots = viswinInfo.imageBasedPlots;

    renderings = 0;

    TRY
    {
        this->StartTimer();

        RenderSetup(windowID, networkIds, getZBuffer,
            annotMode, leftEye, checkThreshold);

        bool plotDoingTransparencyOutsideTransparencyActor = false;
        for(size_t i = 0 ; i < networkIds.size() ; i++)
        {
            workingNet = NULL;
            UseNetwork(networkIds[i]);
            if(this->workingNet->GetPlot()->ManagesOwnTransparency())
            {
                plotDoingTransparencyOutsideTransparencyActor = true;
            }
        }
        workingNet = NULL;

        // We can't easily figure out a compositing order, which IceT requires
        // in order to properly composite transparent geometry.  Thus if there
        // is some transparency, fallback to our parent implementation.
        avtTransparencyActor* trans = viswin->GetTransparencyActor();
        bool transparenciesExist = trans->TransparenciesExist()
                           ||  plotDoingTransparencyOutsideTransparencyActor;
        if (transparenciesExist)
        {
            debug2 << "Encountered transparency: falling back to old "
                      "SR / compositing routines." << std::endl;

            retval = NetworkManager::RenderInternal();
        }
        else
        {
            bool needZB = !imageBasedPlots.empty() ||
                          renderState.shadowMap  ||
                          renderState.depthCues;

            // Confusingly, we need to set the input to be *opposite* of what VisIt
            // wants.  This is due to (IMHO) poor naming in the IceT case; on the
            // input side:
            //     ICET_DEPTH_BUFFER_BIT set:     do Z-testing
            //     ICET_DEPTH_BUFFER_BIT not set: do Z-based compositing.
            // On the output side:
            //     ICET_DEPTH_BUFFER_BIT set:     readback of Z buffer is allowed
            //     ICET_DEPTH_BUFFER_BIT not set: readback of Z does not work.
            // In VisIt's case, we calculated a `need Z buffer' predicate based
            // around the idea that we need the Z buffer to do Z-compositing.
            // However, IceT \emph{always} needs the Z buffer internally -- the
            // flag only differentiates between `compositing' methodologies
            // (painter-style or `over' operator) on input.
            GLenum inputs = ICET_COLOR_BUFFER_BIT;
            GLenum outputs = ICET_COLOR_BUFFER_BIT;
            // Scratch all that, I guess.  That might be the correct way to go
            // about things in the long run, but IceT only gives us back half an
            // image if we don't set the depth buffer bit.  The compositing is a
            // bit wrong, but there's not much else we can do..
            // Consider removing the `hack' if a workaround is found.
            if (/*hack*/true/*hack*/) // || !this->MemoMultipass(viswin))
            {
                inputs |= ICET_DEPTH_BUFFER_BIT;
            }
            if(needZB)
            {
                outputs |= ICET_DEPTH_BUFFER_BIT;
            }
            ICET(icetInputOutputBuffers(inputs, outputs));

            // If there is a backdrop image, we need to tell IceT so that it can
            // composite correctly.
            if(viswin->GetBackgroundMode() != AnnotationAttributes::Solid)
            {
                ICET(icetEnable(ICET_CORRECT_COLORED_BACKGROUND));
            }
            else
            {
                ICET(icetDisable(ICET_CORRECT_COLORED_BACKGROUND));
            }

            if (renderState.renderOnViewer)
            {
                RenderCleanup();
                avtDataObject_p dobj = NULL;
//.........这里部分代码省略.........
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:101,代码来源:IceTNetworkManager.C

示例9: MarginalNodes

void CGibbsSamplingInfEngine::
MarginalNodes( const intVector& queryNdsIn, int notExpandJPD  )
{
  MarginalNodes( &queryNdsIn.front(), queryNdsIn.size(), notExpandJPD );
}
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:5,代码来源:pnlGibbsSamplingInferenceEngine.cpp

示例10: 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

示例11: 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" )
                        }
                    }
//.........这里部分代码省略.........
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:101,代码来源:pnlFactor.cpp

示例12: ComputeFamilyScore

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

示例13: GetFactors

int CGraphicalModel::GetFactors( const intVector& subdomainIn,
		                    pFactorVector *paramsOut ) const
{
	return GetFactors( subdomainIn.size(), &subdomainIn.front(),
		paramsOut );
};
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:6,代码来源:pnlGraphicalModel.cpp

示例14: AllocFactor

void CGraphicalModel::AllocFactor( const intVector& domainIn)
{
	AllocFactor( domainIn.size(), &domainIn.front() );
};
开发者ID:JacobCWard,项目名称:PyPNL,代码行数:4,代码来源:pnlGraphicalModel.cpp

示例15: MLSUnitTest_meshMultiDim

//! Coordinate generator
//! Points are defined along the columns of coords and their dimensional
//! coordinates along the rows
void Interpolation::MLSUnitTest_meshMultiDim(double& length, double& nodal_dist,
		int& ndim, dbMatrix& coords, int& numCoords, intVector SBM_dim,
		dbVector SBM_coeff, ofstream& logFile) {

	// Define the coordinate list in a specific dimension
	dbVector coordList;
	for (int i = 0; (i) * nodal_dist <= length; i++)
		coordList.push_back(i * nodal_dist);

	printVector(coordList, "coordList", logFile);

	dbMatrix x;
	x.push_back(coordList);
	if (ndim > 1) {
		for (int i = 1; i < ndim; i++) {
			int dimLookup = i + 1;
			int position = findIntVecPos(dimLookup, 0, SBM_dim.size(), SBM_dim);
			logFile << "Position: " << position << endl;

			dbMatrix xBlock = x;
			int xBlockSize = xBlock[0].size();
			x.clear();
			x.resize(i + 1);

			for (int j = 0; j < coordList.size(); j++) {

				// Select a particular coordinate
				double coordSelect = coordList[j];

				// Find if dimension needs to be factored
				dbMatrix x_add = xBlock;
				if (position != -1) {
					logFile << "Dim factored" << endl;

					x_add.push_back(
							dbVector(xBlockSize,
									SBM_coeff[position] * coordSelect));

					//dbMatrix x_add = [SBM_coeff*coordSelect*ones(1,xBlockSize);xBlock];
				} else {
					// Repeat the previous block for each selected coordinate
					//x_add = [coordSelect*ones(1,xBlockSize);xBlock];
					x_add.push_back(dbVector(xBlockSize, coordSelect));
				}

				printMatrix(x_add, "x_add", logFile);

				//x = [x x_add];
				for (int k = 0; k < x_add.size(); k++) {
					for (int l = 0; l < x_add[k].size(); l++) {
						x[k].push_back(x_add[k][l]);
					}
				}

				printMatrix(x, "x", logFile);

			}
		}
	}

	// Transposing the coordinate matrix
	coords.resize(x[0].size());
	for (int i = 0; i < coords.size(); i++) {
		coords[i].resize(ndim);
		for (int j = 0; j < ndim; j++)
			coords[i][j] = x[j][i];
	}

	numCoords = coords.size();
}
开发者ID:3rguy,项目名称:Orion,代码行数:73,代码来源:Interpolation.cpp


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