From: Michael Orlitzky Date: Tue, 11 Feb 2014 18:16:26 +0000 (-0500) Subject: Add Eq constraints throughout Linear.Iteration. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=f8fe5b7210c35c84193cfcf6c26fd37eac7a1734;p=numerical-analysis.git Add Eq constraints throughout Linear.Iteration. --- diff --git a/src/Linear/Iteration.hs b/src/Linear/Iteration.hs index 06d30a8..6fb279c 100644 --- a/src/Linear/Iteration.hs +++ b/src/Linear/Iteration.hs @@ -41,7 +41,7 @@ import Normed ( Normed(..) ) -- | A generalized implementation for Jacobi, Gauss-Seidel, etc. All -- that we really need to know is how to construct the matrix M, so we -- take a function that does it as an argument. -classical_iteration :: (Field.C a, Arity m) +classical_iteration :: (Eq a, Field.C a, Arity m) => (Mat m m a -> Mat m m a) -> Mat m m a -> Mat m N1 a @@ -60,7 +60,7 @@ classical_iteration m_function matrix b x_current = -- | Perform one iteration of successive over-relaxation. -- sor_iteration :: forall m a. - (Field.C a, Arity m) + (Eq a, Field.C a, Arity m) => a -- ^ Omega -> Mat m m a -- ^ Matrix A -> Mat m N1 a -- ^ Vector b @@ -79,7 +79,7 @@ sor_iteration omega = -- | Compute an infinite list of SOR iterations starting with the -- vector x0. -sor_iterations :: (Field.C a, Arity m) +sor_iterations :: (Eq a, Field.C a, Arity m) => a -> Mat m m a -> Mat m N1 a @@ -90,7 +90,7 @@ sor_iterations omega matrix b = -- | Perform one iteration of Gauss-Seidel. -gauss_seidel_iteration :: (Field.C a, Arity m) +gauss_seidel_iteration :: (Eq a, Field.C a, Arity m) => Mat m m a -> Mat m N1 a -> Mat m N1 a @@ -100,7 +100,7 @@ gauss_seidel_iteration = sor_iteration one -- | Compute an infinite list of Gauss-Seidel iterations starting with -- the vector x0. -gauss_seidel_iterations :: (Field.C a, Arity m) +gauss_seidel_iterations :: (Eq a, Field.C a, Arity m) => Mat m m a -> Mat m N1 a -> Mat m N1 a @@ -126,7 +126,7 @@ gauss_seidel_iterations matrix b = -- >>> jacobi_iteration m b x1 -- ((0.0),(0.25)) -- -jacobi_iteration :: (Field.C a, Arity m) +jacobi_iteration :: (Eq a, Field.C a, Arity m) => Mat m m a -> Mat m N1 a -> Mat m N1 a @@ -137,7 +137,7 @@ jacobi_iteration = -- | Compute an infinite list of Jacobi iterations starting with the -- vector x0. -jacobi_iterations :: (Field.C a, Arity m) +jacobi_iterations :: (Eq a, Field.C a, Arity m) => Mat m m a -> Mat m N1 a -> Mat m N1 a