From 0ab7f4c7c881f41e9e906ddcf7d544978ccf506b Mon Sep 17 00:00:00 2001 From: Akshay Krishnan Date: Sat, 12 Sep 2020 21:40:11 +0000 Subject: [PATCH] fixes3 --- gtsam/sfm/MFAS.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gtsam/sfm/MFAS.cpp b/gtsam/sfm/MFAS.cpp index d4b7ad0a7..6dccc2dee 100644 --- a/gtsam/sfm/MFAS.cpp +++ b/gtsam/sfm/MFAS.cpp @@ -82,12 +82,12 @@ Key selectNextNodeInOrdering(const unordered_map& graph) { } // Returns the absolute weight of the edge between node1 and node2. -double absWeightOfEdge(const Key node1, const Key node2, +double absWeightOfEdge(const Key key1, const Key key2, const map& edgeWeights) { // Check the direction of the edge before returning. - return edgeWeights_.find(MFAS::KeyPair(node1, node2)) != edgeWeights_.end() - ? std::abs(edgeWeights_.at(MFAS::KeyPair(node1, node2))) - : std::abs(edgeWeights_.at(MFAS::KeyPair(node2, node1))); + return edgeWeights.find(MFAS::KeyPair(key1, key2)) != edgeWeights.end() + ? std::abs(edgeWeights.at(MFAS::KeyPair(key1, key2))) + : std::abs(edgeWeights.at(MFAS::KeyPair(key2, key1))); } // Removes a node from the graph and updates edge weights of its neighbors. @@ -157,17 +157,17 @@ map MFAS::computeOutlierWeights() const { // Find edge source and destination. Key source = edgeWeight.first.first; Key dest = edgeWeight.first.second; - if (weight < 0) { + if (edgeWeight.second < 0) { std::swap(source, dest); } // If the direction is not consistent with the ordering (i.e dest occurs // before src), it is an outlier edge, and has non-zero outlier weight. if (orderingPositions.at(dest) < orderingPositions.at(source)) { - outlierWeights[edge] = std::abs(edgeWeight.second); + outlierWeights[edgeWeight.first] = std::abs(edgeWeight.second); } else { - outlierWeights[edge] = 0; + outlierWeights[edgeWeight.first] = 0; } } return outlierWeights; -} \ No newline at end of file +}