本文整理汇总了C++中TFltV::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ TFltV::Add方法的具体用法?C++ TFltV::Add怎么用?C++ TFltV::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFltV
的用法示例。
在下文中一共展示了TFltV::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParam
void TSirModel::GetParam(TFltV& ParamV) const {
ParamV.Clr(false);
ParamV.Add(N0);
ParamV.Add(I0);
ParamV.Add(Beta);
ParamV.Add(Gamma);
ParamV.Add(T0);
}
示例2: RungeKutta
void TEpidemModel::RungeKutta(const TFltV& y, const TFltV& dydx, double x, double h, TFltV& SirOutV) {
const int n = y.Len();
IAssert(y.Len() == n && dydx.Len() == n);
TFltV dym(n), dyt(n), yt(n);
int i;
double hh=h*0.5;
double h6=h/6.0;
double xh=x+hh;
for (i=0; i < n; i++) {
yt[i]=y[i]+hh*dydx[i];
}
GetDerivs(xh, yt, dyt);
for (i=0; i<n; i++) {
yt[i]=y[i]+hh*dyt[i];
}
GetDerivs(xh,yt,dym);
for (i=0; i<n; i++) {
yt[i]=y[i]+h*dym[i];
dym[i] += dyt[i];
}
GetDerivs(x+h,yt,dyt);
SirOutV.Clr(false);
for (i=0; i<n; i++) {
SirOutV.Add(y[i]+h6 * (dydx[i]+dyt[i]+2.0*dym[i]));
}
}
示例3: main
int main() {
TLSHash LSH(7, 7, DIM, TLSHash::EUCLIDEAN);
LSH.Init();
TRnd Gen;
Gen.Randomize();
TVec<TFltV> DataV;
for (int i=0; i<1000000; i++) {
TFltV Datum;
for (int j=0; j<3; j++) {
Datum.Add(Gen.GetUniDev()*2100);
}
DataV.Add(Datum);
}
LSH.AddV(DataV);
TVec<TPair<TFltV, TFltV> > NeighborsV = LSH.GetAllCandidatePairs();
printf("Number of Candidates: %d\n", NeighborsV.Len());
NeighborsV = LSH.GetAllNearPairs();
printf("Number of Close Pairs: %d\n", NeighborsV.Len());
for (int i=0; i<NeighborsV.Len(); i++) {
outputPoint(NeighborsV[i].GetVal1());
printf(" ");
outputPoint(NeighborsV[i].GetVal2());
printf("\n");
}
return 0;
}
示例4: SaveObjInfo
void TNetInfBs::SaveObjInfo(const TStr& OutFNm) {
TGnuPlot GnuPlot(OutFNm);
TFltV Objective;
for (THash<TIntPr, TEdgeInfo>::TIter EI = EdgeInfoH.BegI(); EI < EdgeInfoH.EndI(); EI++) {
if (Objective.Len()==0) { Objective.Add(EI.GetDat().MarginalGain);
} else {
Objective.Add(Objective[Objective.Len()-1]+EI.GetDat().MarginalGain);
}
}
GnuPlot.AddPlot(Objective, gpwLinesPoints);
GnuPlot.SavePng();
}
示例5: GetResults
void TNNet::GetResults(TFltV& ResultV) const{
ResultV.Clr(true, -1);
for(int NeuronN = 0; NeuronN < LayerV.Last().GetNeuronN() - 1; ++NeuronN){
ResultV.Add(LayerV.Last().GetOutVal(NeuronN));
}
}
示例6: GetArrNumV
void TJsonVal::GetArrNumV(TFltV& FltV) const {
EAssert(IsArr());
for (int FltN = 0; FltN < GetArrVals(); FltN++) {
PJsonVal ArrVal = GetArrVal(FltN);
EAssert(ArrVal->IsNum());
FltV.Add(ArrVal->GetNum());
}
}
示例7: GetDual
void TBowLinAlg::GetDual(const PBowDocWgtBs& X,
const TFltV& x, TFltV& y, const int& _Docs) {
const int Docs = (_Docs == -1) ? X->GetDocs() : _Docs;
y.Gen(Docs, 0); // prepare space
for (int DId = 0; DId < Docs; DId++) {
y.Add(TBowLinAlg::DotProduct(x, X->GetSpV(DId)));
}
}
示例8: FltAttrValueEI
void TNEANet::FltAttrValueEI(const TInt& EId, TStrIntPrH::TIter EdgeHI, TFltV& Values) const {
Values = TVec<TFlt>();
while (!EdgeHI.IsEnd()) {
if (EdgeHI.GetDat().Val1 == FltType && !EdgeAttrIsFltDeleted(EId, EdgeHI)) {
TFlt val = (this->VecOfFltVecsE.GetVal(EdgeHI.GetDat().Val2).GetVal(EId));
Values.Add(val);
}
EdgeHI++;
}
}
示例9: FltAttrValueNI
void TNEANet::FltAttrValueNI(const TInt& NId, TStrIntPrH::TIter NodeHI, TFltV& Values) const {
Values = TVec<TFlt>();
while (!NodeHI.IsEnd()) {
if (NodeHI.GetDat().Val1 == FltType && !NodeAttrIsFltDeleted(NId, NodeHI)) {
TFlt val = (this->VecOfFltVecsN.GetVal(NodeHI.GetDat().Val2).GetVal(NId));
Values.Add(val);
}
NodeHI++;
}
}
示例10: MakeExpBins
void TGUtil::MakeExpBins(const TFltV& YValV, TFltV& ExpYValV, const double& BinFactor) {
ExpYValV.Clr(true);
int prevI=0;
for (int i = 0; i < YValV.Len(); ) {
ExpYValV.Add(YValV[i]);
i = int(i*BinFactor);
if (i==prevI) { i++; }
prevI = i;
}
}
示例11:
void TSirSR2Model::GetParam(TFltV& ParamV) const {
ParamV.Clr(false);
ParamV.Add(N0M);
ParamV.Add(I0M);
ParamV.Add(N0B);
ParamV.Add(I0B);
ParamV.Add(T0);
ParamV.Add(BetaM);
ParamV.Add(GammaM);
ParamV.Add(BetaB);
ParamV.Add(GammaB);
ParamV.Add(BetaMB);
ParamV.Add(BetaBM);
ParamV.Add(DeltaM);
ParamV.Add(DeltaB);
}
示例12: LoadTxt
void TEpidemModel::LoadTxt(const TStr& InFNm, const int& ColId, TFltV& ValV) {
ValV.Clr();
if (! TFile::Exists(InFNm)) {
printf("*** %s not found!\n", InFNm.CStr());
return;
}
TSsParser Ss(InFNm, ssfTabSep);
while (Ss.Next()) {
ValV.Add(Ss.GetFlt(ColId));
}
}
示例13: GenAGM
PUNGraph TAGM::GenAGM(TVec<TIntV>& CmtyVV, const double& DensityCoef, const double& ScaleCoef, TRnd& Rnd) {
TFltV CProbV;
double Prob;
for (int i = 0; i < CmtyVV.Len(); i++) {
Prob = ScaleCoef*pow( double( CmtyVV[i].Len()), - DensityCoef);
if (Prob > 1.0) {
Prob = 1;
}
CProbV.Add(Prob);
}
return TAGM::GenAGM(CmtyVV, CProbV, Rnd);
}
示例14: PermOutEdgeWgt
void TWgtNet::PermOutEdgeWgt() {
TFltV WgtV;
for (TNodeI NI = BegNI(); NI < EndNI(); NI++) {
WgtV.Clr(false);
for (int e = 0; e < NI.GetOutDeg(); e++) {
WgtV.Add(NI.GetOutEDat(e));
}
WgtV.Shuffle(TInt::Rnd);
for (int e = 0; e < NI.GetOutDeg(); e++) {
NI.GetOutEDat(e) = WgtV[e];
}
}
}
示例15: TMatrix
TBowMatrix::TBowMatrix(PBowDocBs BowDocBs, PBowDocWgtBs BowDocWgtBs,
const TStr& CatNm, const TIntV& DIdV, TFltV& ClsV): TMatrix() {
RowN = BowDocBs->GetWords();
ClsV.Gen(DIdV.Len(), 0);
ColSpVV.Gen(DIdV.Len(), 0);
IAssert(BowDocBs->IsCatNm(CatNm));
int CatId = BowDocBs->GetCId(CatNm);
for (int i = 0; i < DIdV.Len(); i++) {
ColSpVV.Add(BowDocWgtBs->GetSpV(DIdV[i]));
ClsV.Add(BowDocBs->IsCatInDoc(DIdV[i], CatId) ? 0.99 : -0.99);
}
}