sparse-linear-algebra 0.2.9.6 → 0.2.9.7
raw patch · 6 files changed
+39/−27 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- sparse-linear-algebra.cabal +1/−1
- src/Control/Exception/Common.hs +3/−7
- src/Data/Sparse/SpMatrix.hs +3/−3
- src/Numeric/Eps.hs +4/−2
- src/Numeric/LinearAlgebra/Class.hs +2/−2
- src/Numeric/LinearAlgebra/Sparse.hs +26/−12
sparse-linear-algebra.cabal view
@@ -1,5 +1,5 @@ name: sparse-linear-algebra-version: 0.2.9.6+version: 0.2.9.7 synopsis: Numerical computation in native Haskell description: /Overview/
src/Control/Exception/Common.hs view
@@ -8,15 +8,14 @@ import Data.Sparse.Utils -+-- | Errors associated with partial functions data PartialFunctionError = EmptyList String deriving (Eq, Typeable) instance Show PartialFunctionError where show (EmptyList s) = unwords [s, ": empty list"] instance Exception PartialFunctionError --- | Input error-+-- | Input errors data InputError = NonNegError String Int deriving (Eq, Typeable) instance Show InputError where show (NonNegError s i) = unwords [s, ": parameter must be nonnegative, instead I got", show i]@@ -24,7 +23,7 @@ --- | Out of bounds index error+-- | Out of bounds index errors data OutOfBoundsIndexError i = OOBIxError String i | OOBIxsError String [i] | OOBNoCompatRows String (i,i) deriving (Eq, Typeable)@@ -61,9 +60,6 @@ show (HugeConditionNumber s x) = unwords [s, ": Rank-deficient system: condition number", show x] show (NeedsPivoting s1 s2) = unwords [s1, ":", s2, "is close to 0. Permute the rows to obtain a nonzero diagonal"] instance (Show i, Typeable i) => Exception (MatrixException i)---
src/Data/Sparse/SpMatrix.hs view
@@ -794,7 +794,7 @@ -- ** Matrix-matrix product, sparsified--- | Removes all elements `x` for which `| x | <= eps`)+-- | After multiplying the two matrices, all elements `x` for which `| x | <= eps` are removed. matMatSparsified, (#~#) :: (MatrixRing (SpMatrix a), Epsilon a) => SpMatrix a -> SpMatrix a -> SpMatrix a matMatSparsified m1 m2 = sparsifySM $ m1 ## m2@@ -806,13 +806,13 @@ -- *** Sparsified matrix products of two matrices --- | A^T B+-- | Sparsifying A^T B (#~#^) :: (MatrixRing (SpMatrix a), Epsilon a) => SpMatrix a -> SpMatrix a -> SpMatrix a a #~^# b = transpose a #~# b --- | A B^T+-- | Sparsifying A B^T (#~^#) :: (MatrixRing (SpMatrix a), Epsilon a) => SpMatrix a -> SpMatrix a -> SpMatrix a a #~#^ b = a #~# transpose b
src/Numeric/Eps.hs view
@@ -50,17 +50,19 @@ nearZero a = abs a <= 1e-12 --- | Complex types-+-- | @'magnitude' a '<=' 1e-6@ instance Epsilon (Complex Float) where nearZero a = magnitude a <= 1e-6 +-- | @'magnitude' a '<=' 1e-12@ instance Epsilon (Complex Double) where nearZero a = magnitude a <= 1e-12 +-- | @'magnitude' a '<=' 1e-6@ instance Epsilon (Complex CFloat) where nearZero a = magnitude a <= 1e-6 +-- | @'magnitude' a '<=' 1e-12@ instance Epsilon (Complex CDouble) where nearZero a = magnitude a <= 1e-12
src/Numeric/LinearAlgebra/Class.hs view
@@ -218,9 +218,9 @@ type MatrixNorm m :: * -- | Matrix-matrix product (##) :: m -> m -> m- -- | A B^T+ -- | Matrix times matrix transpose (A B^T) (##^) :: m -> m -> m- -- | A^T B+ -- | Matrix transpose times matrix (A^T B) (#^#) :: m -> m -> m a #^# b = transpose a ## b -- | Matrix transpose (Hermitian conjugate in the Complex case)
src/Numeric/LinearAlgebra/Sparse.hs view
@@ -228,15 +228,24 @@ --- | Givens' method, row version: given a row, column pair (i,j), choose a row index i' distinct from i such that :--- * i' is below the diagonal--- * the corresponding element is nonzero--- To zero out entry A(i, j) we must find row k such that A(k, j) is non-zero but A has zeros in row k for all column indices < j.--- NB: The Givens' matrix differs from Identity in 4 entries (geometrically, it is a planar rotation embedded in R^n)--- NB2: The form of a Complex rotation matrix is as follows (`*` indicates complex conjugation):--- ( c s )--- G =( )--- ( -s* c*)+{- $givens+Givens' method, row version: given a row, column pair (i,j), choose a row index i' distinct from i such that :++* i' is below the diagonal++* the corresponding element is nonzero++To zero out entry A(i, j) we must find row k such that A(k, j) is non-zero but A has zeros in row k for all column indices < j.+NB: The Givens' matrix differs from Identity in 4 entries (geometrically, it is a planar rotation embedded in R^n)+NB2: The form of a Complex rotation matrix is as follows (`*` indicates complex conjugation):++@+ ( c s )+ G =( )+ ( -s* c*)+@++-} {-# inline givens #-} givens :: (Elt a, MonadThrow m) => SpMatrix a -> IxRow -> IxCol -> m (SpMatrix a) givens aa i j @@ -973,9 +982,14 @@ -- -- TFQMR is in LinearSolvers.Experimental for now -- | Iterative methods for linear systems-data LinSolveMethod = GMRES_ | CGNE_ | BCG_ | CGS_ | BICGSTAB_ deriving (Eq, Show)+data LinSolveMethod = GMRES_ -- ^ Generalized Minimal RESidual + | CGNE_ -- ^ Conjugate Gradient on the Normal Equations+ | BCG_ -- ^ BiConjugate Gradient+ | CGS_ -- ^ Conjugate Gradient Squared+ | BICGSTAB_ -- ^ BiConjugate Gradient Stabilized+ deriving (Eq, Show) --- | Interface method to individual linear solvers, do not use directly+-- | Interface method to individual linear solvers linSolve0 method aa b x0 | m /= nb = throwM (MatVecSizeMismatchException "linSolve0" dm nb) | otherwise = solve aa b where@@ -1000,7 +1014,7 @@ --- -- -- | linSolve using the GMRES method as default+-- | <\> uses the GMRES method as default instance LinearSystem (SpVector Double) where aa <\> b = linSolve0 GMRES_ aa b (mkSpVR n $ replicate n 0.1) where n = ncols aa