probability icon indicating copy to clipboard operation
probability copied to clipboard

Use default comparer for sorting supports in DiscreteHistogram

Open kimsey0 opened this issue 6 years ago • 2 comments

This is for example relevant for StandardDiscreteUniform, which changes from

 0|***************************************
 1|***************************************
 2|**************************************
 3|***************************************
-1|***************************************
-2|***************************************
-3|****************************************

to

-3|****************************************
-2|***************************************
-1|***************************************
 0|***************************************
 1|**************************************
 2|***************************************
 3|**************************************

kimsey0 avatar Feb 19 '19 20:02 kimsey0

This requires, of course, that T implements IComparable. I made the pull request quickly after #1. I'll just fix that.

kimsey0 avatar Feb 19 '19 20:02 kimsey0

There we go. Now it casts to IComparable and defaults to ToLabel. (The check could of course be moved outside of OrderBy to do it fewer times, but it doesn't make much of a difference for the number of samples here.)

kimsey0 avatar Feb 19 '19 20:02 kimsey0