[BGL] predecessor map from a view on a multi_array

Hi, I'm currently using MSVC9 and the code listed below doesn't compile,
instead producing the following errors and warnings:
Warning 1 warning C4100: 'x' : unreferenced formal parameter
c:\program files\boost\boost_1_41_0\boost\concept\detail\msvc.hpp 20 test
Warning 2 warning C4100: 'id' : unreferenced formal parameter
c:\program
files\boost\boost_1_41_0\boost\graph\dag_shortest_paths.hpp 86 test
Error 3 error C2440: '<function-style-cast>' : cannot convert from
'int' to 'D' c:\program files\microsoft visual studio
9.0\vc\include\limits 109 test
I know MSVC has issues with named parameters among other things, but I
haven't been able to get it to compile with the non-named-parameters
overload either, in this instance.
What am I misusing and how am I misusing it? Also, I get the impression
that the default combiner/comparer may be unsafe for floating-point
comparisons and addition (with respect to over/underflow and comparing
floating point values, I seem to recall it being a good idea never to
compare with direct equalities, eg. x == infinity because of rounding
issues). Might it be a good idea to further specialize appropriate areas
of the algorithm code to account for this, or am I
over-generalizing(specializing?)? How about a specialized closed_plus<>
in relax.hpp which makes the comparisons more safely for floats and
doubles (since both parameters "a" and "b" of closed_plus must be of
type T anyway)?
#include

On Mon, 1 Feb 2010, Geoff Hilton wrote:
Do you have an instantiation stack for this? I can't see how it relates to BGL otherwise.
I know there have been issues with things like load(store(a + b)) != a + b before (due to rounding issues). I believe comparison to infinity is safe, though, since that is a special value; checking online seems to suggest that there is only one bit pattern for each infinity. std::plus<double> should work since the CPU should handle infinity as a special case. Even if the comparisons in closed_plus always return false, the code should still work for float and double.
What comparisons need to be safer? Just comparison to infinity?
Is this the erroring code? What errors do you get from it? -- Jeremiah Willcock

On 03/02/2010 1:59 PM, Jeremiah Willcock wrote:
Hi and thanks for your much appreciated response. I should have simply sent you the build log as attached this time around, sorry!
All of them I suppose including addition/subtraction/etc, though I'm no numerical analyst, but I imagine that comparisons need to be checked against a minimal margin of error to ensure they are relatively "equal" as opposed to(or in addition to) *actually* "less than" or "greater than". After some reading I think this may require the specification of a level of precision for accuracy, but then we get into floating point computation to which there are whole libraries devoted (eg. MPFR[1] is the only one I've found, but C++ wrappers are all very outdated or wrap versions other than the most recent). Ideally, it would be nice if there were a maintained boost wrapper for such a library, but that may just be a pipe dream unless someone volunteers.
Yes the above code causes the mentioned warnings and errors.
I've since gotten it to compile by working with it as a bundled property
but because of the nature of bundled properties I had to use a struct
wrapper such that the resulting types look as follows:
struct EdgeProperty {
float value;
};
typedef boost::adjacency_list

On Thu, 4 Feb 2010, Geoff Hilton wrote:
Are you providing a distance map? It appears that there isn't one provided to dag_shortest_paths.
Are there other equality comparisons other than the one to infinity? Most of the inequality comparisons should be safe as they only assume things like that x + y >= x whenever x >= 0 and y >= 0, which I believe is always true (though x + y > x when y > 0 is not always true).
There is no distance map being provided, and the algorithm requires one to be explicitly provided.
Why is it an issue? The reason that bundled properties are structs is that you may want to have several properties in your bundle. I do think the thing you're trying to do (passing float as the property) works most of the time, though; use get(edge_bundle, g) to get that map.
How do you know that the property the user wants to define is the weight? What about the color, edge capacity, ...? Old-style properties are good for that. -- Jeremiah Willcock
participants (2)
-
Geoff Hilton
-
Jeremiah Willcock