From 192ac5f4b98517862c37ecf161505396ad223cd8 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 2 Oct 2008 15:53:10 +0000 Subject: alternative multiply versions --- lib/Numeric/LinearAlgebra/Tests/Instances.hs | 16 ++++++++++++++++ lib/Numeric/LinearAlgebra/Tests/Properties.hs | 6 +++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'lib/Numeric/LinearAlgebra/Tests') diff --git a/lib/Numeric/LinearAlgebra/Tests/Instances.hs b/lib/Numeric/LinearAlgebra/Tests/Instances.hs index af486c8..e7fecf2 100644 --- a/lib/Numeric/LinearAlgebra/Tests/Instances.hs +++ b/lib/Numeric/LinearAlgebra/Tests/Instances.hs @@ -20,6 +20,7 @@ module Numeric.LinearAlgebra.Tests.Instances( WC(..), rWC,cWC, SqWC(..), rSqWC, cSqWC, PosDef(..), rPosDef, cPosDef, + Consistent(..), rConsist, cConsist, RM,CM, rM,cM ) where @@ -116,6 +117,19 @@ instance (Field a, Arbitrary a) => Arbitrary (PosDef a) where return $ PosDef (0.5 .* p + 0.5 .* ctrans p) coarbitrary = undefined +-- a pair of matrices that can be multiplied +newtype (Consistent a) = Consistent (Matrix a, Matrix a) deriving Show +instance (Field a, Arbitrary a) => Arbitrary (Consistent a) where + arbitrary = do + n <- chooseDim + k <- chooseDim + m <- chooseDim + la <- vector (n*k) + lb <- vector (k*m) + return $ Consistent ((n> c && upperTriang c expmDiagProp m = expm (logm m) :~ 7 ~: complex m where logm m = matFunc log m +multProp1 (a,b) = a <> b |~| mulH a b + +multProp2 (a,b) = trans (a <> b) |~| trans b <> trans a -- cgit v1.2.3