Created
April 3, 2010 19:21
-
-
Save scvalex/354770 to your computer and use it in GitHub Desktop.
Gaussian elimination on lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PRE: xs is sorted and not null | |
-- POST: r is xs without the elements that vary by | |
-- more than err from the median | |
gausselim ∷ (Num a, Ord a) ⇒ a → [a] → [a] | |
gausselim err xs = filter good xs | |
where | |
middle = xs ‼ (length xs `div` 2) | |
good x = abs (x - middle) < err |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment