Skip to content
This repository
Browse code

Add case for sample which contain same elements

  • Loading branch information...
commit 36f1d08e5ad0f4a1104f157ffdec0dcc01fbf4e4 1 parent 5a86a7e
Aleksey Khudyakov authored September 14, 2012

Showing 1 changed file with 3 additions and 0 deletions. Show diff stats Hide diff stats

  1. 3  Statistics/Sample/KernelDensity.hs
3  Statistics/Sample/KernelDensity.hs
@@ -34,6 +34,8 @@ import Statistics.Transform            (dct, idct)
34 34
 import qualified Data.Vector.Generic as G
35 35
 import qualified Data.Vector.Unboxed as U
36 36
 
  37
+
  38
+
37 39
 -- | Gaussian kernel density estimator for one-dimensional data, using
38 40
 -- the method of Botev et al.
39 41
 --
@@ -53,6 +55,7 @@ kde n0 xs = kde_ n0 (lo - range / 10) (hi + range / 10) xs
53 55
   where
54 56
     (lo,hi) = minMax xs
55 57
     range   | U.length xs <= 1 = 1       -- Unreasonable guess
  58
+            | lo == hi         = 1       -- All elements are equal
56 59
             | otherwise        = hi - lo
57 60
 
58 61
 -- | Gaussian kernel density estimator for one-dimensional data, using

0 notes on commit 36f1d08

Please sign in to comment.
Something went wrong with that request. Please try again.