本文整理汇总了C++中UserInterface::printSummary方法的典型用法代码示例。如果您正苦于以下问题:C++ UserInterface::printSummary方法的具体用法?C++ UserInterface::printSummary怎么用?C++ UserInterface::printSummary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInterface
的用法示例。
在下文中一共展示了UserInterface::printSummary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// Driver program
int main(int argc, char **argv)
{
int num_points = 0; // Actual number of data points
ANNpointArray data_points; // Data points
ANNpoint query_point; // Query point
ANNidxArray near_neighbor_idx; // Near neighbor indices
ANNdistArray near_neighbor_distances;// Near neighbor distances
ANNkd_tree * kd_tree_adt; // ADT search structure
UserInterface UI;
// Read command-line arguments
UI.getArgs(argc, argv);
// Allocate query point
query_point = annAllocPt(UI.dimension);
// Allocate data points
data_points = annAllocPts(UI.max_points, UI.dimension);
// Allocate near neighbor indices
near_neighbor_idx = new ANNidx[UI.k];
// Allocate near neighbor distances
near_neighbor_distances = new ANNdist[UI.k];
// Echo data points
cout << "Data Points: \n";
if (UI.results_out != NULL)
*(UI.results_out) << "Data points: \n";
while (num_points < UI.max_points && UI.readPoint(*(UI.data_in), data_points[num_points]))
{
UI.printPoint(cout, data_points[num_points], num_points);
if (UI.results_out != NULL)
{
UI.printPoint(*(UI.results_out), data_points[num_points], num_points);
}
num_points++;
}
// Construct k-d tree abstract data type search structure
// Params: data points, number of points, dimension of space
kd_tree_adt = new ANNkd_tree(data_points, num_points, UI.dimension);
// Echo query point(s)
cout << "\n\nQuery points: \n";
if (UI.results_out != NULL)
*(UI.results_out) << "\n\nQuery points: \n";
// Read query points
while (UI.readPoint(*(UI.query_in), query_point))
{
UI.printPoint(cout, query_point, UI.dimension);
if (UI.results_out != NULL)
{
UI.printPoint(*(UI.results_out), query_point, UI.dimension);
}
// Perform the search
// Params: query point, number of near neighbors, nearest neighbors (returned), distance (returned), error bound
kd_tree_adt->annkSearch(query_point, UI.k, near_neighbor_idx, near_neighbor_distances, UI.eps);
UI.printSummary(cout, &near_neighbor_idx, &near_neighbor_distances);
if (UI.results_out != NULL)
UI.printSummary(*(UI.results_out), &near_neighbor_idx, &near_neighbor_distances);
}
// Perform house cleaning tasks
delete kd_tree_adt;
delete [] near_neighbor_idx;
delete [] near_neighbor_distances;
annClose();
cin.get();
return EXIT_SUCCESS;
}