Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-09-06 14:22:45


Sylvain Pion <pion_at_[hidden]> writes:

| > | If you get the scalar product, it's not "just to store" anymore.
| >
| > Obviously, storing "just" a data isn't interesting it itself. Is it?
|
| It is not, indeed, and this is exactly my point.
| My view for the "just using to store" is that it is the largest common
| denominator of all reasonnable usages of complex.

Well, reasonable people have different and reasonable opinions on what
is reasonable, so be careful when taking that route.

| For your application, you used std::complex because it made sense to use
| complex as a good tool for doing a few things on 2D points. But the
| lexicographical order on cartesian coordinates (which is a reasonnable total
| order commonly used in computational geometry when you deal with cartesian
| coordinates) that you used for your std::map was related to _this_ particular
| use of complex. And another use of complex might have a better, different
| order which corresponds to the nature of its usage of complex.

Mr Lapalisse won't say the contrary.

However, the point is what makes more sense in practice *and* in the
surrounding framework of the enclosing library (not just IA). Give it
more thought.

| Think at a little higher level of abstraction : think that complex could be
| represented in polar coordinates.

Yes, they could (as a Geometer I can imagine even more models). But,
the existing practice has much more weight than sterile abstractions.

| The lexicographical order on the cartesian
| coordinates would not make any sense for a different application that your
| mapping of points !

You missed the point -- no pun intended. As I explained in another
message, the actual implementation of the ordering was immaterial in
the application (either in polynomial root finders or curvature line
tracing). However, given the actual *representation*, anything other
lexicographical would have been exercise in pure futility -- the
observable behaviour of the program would not have been affected,
however. Don't forget that std::complex<> does use Cartesian
representation.

[...]

| Maybe I'm talking non-sense, but this is how I view this _default_ order
| problem.

Maybe there are other more relevant examples, but the one you gave
lacks connection with the reality: std::complex<> stores Cartesian
coordinates.

[...]

| Also, think that another suitable representation of intervals is :
| (central approximation, epsilon). The lexicographical order on
| (lower, upper) becomes non-sense for that representation.

One point that seems to be confused is that interval is *not* an
abstract datatype. If you use a different representation, it makes
sense to use a different ordering that appears more natural given the
concrete choice.

Don't over-abstract. Or you'll get where we're with std::complex<> --
a perfect example of standard over-abstraction.

-- Gaby


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk