13 #include <torch/torch.h>
20 std::vector<Acts::detail::CantorEdge<int64_t>> cantorEdgeIndex;
21 cantorEdgeIndex.reserve(edgeIndex.size() / 2);
22 for (
auto it = edgeIndex.begin();
it != edgeIndex.end();
it += 2) {
26 std::sort(cantorEdgeIndex.begin(), cantorEdgeIndex.end());
28 auto new_end = std::unique(cantorEdgeIndex.begin(), cantorEdgeIndex.end());
29 if (new_end != cantorEdgeIndex.end()) {
33 cantorEdgeIndex.erase(new_end, cantorEdgeIndex.end());
36 return cantorEdgeIndex;
42 const std::vector<int64_t>& truthGraph,
43 std::unique_ptr<const Acts::Logger> l)
49 const std::any&
edges)
const {
51 const auto edgeIndex = Acts::detail::tensor2DToVector<int64_t>(
52 std::any_cast<torch::Tensor>(
edges).
t());
54 auto predGraphCantor = cantorize(edgeIndex,
logger());
57 std::vector<Acts::detail::CantorEdge<int64_t>> intersection;
59 std::max(predGraphCantor.size(), m_truthGraphCantor.size()));
61 std::set_intersection(predGraphCantor.begin(), predGraphCantor.end(),
62 m_truthGraphCantor.begin(), m_truthGraphCantor.end(),
63 std::back_inserter(intersection));
65 ACTS_DEBUG(
"Intersection size " << intersection.size());
66 const float intersectionSizeFloat = intersection.size();
67 const float eff = intersectionSizeFloat / m_truthGraphCantor.size();
68 const float pur = intersectionSizeFloat / predGraphCantor.size();
70 ACTS_INFO(
"Efficiency=" << eff <<
", purity=" << pur);