summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesCook <>2012-01-03 17:49:46 (GMT)
committerhdiff <hdiff@luite.com>2012-01-03 17:49:46 (GMT)
commitf26ccfb359fd23c95c1d6a26b0c282aa3f1984f6 (patch)
tree84891c95b157bfe10a82067bc4f7078c6f0711b7
parent826f600284576a29fe1d68635ddadb12668aa261 (diff)
version 0.1.1.10.1.1.1
-rw-r--r--roots.cabal9
-rw-r--r--src/Math/Root/Bracket.hs6
-rw-r--r--src/Math/Root/Finder/Bisection.hs2
3 files changed, 11 insertions, 6 deletions
diff --git a/roots.cabal b/roots.cabal
index 8fb3846..daa7366 100644
--- a/roots.cabal
+++ b/roots.cabal
@@ -1,5 +1,5 @@
name: roots
-version: 0.1.1.0
+version: 0.1.1.1
stability: experimental
cabal-version: >= 1.6
@@ -14,10 +14,15 @@ category: Math, Numerical
synopsis: Root-finding algorithms (1-dimensional)
description: Framework for and a few implementations of
(1-dimensional) numerical root-finding algorithms.
+ .
+ Changes in 0.1.1.1: Added Eq contexts where necessary to
+ build on GHC 7.4
tested-with: GHC == 6.8.3,
GHC == 6.10.4,
- GHC == 6.12.1, GHC == 6.12.3
+ GHC == 6.12.1, GHC == 6.12.3,
+ GHC == 7.0.4, GHC == 7.2.2,
+ GHC == 7.4.1-rc1
source-repository head
type: git
diff --git a/src/Math/Root/Bracket.hs b/src/Math/Root/Bracket.hs
index be7bc5b..c57b2bf 100644
--- a/src/Math/Root/Bracket.hs
+++ b/src/Math/Root/Bracket.hs
@@ -3,7 +3,7 @@ module Math.Root.Bracket where
-- |Predicate that returns 'True' whenever the given pair of points brackets
-- a root of the given function.
-brackets :: (Eq a, Num b) => (a -> b) -> (a,a) -> Bool
+brackets :: (Eq a, Eq b, Num b) => (a -> b) -> (a,a) -> Bool
brackets f (x1,x2)
| x1 == x2 = f x1 == 0
| otherwise = signum (f x1) /= signum (f x2)
@@ -12,7 +12,7 @@ brackets f (x1,x2)
-- this function expands the range geometrically until a root is bracketed by
-- the returned values, returning a list of the successively expanded ranges.
-- The list will be finite if and only if the sequence yields a bracketing pair.
-bracket :: (Fractional a, Num b, Ord b) =>
+bracket :: (Fractional a, Eq a, Num b, Ord b) =>
(a -> b) -> a -> a -> [(a, a)]
bracket f x1 x2
| x1 == x2 = error "bracket: empty range"
@@ -32,7 +32,7 @@ bracket f x1 x2
-- [x1,x2], subdivide the interval into n equally spaced segments and search
-- for zero crossings of the function. The returned list will contain all
-- bracketing pairs found.
-subdivideAndBracket :: (Num b, Fractional a, Integral c) =>
+subdivideAndBracket :: (Num b, Eq b, Fractional a, Integral c) =>
(a -> b) -> a -> a -> c -> [(a, a)]
subdivideAndBracket f x1 x2 n =
[ (x1, x2)
diff --git a/src/Math/Root/Finder/Bisection.hs b/src/Math/Root/Finder/Bisection.hs
index 37a2940..155de02 100644
--- a/src/Math/Root/Finder/Bisection.hs
+++ b/src/Math/Root/Finder/Bisection.hs
@@ -11,7 +11,7 @@ import Math.Root.Finder
data Bisect a b = Bisect { _bisX :: !a, _bisF :: !b , _bisDX :: !a }
deriving (Eq, Ord, Show)
-instance (Fractional a, Ord b, Num b) => RootFinder Bisect a b where
+instance (Fractional a, Eq a, Ord b, Num b) => RootFinder Bisect a b where
initRootFinder f x1 x2
| f1 < 0 = Bisect x1 f1 (x2-x1)
| otherwise = Bisect x2 f2 (x1-x2)