本文整理汇总了C++中TFltPrV::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ TFltPrV::Empty方法的具体用法?C++ TFltPrV::Empty怎么用?C++ TFltPrV::Empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFltPrV
的用法示例。
在下文中一共展示了TFltPrV::Empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlotInvParticipRat
// Inverse participation ratio: normalize EigVec to have L2=1 and then I=sum_k EigVec[i]^4
// see Spectra of "real-world" graphs: Beyond the semicircle law by Farkas, Derenyi, Barabasi and Vicsek
void PlotInvParticipRat(const PUNGraph& Graph, const int& MaxEigVecs, const int& TimeLimit, const TStr& FNmPref, TStr DescStr) {
TFltPrV EigIprV;
GetInvParticipRat(Graph, MaxEigVecs, TimeLimit, EigIprV);
if (DescStr.Empty()) { DescStr = FNmPref; }
if (EigIprV.Empty()) { DescStr+=". FAIL"; EigIprV.Add(TFltPr(-1,-1)); return; }
TGnuPlot::PlotValV(EigIprV, "eigIPR."+FNmPref, TStr::Fmt("%s. G(%d, %d). Largest eig val = %f (%d values)",
DescStr.CStr(), Graph->GetNodes(), Graph->GetEdges(), EigIprV.Last().Val1(), EigIprV.Len()),
"Eigenvalue", "Inverse Participation Ratio of corresponding Eigenvector", gpsLog10Y, false, gpwPoints);
}
示例2: exp
// MLE power-coefficient
int TGnuPlot::AddPwrFit2(const int& PlotId, const TGpSeriesTy& SeriesTy, const double& MinX, const TStr& Style) {
const TGpSeries& Plot = SeriesV[PlotId];
if(Plot.XYValV.Empty()) return -1;
const TFltKdV& XY = Plot.XYValV;
// power fit
TFltPrV XYPr;
double MinY = TFlt::Mx;
for (int s = 0; s < XY.Len(); s++) {
if (XY[s].Key > 0.0) {
XYPr.Add(TFltPr(XY[s].Key, XY[s].Dat));
MinY = TMath::Mn(MinY, XY[s].Dat());
}
}
if (XYPr.Empty()) return -1;
MinY = TMath::Mn(1.0, MinY);
// determine the sign of power coefficient
double CoefSign = 0.0;
{ double A, B, R2, SigA, SigB, Chi2;
TSpecFunc::PowerFit(XYPr, A, B, SigA, SigB, Chi2, R2);
CoefSign = B > 0.0 ? +1.0 : -1.0; }
const double PowerCf = CoefSign * TSpecFunc::GetPowerCoef(XYPr, MinX);
int Mid = (int) exp(log((double)XYPr.Len())/2.0);
if (Mid >= XYPr.Len()) { Mid = XYPr.Len()-1; }
const double MidX = XYPr[Mid].Val1();
const double MidY = XYPr[Mid].Val2();
const double B = MidY / pow(MidX, PowerCf);
TStr StyleStr=Style;
if (StyleStr.Empty()) { StyleStr = "linewidth 3"; }
const int FitId = AddFunc(TStr::Fmt("%f*x**%f", B, PowerCf),
SeriesTy, TStr::Fmt("MLE = x^{%.4g}", PowerCf), StyleStr);
return FitId;
/*SeriesV.Add();
TGpSeries& NewPlot = SeriesV.Last();
TFltKdV& XYFit = NewPlot.XYValV;
XYFit.Gen(XYPr.Len(), 0);
for (int s = 0; s < XYPr.Len(); s++) {
const double XVal = XYPr[s].Val1;
const double YVal = B * pow(XYPr[s].Val1(), PowerCf);
if (YVal < MinY || XVal < MinX) continue;
XYFit.Add(TFltKd(XVal, YVal));
}
NewPlot.Label = TStr::Fmt("PowerFit: %g", PowerCf);
NewPlot.SeriesTy = SeriesTy;
if (Style.Empty()) { NewPlot.WithStyle = "linewidth 3"; }
else { NewPlot.WithStyle = Style; }
return SeriesV.Len() - 1;*/
}