|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54739 - trunk/boost/graph/distributed
From: ngedmond_at_[hidden]
Date: 2009-07-06 21:17:30
Author: ngedmond
Date: 2009-07-06 21:17:30 EDT (Mon, 06 Jul 2009)
New Revision: 54739
URL: http://svn.boost.org/trac/boost/changeset/54739
Log:
Removed x87 floating point hack as its in relax() now
Text files modified:
trunk/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
Modified: trunk/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp
==============================================================================
--- trunk/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp (original)
+++ trunk/boost/graph/distributed/eager_dijkstra_shortest_paths.hpp 2009-07-06 21:17:30 EDT (Mon, 06 Jul 2009)
@@ -113,10 +113,20 @@
boost::parallel::caching_property_map<PredecessorMap> c_pred(m_predecessor);
boost::parallel::caching_property_map<DistanceMap> c_dist(m_distance);
+ distance_type old_distance = get(c_dist, target(e, g));
+
bool m_decreased = relax(e, g, m_weight, c_pred, c_dist,
m_combine, m_compare);
- if (m_decreased) {
+ /* On x86 Linux with optimization, we sometimes get into a
+ horrible case where m_decreased is true but the distance hasn't
+ actually changed. This occurs when the comparison inside
+ relax() occurs with the 80-bit precision of the x87 floating
+ point unit, but the difference is lost when the resulting
+ values are written back to lower-precision memory (e.g., a
+ double). With the eager Dijkstra's implementation, this results
+ in looping. */
+ if (m_decreased && old_distance != get(c_dist, target(e, g))) {
m_Q.update(target(e, g));
m_vis.edge_relaxed(e, g);
} else
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk