diff options
Diffstat (limited to 'lib/Numeric/LinearAlgebra/Tests')
-rw-r--r-- | lib/Numeric/LinearAlgebra/Tests/Instances.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Numeric/LinearAlgebra/Tests/Instances.hs b/lib/Numeric/LinearAlgebra/Tests/Instances.hs index 6046ccb..804c481 100644 --- a/lib/Numeric/LinearAlgebra/Tests/Instances.hs +++ b/lib/Numeric/LinearAlgebra/Tests/Instances.hs | |||
@@ -1,4 +1,4 @@ | |||
1 | {-# LANGUAGE FlexibleContexts, UndecidableInstances, CPP #-} | 1 | {-# LANGUAGE FlexibleContexts, UndecidableInstances, CPP, FlexibleInstances #-} |
2 | {-# OPTIONS_GHC -fno-warn-unused-imports #-} | 2 | {-# OPTIONS_GHC -fno-warn-unused-imports #-} |
3 | ----------------------------------------------------------------------------- | 3 | ----------------------------------------------------------------------------- |
4 | {- | | 4 | {- | |
@@ -135,10 +135,14 @@ instance (Field a, Arbitrary a, Num (Vector a)) => Arbitrary (Her a) where | |||
135 | coarbitrary = undefined | 135 | coarbitrary = undefined |
136 | #endif | 136 | #endif |
137 | 137 | ||
138 | class (Field a, Arbitrary a, Element (RealOf a), Random (RealOf a)) => ArbitraryField a | ||
139 | instance ArbitraryField Double | ||
140 | instance ArbitraryField (Complex Double) | ||
141 | |||
138 | 142 | ||
139 | -- a well-conditioned general matrix (the singular values are between 1 and 100) | 143 | -- a well-conditioned general matrix (the singular values are between 1 and 100) |
140 | newtype (WC a) = WC (Matrix a) deriving Show | 144 | newtype (WC a) = WC (Matrix a) deriving Show |
141 | instance (Convert a, Field a, Arbitrary a, Random (RealOf a)) => Arbitrary (WC a) where | 145 | instance (ArbitraryField a) => Arbitrary (WC a) where |
142 | arbitrary = do | 146 | arbitrary = do |
143 | m <- arbitrary | 147 | m <- arbitrary |
144 | let (u,_,v) = svd m | 148 | let (u,_,v) = svd m |
@@ -157,7 +161,7 @@ instance (Convert a, Field a, Arbitrary a, Random (RealOf a)) => Arbitrary (WC a | |||
157 | 161 | ||
158 | -- a well-conditioned square matrix (the singular values are between 1 and 100) | 162 | -- a well-conditioned square matrix (the singular values are between 1 and 100) |
159 | newtype (SqWC a) = SqWC (Matrix a) deriving Show | 163 | newtype (SqWC a) = SqWC (Matrix a) deriving Show |
160 | instance (Convert a, Field a, Arbitrary a, Random (RealOf a)) => Arbitrary (SqWC a) where | 164 | instance (ArbitraryField a) => Arbitrary (SqWC a) where |
161 | arbitrary = do | 165 | arbitrary = do |
162 | Sq m <- arbitrary | 166 | Sq m <- arbitrary |
163 | let (u,_,v) = svd m | 167 | let (u,_,v) = svd m |
@@ -174,7 +178,7 @@ instance (Convert a, Field a, Arbitrary a, Random (RealOf a)) => Arbitrary (SqWC | |||
174 | 178 | ||
175 | -- a positive definite square matrix (the eigenvalues are between 0 and 100) | 179 | -- a positive definite square matrix (the eigenvalues are between 0 and 100) |
176 | newtype (PosDef a) = PosDef (Matrix a) deriving Show | 180 | newtype (PosDef a) = PosDef (Matrix a) deriving Show |
177 | instance (Convert a, Field a, Arbitrary a, Num (Vector a), Random (RealOf a)) | 181 | instance (ArbitraryField a, Num (Vector a)) |
178 | => Arbitrary (PosDef a) where | 182 | => Arbitrary (PosDef a) where |
179 | arbitrary = do | 183 | arbitrary = do |
180 | Her m <- arbitrary | 184 | Her m <- arbitrary |