• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TVector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: TrainModel

 void TrainModel(
     const NJson::TJsonValue& params,
     const NCatboostOptions::TOutputFilesOptions& outputOptions,
     const TMaybe<TCustomObjectiveDescriptor>& objectiveDescriptor,
     const TMaybe<TCustomMetricDescriptor>& evalMetricDescriptor,
     TPool& learnPool,
     bool allowClearPool,
     const TVector<const TPool*>& testPoolPtrs,
     TFullModel* model,
     const TVector<TEvalResult*>& evalResultPtrs) const override {
     Y_UNUSED(objectiveDescriptor);
     Y_UNUSED(evalMetricDescriptor);
     Y_UNUSED(allowClearPool);
     CB_ENSURE(testPoolPtrs.size() == 1, "Multiple eval sets not supported for GPU");
     Y_VERIFY(evalResultPtrs.size() == testPoolPtrs.size());
     NCatboostCuda::TrainModel(params, outputOptions, learnPool, *testPoolPtrs[0], model);
     evalResultPtrs[0]->GetRawValuesRef().resize(model->ObliviousTrees.ApproxDimension);
 }
开发者ID:Xiaodingdangguaiguai,项目名称:catboost,代码行数:18,代码来源:train.cpp


示例2: OutputShapValues

static void OutputShapValues(const TVector<TVector<double>>& shapValues,
                             TFileOutput& out) {
    for (size_t documentIdx = 0; documentIdx < shapValues.size(); ++documentIdx) {
        int featureCount = shapValues[documentIdx].size();
        for (int featureIdx = 0; featureIdx < featureCount; ++featureIdx) {
            out << shapValues[documentIdx][featureIdx] << (featureIdx + 1 == featureCount ? '\n' : '\t');
        }
    }
}
开发者ID:Xiaodingdangguaiguai,项目名称:catboost,代码行数:9,代码来源:shap_values.cpp


示例3: Transform

void Matrix::Transform(const TVector<Point>& vSource, TVector<Point>& vDest) const
{
    int count = vSource.GetCount();
    vDest.SetCount(count);

    for (int index = 0; index < count; index++) {
        float x = vSource[index].X();
        float y = vSource[index].Y();

        vDest.Set(
            index,
            Point(
                m_m[0][0] * x + m_m[0][1] * y + m_m[0][3],
                m_m[1][0] * x + m_m[1][1] * y + m_m[1][3]
            )
        );
    }
}
开发者ID:FreeAllegiance,项目名称:Allegiance-R7-With-R4-Engine,代码行数:18,代码来源:matrix.cpp


示例4: ExtendFeaturePath

static TVector<TFeaturePathElement> ExtendFeaturePath(const TVector<TFeaturePathElement>& oldFeaturePath,
                                                      double zeroPathsFraction,
                                                      double onePathsFraction,
                                                      int feature) {
    const size_t pathLength = oldFeaturePath.size();

    TVector<TFeaturePathElement> newFeaturePath(pathLength + 1);
    Copy(oldFeaturePath.begin(), oldFeaturePath.begin() + pathLength, newFeaturePath.begin());

    const double weight = pathLength == 0 ? 1.0 : 0.0;
    newFeaturePath[pathLength] = TFeaturePathElement(feature, zeroPathsFraction, onePathsFraction, weight);

    for (int elementIdx = pathLength - 1; elementIdx >= 0; --elementIdx) {
        newFeaturePath[elementIdx + 1].Weight += onePathsFraction * newFeaturePath[elementIdx].Weight * (elementIdx + 1) / (pathLength + 1);
        newFeaturePath[elementIdx].Weight = zeroPathsFraction * newFeaturePath[elementIdx].Weight * (pathLength - elementIdx) / (pathLength + 1);
    }

    return newFeaturePath;
}
开发者ID:Xiaodingdangguaiguai,项目名称:catboost,代码行数:19,代码来源:shap_values.cpp


示例5: SplitInto

        TVector<TString> SplitInto(const TString &s, char delim, TVector<TString> &elems, ui32 numberOfSplits) {
            std::stringstream ss(s);
            TString item;

            ui32 iter = 0;
            while (std::getline(ss, item, delim)) {
                elems.push_back(item);
                iter++;
                if (iter >= numberOfSplits) {
                    TString rest;
                    while (std::getline(ss, item)) {
                        rest += item;
                    }
                    elems.push_back(rest);
                    break;
                }
            }
            return elems;
        }
开发者ID:alexeyche,项目名称:alexeyche-junk,代码行数:19,代码来源:string.cpp


示例6: Save

void FBinarySerializer::Save(TVector<bool>& VectorData)
{
	const SizeT VectorSize = VectorData.size();
	Serialize(VectorSize);

	for (auto&& Element: VectorData)
	{
		Serialize(static_cast<bool>(Element));
	}
}
开发者ID:PhoenixOrg,项目名称:PhoenixEngine,代码行数:10,代码来源:BinarySerializer.cpp


示例7: find_collision

/* find if any of the current balls intersect with each other in the 
 * current timestep.  returns the index of the 2 intersecting balls, 
 * the point and time of intersection */
int find_collision(TVector& point, double& timePoint, double time2, 
	     int& ball1, int& ball2) {

  TVector relativeV;
  TRay rays;
  double Mytime = 0.0, Add = time2/150.0, timedummy = 10000, timedummy2 = -1;
  TVector posi;
  
  /* Test all balls against each other in 150 small steps */
  for (int i = 0; i < ball_count - 1; i++){
    for (int j = i+1; j < ball_count; j++){

      // Find Distance
      relativeV = ball_vel[i]-ball_vel[j];
      rays = TRay(old_pos[i],TVector::unit(relativeV));
      Mytime = 0.0;
      
      // If distance detween centers greater than 2*radius an 
      // intersection occurred loop to find the exact intersection point
      if ( (rays.dist(old_pos[j])) > ball_r * 2 ) 
	continue;  
      
      while (Mytime < time2) {
	Mytime += Add;
	posi = old_pos[i] + relativeV*Mytime;
	if (posi.dist(old_pos[j]) <= ball_r * 2 ) {
	  point = posi;
	  if (timedummy > (Mytime - Add)) timedummy = Mytime-Add;
	  ball1 = i;
	  ball2 = j;
	  break;
	}
      }
    }
  }
  
  if (timedummy!=10000) { 
    timePoint=timedummy;
    return 1;
  }
  
  return 0;
}
开发者ID:seebq,项目名称:cs4451-project4-the-tring-game,代码行数:46,代码来源:prj4.cpp


示例8: aaSearch

void FindSequenceDialog::aaSearch ()
    {
    int a , b ;
    TVector *v = c->vec ;
    if ( v->getType() != TYPE_VECTOR && 
    	 v->getType() != TYPE_SEQUENCE && 
    	 v->getType() != TYPE_PRIMER )
    	 return ;
    	 
    wxString s = getQuery() ;
    for ( a = 0 ; a < v->items.size() ; a++ )
        {
        wxString ls = v->items[a].getAminoAcidSequence() ;
        if ( ls.IsEmpty() ) continue ;
        int dir = v->items[a].getDirection() ;
        int off = v->items[a].getOffset() ;
        vector <Tdna2aa> dna2aa ;
        p = 0 ;
        b = subsearch ( ls , s , p ) ;
        while ( b != -1 )
           {
           if ( lb->GetCount() > FIND_MAX ) return ;
           if ( dna2aa.size() == 0 )
              v->items[a].translate ( v , NULL , dna2aa ) ;
           int from = dir==1?b:last ;
           int to = dir==1?last:b ;
           wxString msg ;
           if ( off != -1 )
              msg = wxString::Format ( _T(" [%d-%d]") , from+off , to+off ) ;
           from = dna2aa[from].dna[0] + 1 ;
           to = dna2aa[to].dna[2] + 1 ;
           if ( from > to ) { int x = from ; from = to ; to = x ; }
           lb->Append ( wxString::Format ( _T("%s: %s (%d-%d)%s") ,
                                 txt("amino_acid").c_str() ,
                                 v->items[a].name.c_str() ,
                                 from , to , msg.c_str() ) ) ;
           vi.Add ( -1 ) ;
           p = b + 1 ;
           b = subsearch ( ls , s , p ) ;
           }
        }   
        
    // Fixed reading frames
    wxString ss ;
    ss = v->getSequence() ;
    if ( v->isCircular() ) ss += ss.Left ( 2 ) ;
    else ss += _T("  ") ;
    aaSubSearch ( ss , 0 , 1 , txt("m_aa_1") ) ; // Reading frame +1
    aaSubSearch ( ss , 1 , 1 , txt("m_aa_2") ) ; // Reading frame +2     
    aaSubSearch ( ss , 2 , 1 , txt("m_aa_3") ) ; // Reading frame +3
    ss = v->transformSequence ( true , false ) ;
    if ( v->isCircular() ) ss = ss.Right ( 2 ) + ss ;
    else ss = _T("  ") + ss ;
    aaSubSearch ( ss , -1 , -1 , txt("m_aa_m1") ) ; // Reading frame -1     
    aaSubSearch ( ss , -2 , -1 , txt("m_aa_m2") ) ; // Reading frame -2     
    aaSubSearch ( ss , -3 , -1 , txt("m_aa_m3") ) ; // Reading frame -3    
    }    
开发者ID:magnusmanske,项目名称:gentle-m,代码行数:57,代码来源:FindSequenceDialog.cpp


示例9: AssignRandomWeights

static void AssignRandomWeights(int learnSampleCount,
                                TLearnContext* ctx,
                                TFold* fold) {
    TVector<float> sampleWeights;
    sampleWeights.yresize(learnSampleCount);

    const ui64 randSeed = ctx->Rand.GenRand();
    NPar::TLocalExecutor::TExecRangeParams blockParams(0, learnSampleCount);
    blockParams.SetBlockSize(10000);
    ctx->LocalExecutor.ExecRange([&](int blockIdx) {
        TFastRng64 rand(randSeed + blockIdx);
        rand.Advance(10); // reduce correlation between RNGs in different threads
        const float baggingTemperature = ctx->Params.ObliviousTreeOptions->BootstrapConfig->GetBaggingTemperature();
        float* sampleWeightsData = sampleWeights.data();
        NPar::TLocalExecutor::BlockedLoopBody(blockParams, [&rand, sampleWeightsData, baggingTemperature](int i) {
            const float w = -FastLogf(rand.GenRandReal1() + 1e-100);
            sampleWeightsData[i] = powf(w, baggingTemperature);
        })(blockIdx);
    }, 0, blockParams.GetBlockCount(), NPar::TLocalExecutor::WAIT_COMPLETE);

    TFold& ff = *fold;
    ff.AssignPermuted(sampleWeights, &ff.SampleWeights);
    if (!ff.LearnWeights.empty()) {
        for (int i = 0; i < learnSampleCount; ++i) {
            ff.SampleWeights[i] *= ff.LearnWeights[i];
        }
    }

    const int approxDimension = ff.GetApproxDimension();
    for (TFold::TBodyTail& bt : ff.BodyTailArr) {
        for (int dim = 0; dim < approxDimension; ++dim) {
            double* weightedDerData = bt.WeightedDer[dim].data();
            const double* derData = bt.Derivatives[dim].data();
            const float* sampleWeightsData = ff.SampleWeights.data();
            ctx->LocalExecutor.ExecRange([=](int z) {
                weightedDerData[z] = derData[z] * sampleWeightsData[z];
            }, NPar::TLocalExecutor::TExecRangeParams(bt.BodyFinish, bt.TailFinish).SetBlockSize(4000)
             , NPar::TLocalExecutor::WAIT_COMPLETE);
        }
    }
}
开发者ID:iamnik13,项目名称:catboost,代码行数:41,代码来源:greedy_tensor_search.cpp


示例10: FindBallCol

int FindBallCol(TVector& point, double& TimePoint, double Time2, int& BallNr1, int& BallNr2)
{
	TVector RelativeV;
	TRay rays;
	double MyTime=0.0, Add=Time2/150.0, Timedummy=10000, Timedummy2=-1;
	TVector posi;
	
	//Test all balls against eachother in 150 small steps
	for (int i=0;i<NrOfBalls-1;i++)
	{
	 for (int j=i+1;j<NrOfBalls;j++)
	 {	
		    RelativeV=ArrayVel[i]-ArrayVel[j];
			rays=TRay(OldPos[i],TVector::unit(RelativeV));
			MyTime=0.0;

			if ( (rays.dist(OldPos[j])) > 40) continue; 

			while (MyTime<Time2)
			{
			   MyTime+=Add;
			   posi=OldPos[i]+RelativeV*MyTime;
			   if (posi.dist(OldPos[j])<=40) {
										   point=posi;
										   if (Timedummy>(MyTime-Add)) Timedummy=MyTime-Add;
										   BallNr1=i;
										   BallNr2=j;
										   break;
										}
			
			}
	 }

	}

	if (Timedummy!=10000) { TimePoint=Timedummy;
	                        return 1;
	}

	return 0;
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:41,代码来源:Lesson30.cpp


示例11: Create

void CGunShotgun::Create()
{
	TVector<int, 2> frameLayout;
	frameLayout.Set(8, 2);
	m_entity = CLasagne::GetInstance()->LoadAnimatedImage("./media/graphics/characters/guns/shotgun/gun.png", frameLayout);
	if (!m_entity)
		return;

	m_audio = CLasagne::GetInstance()->LoadAudioFile("./media/sound/guns/shotgun.wav");

	m_entity->SetDepth(5);

	static const int NoofBullets = 9;
	for (int bulletIndex = 0; bulletIndex < NoofBullets; ++bulletIndex)
	{
		CBulletBase *bulletBase = new CBulletShotgun();
		bulletBase->Create();
		m_bullet.push_back(bulletBase);
	}

}
开发者ID:SamOatesUniversity,项目名称:Year-3---Device-Programming---Memory-Manager---Horde,代码行数:21,代码来源:gunshotgun.cpp


示例12: outputHLSLSamplerUniformGroup

void UniformHLSL::outputHLSLSamplerUniformGroup(TInfoSinkBase &out,
                                                const HLSLTextureSamplerGroup textureGroup,
                                                const TVector<const TIntermSymbol *> &group,
                                                unsigned int *groupTextureRegisterIndex)
{
    if (group.empty())
    {
        return;
    }
    unsigned int groupRegisterCount = 0;
    for (const TIntermSymbol *uniform : group)
    {
        const TType &type   = uniform->getType();
        const TString &name = uniform->getSymbol();
        unsigned int registerCount;
        unsigned int samplerArrayIndex =
            declareUniformAndAssignRegister(type, name, &registerCount);
        groupRegisterCount += registerCount;
        if (type.isArray())
        {
            out << "static const uint " << DecorateIfNeeded(uniform->getName()) << ArrayString(type)
                << " = {";
            for (int i = 0; i < type.getArraySize(); ++i)
            {
                if (i > 0)
                    out << ", ";
                out << (samplerArrayIndex + i);
            }
            out << "};\n";
        }
        else
        {
            out << "static const uint " << DecorateIfNeeded(uniform->getName()) << " = "
                << samplerArrayIndex << ";\n";
        }
    }
    TString suffix = TextureGroupSuffix(textureGroup);
    // Since HLSL_TEXTURE_2D is the first group, it has a fixed offset of zero.
    if (textureGroup != HLSL_TEXTURE_2D)
    {
        out << "static const uint textureIndexOffset" << suffix << " = "
            << (*groupTextureRegisterIndex) << ";\n";
        out << "static const uint samplerIndexOffset" << suffix << " = "
            << (*groupTextureRegisterIndex) << ";\n";
    }
    out << "uniform " << TextureString(textureGroup) << " textures" << suffix << "["
        << groupRegisterCount << "]"
        << " : register(t" << (*groupTextureRegisterIndex) << ");\n";
    out << "uniform " << SamplerString(textureGroup) << " samplers" << suffix << "["
        << groupRegisterCount << "]"
        << " : register(s" << (*groupTextureRegisterIndex) << ");\n";
    *groupTextureRegisterIndex += groupRegisterCount;
}
开发者ID:MekliCZ,项目名称:positron,代码行数:53,代码来源:UniformHLSL.cpp


示例13: CatBoostCalcRegularFeatureEffect_R

SEXP CatBoostCalcRegularFeatureEffect_R(SEXP modelParam, SEXP poolParam, SEXP fstrTypeParam, SEXP threadCountParam) {
    SEXP result = NULL;
    R_API_BEGIN();
    TFullModelHandle model = reinterpret_cast<TFullModelHandle>(R_ExternalPtrAddr(modelParam));
    TPoolHandle pool = reinterpret_cast<TPoolHandle>(R_ExternalPtrAddr(poolParam));
    TString fstrType = CHAR(asChar(fstrTypeParam));
    TVector<TVector<double>> effect = GetFeatureImportances(*model, *pool, fstrType, asInteger(threadCountParam));
    size_t resultSize = 0;
    if (!effect.empty()) {
        resultSize = effect.size() * effect[0].size();
    }
    result = PROTECT(allocVector(REALSXP, resultSize));
    for (size_t i = 0, k = 0; i < effect.size(); ++i) {
        for (size_t j = 0; j < effect[0].size(); ++j) {
            REAL(result)[k++] = effect[i][j];
        }
    }
    R_API_END();
    UNPROTECT(1);
    return result;
}
开发者ID:iamnik13,项目名称:catboost,代码行数:21,代码来源:catboostr.cpp


示例14: Create

void CGunMachinegun::Create()
{
	TVector<int, 2> frameLayout;
	frameLayout.Set(8, 2);
	m_entity = CLasagne::GetInstance()->LoadAnimatedImage("./data/graphics/characters/guns/machinegun/gun.png", frameLayout, 5);
	if (!m_entity)
		return;

	CLasagne::GetInstance()->DisableEntity(&m_entity);

	m_audio = CLasagne::GetInstance()->LoadAudioFile("./data/sound/guns/machinegun.wav");

	static const int NoofBullets = 45;
	for (int bulletIndex = 0; bulletIndex < NoofBullets; ++bulletIndex)
	{
		CBulletBase *bulletBase = new CBulletMachinegun();
		bulletBase->Create();
		m_bullet.push_back(bulletBase);
	}

}
开发者ID:SamOatesUniversity,项目名称:Year-3---Device-Programming---Memory-Manager---Horde,代码行数:21,代码来源:gunmachinegun.cpp


示例15: TIntermSequence

TIntermAggregate *EmulatePrecision::createRoundingFunctionCallNode(TIntermTyped *roundedChild)
{
    const ImmutableString *roundFunctionName = &kAngleFrmString;
    if (roundedChild->getPrecision() == EbpLow)
        roundFunctionName = &kAngleFrlString;
    TIntermSequence *arguments = new TIntermSequence();
    arguments->push_back(roundedChild);

    TVector<const TVariable *> parameters;
    TType *paramType = new TType(roundedChild->getType());
    paramType->setPrecision(EbpHigh);
    paramType->setQualifier(EvqIn);
    parameters.push_back(new TVariable(mSymbolTable, kParamXName,
                                       static_cast<const TType *>(paramType),
                                       SymbolType::AngleInternal));

    return TIntermAggregate::CreateRawFunctionCall(
        *getInternalFunction(*roundFunctionName, roundedChild->getType(), arguments, parameters,
                             true),
        arguments);
}
开发者ID:google,项目名称:angle,代码行数:21,代码来源:EmulatePrecision.cpp


示例16: CalcOnlineCTRsBatch

void CalcOnlineCTRsBatch(const TVector<TCalcOnlineCTRsBatchTask>& tasks, const TTrainData& data, TLearnContext* ctx) {
    auto calcer = [&](int i) {
        size_t totalLeafCount;
        ComputeOnlineCTRs(data,
                          *tasks[i].Fold,
                          tasks[i].Projection,
                          ctx,
                          tasks[i].Ctr,
                          &totalLeafCount);
    };
    ctx->LocalExecutor.ExecRange(calcer, 0, tasks.size(), NPar::TLocalExecutor::WAIT_COMPLETE);
}
开发者ID:iamnik13,项目名称:catboost,代码行数:12,代码来源:online_ctr.cpp


示例17: CalcSoftmax

static TVector<TVector<double>> CalcSoftmax(const TVector<TVector<double>>& approx, NPar::TLocalExecutor* localExecutor) {
    TVector<TVector<double>> probabilities = approx;
    const int threadCount = localExecutor->GetThreadCount() + 1;
    const int blockSize = (approx[0].ysize() + threadCount - 1) / threadCount;
    auto calcSoftmaxInBlock = [&](const int blockId) {
        int lastLineId = Min((blockId + 1) * blockSize, approx[0].ysize());
        TVector<double> line(approx.size());
        TVector<double> softmax(approx.size());
        for (int lineInd = blockId * blockSize; lineInd < lastLineId; ++lineInd) {
            for (int dim = 0; dim < approx.ysize(); ++dim) {
                line[dim] = approx[dim][lineInd];
            }
            CalcSoftmax(line, &softmax);
            for (int dim = 0; dim < approx.ysize(); ++dim) {
                probabilities[dim][lineInd] = softmax[dim];
            }
        }
    };
    localExecutor->ExecRange(calcSoftmaxInBlock, 0, threadCount, NPar::TLocalExecutor::WAIT_COMPLETE);
    return probabilities;
}
开发者ID:iamnik13,项目名称:catboost,代码行数:21,代码来源:eval_helpers.cpp


示例18: InsertItem

    void InsertItem(int iItem, ListItem* pListItem)
    {
        for (int i = 0; i < pListItem->GetItemHeight(); i++) {
            m_vItems.Insert(iItem, pListItem);
        }

        if (iItem <= m_iSelItem) {
            SetSelItemByIdx(m_iSelItem + pListItem->GetItemHeight());
        }

        if (m_pScrollPane) {
            m_pScrollPane->SetSize(m_vItems.GetCount());
            if (iItem <= m_iTopItem) {
                m_pScrollPane->SetPos(m_iTopItem + pListItem->GetItemHeight());
            }
        }
        NeedPaint();
    }
开发者ID:kgersen,项目名称:Allegiance,代码行数:18,代码来源:trekctrls.cpp


示例19: GetItemIdx

 int GetItemIdx(ListItem* pListItem)
 {
     int cItems = m_vItems.GetCount();
     for (int iItem = 0; iItem < cItems; iItem++)
         {
         if (m_vItems[iItem] == pListItem)
             return iItem;
         }
     return -1;
 }
开发者ID:kgersen,项目名称:Allegiance,代码行数:10,代码来源:trekctrls.cpp


示例20: GetItemIdxByData

 int GetItemIdxByData(long lItemData)
 {
     int cItems = m_vItems.GetCount();
     for (int iItem = 0; iItem < cItems; iItem++)
         {
         if (m_vItems[iItem]->GetItemData() == lItemData)
             return iItem;
         }
     return -1;
 }
开发者ID:kgersen,项目名称:Allegiance,代码行数:10,代码来源:trekctrls.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TVector2类代码示例发布时间:2022-05-31
下一篇:
C++ TVec类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap