本文整理汇总了C++中PNEANet::GetNAStrI方法的典型用法代码示例。如果您正苦于以下问题:C++ PNEANet::GetNAStrI方法的具体用法?C++ PNEANet::GetNAStrI怎么用?C++ PNEANet::GetNAStrI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNEANet
的用法示例。
在下文中一共展示了PNEANet::GetNAStrI方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FOut
//.........这里部分代码省略.........
EXPECT_EQ(3.41, Graph->GetNAFltI(attr3, 5).GetDat());
EXPECT_EQ(2.718, Graph->GetNAFltI(attr3, 50).GetDat());
NodeId = 0;
DefNodes = 0;
TVec<TFlt> TAFltIV = TVec<TFlt>();
for (TNEANet::TAFltI NI = Graph->BegNAFltI(attr3);
NI < Graph->EndNAFltI(attr3); NI++) {
if (NI.GetDat() != TFlt::Mn) {
NodeId++;
TAFltIV.Add(NI.GetDat());
} else {
DefNodes++;
}
}
EXPECT_EQ(4, NodeId);
EXPECT_EQ(NNodes - 4, DefNodes);
TAFltIV.Sort();
EXPECT_EQ(2.718, TAFltIV[0]);
EXPECT_EQ(3.41, TAFltIV[1]);
EXPECT_EQ(150.0, TAFltIV[2]);
EXPECT_EQ(563.0, TAFltIV[3]);
// Test vertical str iterator for node 3, 50, 700, 900
Graph->AddStrAttrDatN(10, "abc", attr1);
Graph->AddStrAttrDatN(20, "def", attr1);
Graph->AddStrAttrDatN(400, "ghi", attr1);
// this does not show since ""=null
Graph->AddStrAttrDatN(455, "", attr1);
EXPECT_EQ('c', Graph->GetNAStrI(attr1, 10).GetDat().LastCh());
EXPECT_EQ('f', Graph->GetNAStrI(attr1, 20).GetDat().LastCh());
NodeId = 0;
DefNodes = 0;
TVec<TStr> TAStrIV = TVec<TStr>();
for (TNEANet::TAStrI NI = Graph->BegNAStrI(attr1);
NI < Graph->EndNAStrI(attr1); NI++) {
if (NI.GetDat() != TStr::GetNullStr()) {
NodeId++;
TAStrIV.Add(NI.GetDat());
} else {
DefNodes++;
}
}
EXPECT_EQ(3, NodeId);
EXPECT_EQ(NNodes - 3, DefNodes);
TAStrIV.Sort();
// TODO(nkhadke): Fix hack to compare strings properly. This works for now.
EXPECT_EQ('c', TAStrIV[0].LastCh());
EXPECT_EQ('f', TAStrIV[1].LastCh());
EXPECT_EQ('i', TAStrIV[2].LastCh());
// Test vertical iterator over many types (must skip default/deleted attr)
int NId = 55;
Graph->AddStrAttrDatN(NId, "aaa", attr1);
Graph->AddIntAttrDatN(NId, 3*2, attr2);
Graph->AddFltAttrDatN(NId, 3.41, attr3);
Graph->AddStrAttrDatN(80, "dont appear", attr4); // should not show up
TStrV NIdAttrName;