Boost logo

Boost Users :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2007-06-20 09:25:04


Le mercredi 20 juin 2007 à 15:14 +0300, Nikolaos Kavvadias a écrit :

> My question is if it is meaningful (it is for the analysis in mind:) to

It usually is.

> implement a SELECT operator that works on intervals.
> The SELECT operation would be:
>
> -> src1, if cond!=0
> dst <= |
> |
> -> src2, if cond=0

Generally, you have to add a third branch when you can't decide whether
cond == 0 or cond != 0 (in case cond is not degenerate yet it contains
zero). This third branch will store hull(src1, src2) into dst.

> Or better, is it already there, build in the "interval" numeric sublibrary?

No, there is no such operator. But it is not difficult to implement. The
code would look like

        if (cerne(cond, 0)) dst = src1;
        else if (cereq(cond, 0)) dst = src2;
        else dst = hull(src1, src2);
        
("cer" means "certainly", available in compare/explicit.hpp)

Best regards,

Guillaume


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net