[Rivet] MathUtils median falls over empty vector

Holger Schulz holger.schulz at durham.ac.uk
Wed Jul 20 10:01:47 BST 2016


Sound good, I'll try to contact the analysis author and ask him about 
the intended
behaviour.


Holger


On 20/07/16 09:47, Chris Pollard wrote:
> I personally prefer throwing an exception.
>
> Chris
>
> On Wed, Jul 20, 2016 at 9:58 AM, Andy Buckley <andy.buckley at cern.ch 
> <mailto:andy.buckley at cern.ch>> wrote:
>
>     On 19/07/16 23:10, Holger Schulz wrote:
>
>         Hi,
>
>         the Analysis ATLAS_2010_S8914702 calculates the median of a
>         vector<double>
>
>         and currently segfaults if the vector is empty.
>
>
>         I don't know whether we should explicitly check the size of
>         the vector or
>         return 0 in the median function --- not sure if the median of
>         an empty set
>         is well defined though.
>
>
>         What do you think?
>
>
>     Good spot. Thanks for adding protection to the analysis. If we add
>     protection in the median itself, it would need to be either
>     throwing an exception or returning a nan. Both of those would also
>     need a check in the analysis code.
>
>     I'm going to make a few other tweaks to "utils" functions today,
>     which tends to require a full rebuild since those headers are
>     included everywhere. So I may as well do this at the same time...
>     what approach do we prefer?
>
>     Andy
>
>     -- 
>     Dr Andy Buckley, Lecturer / Royal Society University Research Fellow
>     Particle Physics Expt Group, University of Glasgow
>
>     _______________________________________________
>     Rivet mailing list
>     Rivet at projects.hepforge.org <mailto:Rivet at projects.hepforge.org>
>     https://www.hepforge.org/lists/listinfo/rivet
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20160720/35b24518/attachment.html>


More information about the Rivet mailing list