diff options
author | Alberto Ruiz <aruiz@um.es> | 2015-07-21 11:11:49 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2015-07-21 11:11:49 +0200 |
commit | 792864d3ec95d198a751591256c302aed11d8392 (patch) | |
tree | 4e030abf4458d4038586f740d1c95c83eb32354c /packages/tests/src/Numeric | |
parent | 39f2bbe937ccbf786af0a326e7aa065890ee331e (diff) |
change names: Herm, unSym, mTm, and rnf instances
Diffstat (limited to 'packages/tests/src/Numeric')
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs | 13 | ||||
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs index 4704989..3d5441d 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs | |||
@@ -81,8 +81,7 @@ instance (Field a, Arbitrary a) => Arbitrary (Rot a) where | |||
81 | 81 | ||
82 | 82 | ||
83 | -- a complex hermitian or real symmetric matrix | 83 | -- a complex hermitian or real symmetric matrix |
84 | --newtype (Her a) = Her (Matrix a) deriving Show | 84 | instance (Field a, Arbitrary a, Num (Vector a)) => Arbitrary (Herm a) where |
85 | instance (Field a, Arbitrary a, Num (Vector a)) => Arbitrary (Her a) where | ||
86 | arbitrary = do | 85 | arbitrary = do |
87 | Sq m <- arbitrary | 86 | Sq m <- arbitrary |
88 | let m' = m/2 | 87 | let m' = m/2 |
@@ -127,7 +126,7 @@ instance (Numeric a, ArbitraryField a, Num (Vector a)) | |||
127 | arbitrary = do | 126 | arbitrary = do |
128 | m <- arbitrary | 127 | m <- arbitrary |
129 | let (_,v) = eigSH m | 128 | let (_,v) = eigSH m |
130 | n = rows (her m) | 129 | n = rows (unSym m) |
131 | l <- replicateM n (choose (0,100)) | 130 | l <- replicateM n (choose (0,100)) |
132 | let s = diag (fromList l) | 131 | let s = diag (fromList l) |
133 | p = v <> real s <> tr v | 132 | p = v <> real s <> tr v |
@@ -161,8 +160,8 @@ fM m = m :: FM | |||
161 | zM m = m :: ZM | 160 | zM m = m :: ZM |
162 | 161 | ||
163 | 162 | ||
164 | rHer m = her m :: RM | 163 | rHer m = unSym m :: RM |
165 | cHer m = her m :: CM | 164 | cHer m = unSym m :: CM |
166 | 165 | ||
167 | rRot (Rot m) = m :: RM | 166 | rRot (Rot m) = m :: RM |
168 | cRot (Rot m) = m :: CM | 167 | cRot (Rot m) = m :: CM |
@@ -176,8 +175,8 @@ cWC (WC m) = m :: CM | |||
176 | rSqWC (SqWC m) = m :: RM | 175 | rSqWC (SqWC m) = m :: RM |
177 | cSqWC (SqWC m) = m :: CM | 176 | cSqWC (SqWC m) = m :: CM |
178 | 177 | ||
179 | rSymWC (SqWC m) = sym m :: Her R | 178 | rSymWC (SqWC m) = sym m :: Herm R |
180 | cSymWC (SqWC m) = sym m :: Her C | 179 | cSymWC (SqWC m) = sym m :: Herm C |
181 | 180 | ||
182 | rPosDef (PosDef m) = m :: RM | 181 | rPosDef (PosDef m) = m :: RM |
183 | cPosDef (PosDef m) = m :: CM | 182 | cPosDef (PosDef m) = m :: CM |
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs index 2ac3588..720b7bd 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs | |||
@@ -263,7 +263,7 @@ multProp2 p (a,b) = (tr (a <> b)) :~p~: (tr b <> tr a) | |||
263 | 263 | ||
264 | linearSolveProp f m = f m m |~| ident (rows m) | 264 | linearSolveProp f m = f m m |~| ident (rows m) |
265 | 265 | ||
266 | linearSolvePropH f m = f m (her m) |~| ident (rows (her m)) | 266 | linearSolvePropH f m = f m (unSym m) |~| ident (rows (unSym m)) |
267 | 267 | ||
268 | linearSolveProp2 f (a,x) = not wc `trivial` (not wc || a <> f a b |~| b) | 268 | linearSolveProp2 f (a,x) = not wc `trivial` (not wc || a <> f a b |~| b) |
269 | where q = min (rows a) (cols a) | 269 | where q = min (rows a) (cols a) |