本文整理汇总了C++中TFltVV::GetCol方法的典型用法代码示例。如果您正苦于以下问题:C++ TFltVV::GetCol方法的具体用法?C++ TFltVV::GetCol怎么用?C++ TFltVV::GetCol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFltVV
的用法示例。
在下文中一共展示了TFltVV::GetCol方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEigVec
// to get first few eigenvectors
void GetEigVec(const PUNGraph& Graph, const int& EigVecs, TFltV& EigValV, TVec<TFltV>& EigVecV) {
const int Nodes = Graph->GetNodes();
// Lanczos
TUNGraphMtx GraphMtx(Graph);
int CalcVals = int(2*EigVecs);
if (CalcVals > Nodes) { CalcVals = Nodes; }
TFltVV EigVecVV;
//while (EigValV.Len() < EigVecs && CalcVals < 10*EigVecs) {
try {
TSparseSVD::Lanczos(GraphMtx, EigVecs, 2*EigVecs, ssotFull, EigValV, EigVecVV, false); }
catch(...) {
printf("\n ***EXCEPTION: TRIED %d GOT %d values** \n", CalcVals, EigValV.Len()); }
if (EigValV.Len() < EigVecs) {
printf(" ***TRIED %d GOT %d values** \n", CalcVals, EigValV.Len()); }
// CalcVals += EigVecs;
//}
TFltIntPrV EigValIdV;
for (int i = 0; i < EigValV.Len(); i++) {
EigValIdV.Add(TFltIntPr(EigValV[i], i));
}
EigValIdV.Sort(false);
EigValV.Sort(false);
for (int v = 0; v < EigValIdV.Len(); v++) { // vector components are not sorted!!!
EigVecV.Add();
EigVecVV.GetCol(EigValIdV[v].Val2, EigVecV.Last());
}
IsAllValVNeg(EigVecV[0], true);
}
示例2: GetInvParticipRat
void GetInvParticipRat(const PUNGraph& Graph, int MaxEigVecs, int TimeLimit, TFltPrV& EigValIprV) {
TUNGraphMtx GraphMtx(Graph);
TFltVV EigVecVV;
TFltV EigValV;
TExeTm ExeTm;
if (MaxEigVecs<=1) { MaxEigVecs=1000; }
int EigVecs = TMath::Mn(Graph->GetNodes(), MaxEigVecs);
printf("start %d vecs...", EigVecs);
try {
TSparseSVD::Lanczos2(GraphMtx, EigVecs, TimeLimit, ssotFull, EigValV, EigVecVV, false);
} catch(...) {
printf("\n ***EXCEPTION: TRIED %d GOT %d values** \n", EigVecs, EigValV.Len()); }
printf(" ***TRIED %d GOT %d values in %s\n", EigVecs, EigValV.Len(), ExeTm.GetStr());
TFltV EigVec;
EigValIprV.Clr();
if (EigValV.Empty()) { return; }
for (int v = 0; v < EigVecVV.GetCols(); v++) {
EigVecVV.GetCol(v, EigVec);
EigValIprV.Add(TFltPr(EigValV[v], GetInvParticipRat(EigVec)));
}
EigValIprV.Sort();
}