lapack 0.3 → 0.3.0.1
raw patch · 2 files changed
+9/−6 lines, 2 files
Files
lapack.cabal view
@@ -1,5 +1,5 @@ Name: lapack-Version: 0.3+Version: 0.3.0.1 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -48,7 +48,7 @@ Makefile Source-Repository this- Tag: 0.3+ Tag: 0.3.0.1 Type: darcs Location: http://hub.darcs.net/thielema/lapack/
src/Numeric/LAPACK/Matrix/Plain/Class.hs view
@@ -45,6 +45,9 @@ class (Shape.C shape) => Admissible shape where check :: (Class.Floating a) => Array shape a -> Maybe String +assert :: msg -> Bool -> Maybe msg+assert msg = flip toMaybe msg . not+ instance (Extent.C vert, Extent.C horiz, Shape.C height, Shape.C width) => Admissible (MatrixShape.Full vert horiz height width) where@@ -52,7 +55,7 @@ instance (Shape.C size) => Admissible (MatrixShape.Hermitian size) where check =- flip toMaybe "Hermitian with non-real diagonal" .+ assert "Hermitian with non-real diagonal" . isReal . Triangular.takeDiagonal . Hermitian.takeUpper instance@@ -73,7 +76,7 @@ MatrixShape.Content lo, MatrixShape.TriDiag diag, MatrixShape.Content up) => Triangular.Triangular lo diag up size a -> Maybe String checkUnitDiagonal =- flip toMaybe "Triangular.Unit with non-unit diagonal elements" .+ assert "Triangular.Unit with non-unit diagonal elements" . all (Scalar.equal Scalar.one) . Vector.toList . Triangular.takeDiagonal instance@@ -85,7 +88,7 @@ Banded.mapHeight Shape.Deferred $ Banded.mapWidth Shape.Deferred $ Banded.mapExtent Extent.toGeneral arr0- in flip toMaybe "Banded with non-zero unused elements" $+ in assert "Banded with non-zero unused elements" $ all (Scalar.isZero . (arr!)) $ filter (\ix -> case ix of MatrixShape.InsideBox _ _ -> False; _ -> True) $@@ -97,7 +100,7 @@ check arr = let u = BandedHermitian.takeUpper arr in check u <|>- (flip toMaybe "BandedHermitian with non-real diagonal" .+ (assert "BandedHermitian with non-real diagonal" . isReal . Banded.takeDiagonal $ u) isReal :: (Shape.C sh, Class.Floating a) => Vector sh a -> Bool