hmatrix 0.18.1.0 → 0.18.2.0
raw patch · 10 files changed
+72/−24 lines, 10 filesdep +semigroupsdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: semigroups
Dependency ranges changed: base
API changes (from Hackage documentation)
- Numeric.LinearAlgebra.Static: instance (GHC.TypeLits.KnownNat m, GHC.TypeLits.KnownNat n) => Internal.Util.Normed (Internal.Static.L m n)
- Numeric.LinearAlgebra.Static: instance (GHC.TypeLits.KnownNat n', GHC.TypeLits.KnownNat m') => Internal.Numeric.Testable (Internal.Static.L n' m')
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => GHC.Float.Floating (Numeric.LinearAlgebra.Static.Sym n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => GHC.Num.Num (Numeric.LinearAlgebra.Static.Sym n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => GHC.Real.Fractional (Numeric.LinearAlgebra.Static.Sym n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => GHC.Show.Show (Numeric.LinearAlgebra.Static.Sym n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Internal.Numeric.Additive (Numeric.LinearAlgebra.Static.Sym n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Internal.Numeric.Transposable (Numeric.LinearAlgebra.Static.Her n) (Numeric.LinearAlgebra.Static.Her n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Internal.Numeric.Transposable (Numeric.LinearAlgebra.Static.Sym n) (Numeric.LinearAlgebra.Static.Sym n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Internal.Static.Disp (Numeric.LinearAlgebra.Static.Her n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Internal.Static.Disp (Numeric.LinearAlgebra.Static.Sym n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Internal.Util.Normed (Internal.Static.R n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Numeric.LinearAlgebra.Static.Diag (Internal.Static.L n n) (Internal.Static.R n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Numeric.LinearAlgebra.Static.Diag (Internal.Static.M n n) (Internal.Static.C n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Numeric.LinearAlgebra.Static.Eigen (Numeric.LinearAlgebra.Static.Sq n) (Internal.Static.C n) (Internal.Static.M n n)
- Numeric.LinearAlgebra.Static: instance GHC.TypeLits.KnownNat n => Numeric.LinearAlgebra.Static.Eigen (Numeric.LinearAlgebra.Static.Sym n) (Internal.Static.R n) (Internal.Static.L n n)
+ Numeric.LinearAlgebra.Static: instance (GHC.TypeNats.KnownNat m, GHC.TypeNats.KnownNat n) => Internal.Util.Normed (Internal.Static.L m n)
+ Numeric.LinearAlgebra.Static: instance (GHC.TypeNats.KnownNat n', GHC.TypeNats.KnownNat m') => Internal.Numeric.Testable (Internal.Static.L n' m')
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => GHC.Float.Floating (Numeric.LinearAlgebra.Static.Sym n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => GHC.Num.Num (Numeric.LinearAlgebra.Static.Sym n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => GHC.Real.Fractional (Numeric.LinearAlgebra.Static.Sym n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => GHC.Show.Show (Numeric.LinearAlgebra.Static.Sym n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Internal.Numeric.Additive (Numeric.LinearAlgebra.Static.Sym n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Internal.Numeric.Transposable (Numeric.LinearAlgebra.Static.Her n) (Numeric.LinearAlgebra.Static.Her n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Internal.Numeric.Transposable (Numeric.LinearAlgebra.Static.Sym n) (Numeric.LinearAlgebra.Static.Sym n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Internal.Static.Disp (Numeric.LinearAlgebra.Static.Her n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Internal.Static.Disp (Numeric.LinearAlgebra.Static.Sym n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Internal.Util.Normed (Internal.Static.R n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Numeric.LinearAlgebra.Static.Diag (Internal.Static.L n n) (Internal.Static.R n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Numeric.LinearAlgebra.Static.Diag (Internal.Static.M n n) (Internal.Static.C n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Numeric.LinearAlgebra.Static.Eigen (Numeric.LinearAlgebra.Static.Sq n) (Internal.Static.C n) (Internal.Static.M n n)
+ Numeric.LinearAlgebra.Static: instance GHC.TypeNats.KnownNat n => Numeric.LinearAlgebra.Static.Eigen (Numeric.LinearAlgebra.Static.Sym n) (Internal.Static.R n) (Internal.Static.L n n)
- Numeric.LinearAlgebra: class Testable t where ioCheckT = return . checkT
+ Numeric.LinearAlgebra: class Testable t
- Numeric.LinearAlgebra: linearSolve :: Field t => Matrix t -> Matrix t -> Maybe (Matrix t)
+ Numeric.LinearAlgebra: linearSolve :: Field t => Matrix t -> Matrix t -> Maybe Matrix t
- Numeric.LinearAlgebra: luPacked' :: (Num (Vector t), Normed (Vector t), Container Vector t, Fractional t) => Matrix t -> LU t
+ Numeric.LinearAlgebra: luPacked' :: (Num Vector t, Normed Vector t, Container Vector t, Fractional t) => Matrix t -> LU t
- Numeric.LinearAlgebra: luSolve' :: (Container Vector t, Fractional t) => LU t -> Matrix t -> Matrix t
+ Numeric.LinearAlgebra: luSolve' :: (Fractional t, Container Vector t) => LU t -> Matrix t -> Matrix t
- Numeric.LinearAlgebra.Data: infixl 9 `¿`
+ Numeric.LinearAlgebra.Data: infixl 9 ¿
- Numeric.LinearAlgebra.Data: loadMatrix' :: FilePath -> IO (Maybe (Matrix Double))
+ Numeric.LinearAlgebra.Data: loadMatrix' :: FilePath -> IO Maybe Matrix Double
- Numeric.LinearAlgebra.Devel: class TransArray c where type Trans c b type TransRaw c b where {
+ Numeric.LinearAlgebra.Devel: class TransArray c where {
- Numeric.LinearAlgebra.Devel: extractMatrix :: Element a => STMatrix t a -> RowRange -> ColRange -> ST s (Matrix a)
+ Numeric.LinearAlgebra.Devel: extractMatrix :: Element a => STMatrix s1 a -> RowRange -> ColRange -> ST s2 Matrix a
- Numeric.LinearAlgebra.Devel: foldLoop :: (Int -> t -> t) -> t -> Int -> t
+ Numeric.LinearAlgebra.Devel: foldLoop :: () => (Int -> t -> t) -> t -> Int -> t
- Numeric.LinearAlgebra.Devel: foldVectorG :: Storable t1 => (Int -> (Int -> t1) -> t -> t) -> t -> Vector t1 -> t
+ Numeric.LinearAlgebra.Devel: foldVectorG :: Storable t1 => (Int -> (Int -> t1) -> t2 -> t2) -> t2 -> Vector t1 -> t2
- Numeric.LinearAlgebra.HMatrix: infixl 2 `——`
+ Numeric.LinearAlgebra.HMatrix: infixl 2 ——
- Numeric.LinearAlgebra.HMatrix: infixr 8 `<·>`
+ Numeric.LinearAlgebra.HMatrix: infixr 8 <·>
- Numeric.LinearAlgebra.Static: (<.>) :: R n -> R n -> ℝ
+ Numeric.LinearAlgebra.Static: (<.>) :: KnownNat n => R n -> R n -> ℝ
- Numeric.LinearAlgebra.Static: (<·>) :: R n -> R n -> ℝ
+ Numeric.LinearAlgebra.Static: (<·>) :: KnownNat n => R n -> R n -> ℝ
- Numeric.LinearAlgebra.Static: (|||) :: (KnownNat r2, KnownNat r1, KnownNat ((+) r1 r2), KnownNat c) => L c r1 -> L c r2 -> L c ((+) r1 r2)
+ Numeric.LinearAlgebra.Static: (|||) :: (KnownNat r2, KnownNat r1, KnownNat (+) r1 r2, KnownNat c) => L c r1 -> L c r2 -> L c (+) r1 r2
- Numeric.LinearAlgebra.Static: dot :: forall n. (Domain field vec mat, KnownNat n) => vec n -> vec n -> field
+ Numeric.LinearAlgebra.Static: dot :: forall n. (Domain field vec mat, (KnownNat n)) => vec n -> vec n -> field
- Numeric.LinearAlgebra.Static: infixr 8 `<·>`
+ Numeric.LinearAlgebra.Static: infixr 8 <·>
Files
- THANKS.md +4/−2
- hmatrix.cabal +23/−12
- src/Internal/Container.hs +4/−1
- src/Internal/Convolution.hs +4/−0
- src/Internal/Modular.hs +8/−0
- src/Internal/Util.hs +4/−0
- src/Numeric/LinearAlgebra.hs +4/−0
- src/Numeric/LinearAlgebra/HMatrix.hs +4/−0
- src/Numeric/LinearAlgebra/Static.hs +9/−9
- src/Numeric/Matrix.hs +8/−0
THANKS.md view
@@ -160,7 +160,7 @@ - Denis Laxalde separated the gsl tests from the base ones. - Dominic Steinitz (idontgetoutmuch) reported a bug in the static diagonal creation functions and- added Cholesky to Static. He also added support for tridiagonal matrix solver.+ added Cholesky to Static. He also added support for tridiagonal matrix solver and fixed several bugs. - Dylan Thurston reported an error in the glpk documentation and ambiguity in the description of linearSolve.@@ -171,7 +171,7 @@ - Ian Ross reported the max/minIndex bug. - Niklas Hambüchen improved the documentation and fixed compilation with GHC-8.2- adding type signatures.+ adding type signatures. Added disable-default-paths flag. - "erdeszt" optimized "conv" using a direct vector reverse. @@ -231,4 +231,6 @@ - "fedeinthemix" suggested a better name and a more general type for unitary. - Huw Campbell fixed a bug in equal.++- Hiromi Ishii fixed compilation problems for ghc-8.4
hmatrix.cabal view
@@ -1,5 +1,5 @@ Name: hmatrix-Version: 0.18.1.0+Version: 0.18.2.0 License: BSD3 License-file: LICENSE Author: Alberto Ruiz@@ -16,7 +16,7 @@ Code examples: <http://dis.um.es/~alberto/hmatrix/hmatrix.html> Category: Math-tested-with: GHC==8.0+tested-with: GHC==8.2, GHC==8.4 cabal-version: >=1.8 @@ -31,6 +31,11 @@ default: False manual: True +flag disable-default-paths+ description: When enabled, don't add default hardcoded include/link dirs by default. Needed for hermetic builds like in nix.+ default: False+ manual: True+ library Build-Depends: base >= 4.8 && < 5,@@ -41,6 +46,7 @@ split, bytestring, storable-complex,+ semigroups, vector >= 0.8 hs-source-dirs: src@@ -95,29 +101,33 @@ if os(OSX) if flag(openblas)- extra-lib-dirs: /opt/local/lib/openblas/lib+ if !flag(disable-default-paths)+ extra-lib-dirs: /opt/local/lib/openblas/lib extra-libraries: openblas else extra-libraries: blas lapack - extra-lib-dirs: /opt/local/lib/- include-dirs: /opt/local/include/- extra-lib-dirs: /usr/local/lib/- include-dirs: /usr/local/include/+ if !flag(disable-default-paths)+ extra-lib-dirs: /opt/local/lib/+ include-dirs: /opt/local/include/+ extra-lib-dirs: /usr/local/lib/+ include-dirs: /usr/local/include/ if arch(i386) cc-options: -arch i386 frameworks: Accelerate if os(freebsd) if flag(openblas)- extra-lib-dirs: /usr/local/lib/openblas/lib+ if !flag(disable-default-paths)+ extra-lib-dirs: /usr/local/lib/openblas/lib extra-libraries: openblas else extra-libraries: blas lapack - extra-lib-dirs: /usr/local/lib- include-dirs: /usr/local/include- extra-libraries: gfortran+ if !flag(disable-default-paths)+ extra-lib-dirs: /usr/local/lib+ include-dirs: /usr/local/include+ extra-libraries: gfortran if os(windows) if flag(openblas)@@ -127,7 +137,8 @@ if os(linux) if flag(openblas)- extra-lib-dirs: /usr/lib/openblas/lib+ if !flag(disable-default-paths)+ extra-lib-dirs: /usr/lib/openblas/lib extra-libraries: openblas else extra-libraries: blas lapack
src/Internal/Container.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -29,7 +30,9 @@ import Internal.Element import Internal.Numeric import Internal.Algorithms(Field,linearSolveSVD,Herm,mTm)-+#if MIN_VERSION_base(4,11,0)+import Prelude hiding ((<>))+#endif ------------------------------------------------------------------ {- | Creates a real vector containing a range of values:
src/Internal/Convolution.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} ----------------------------------------------------------------------------- {- |@@ -23,6 +24,9 @@ import Internal.Element import Internal.Conversion import Internal.Container+#if MIN_VERSION_base(4,11,0)+import Prelude hiding ((<>))+#endif vectSS :: Element t => Int -> Vector t -> Matrix t
src/Internal/Modular.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}@@ -38,13 +39,20 @@ gaussElim, gaussElim_1, gaussElim_2, luST, luSolve', luPacked', magnit, invershur) import Internal.ST(mutable)+#if MIN_VERSION_base(4,11,0)+import GHC.TypeLits hiding (Mod)+#else import GHC.TypeLits+#endif import Data.Proxy(Proxy) import Foreign.ForeignPtr(castForeignPtr) import Foreign.Storable import Data.Ratio import Data.Complex import Control.DeepSeq ( NFData(..) )+#if MIN_VERSION_base(4,11,0)+import Prelude hiding ((<>))+#endif
src/Internal/Util.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -80,6 +81,9 @@ import Data.Complex import Data.Function(on) import Internal.ST+#if MIN_VERSION_base(4,11,0)+import Prelude hiding ((<>))+#endif type ℝ = Double type ℕ = Int
src/Numeric/LinearAlgebra.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} -----------------------------------------------------------------------------@@ -190,6 +191,9 @@ import Internal.Sparse((!#>)) import Internal.CG import Internal.Conversion+#if MIN_VERSION_base(4,11,0)+import Prelude hiding ((<>))+#endif {- | dense matrix product
src/Numeric/LinearAlgebra/HMatrix.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -------------------------------------------------------------------------------- {- | Module : Numeric.LinearAlgebra.HMatrix@@ -19,6 +20,9 @@ import Numeric.LinearAlgebra import Internal.Util import Internal.Algorithms(cholSH, mbCholSH, eigSH', eigenvaluesSH', geigSH')+#if MIN_VERSION_base(4,11,0)+import Prelude hiding ((<>))+#endif infixr 8 <·> (<·>) :: Numeric t => Vector t -> Vector t -> t
src/Numeric/LinearAlgebra/Static.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}@@ -80,6 +81,9 @@ import Text.Printf import Data.Type.Equality ((:~:)(Refl)) import qualified Data.Bifunctor as BF (first)+#if MIN_VERSION_base(4,11,0)+import Prelude hiding ((<>))+#endif ud1 :: R n -> Vector ℝ ud1 (R (Dim v)) = v@@ -214,11 +218,11 @@ infixr 8 <·>-(<·>) :: R n -> R n -> ℝ+(<·>) :: KnownNat n => R n -> R n -> ℝ (<·>) = dotR infixr 8 <.>-(<.>) :: R n -> R n -> ℝ+(<.>) :: KnownNat n => R n -> R n -> ℝ (<.>) = dotR --------------------------------------------------------------------------------@@ -601,10 +605,8 @@ appR m v = mkR (extract m LA.#> extract v) -dotR :: R n -> R n -> ℝ-dotR (ud1 -> u) (ud1 -> v)- | singleV u || singleV v = sumElements (u * v)- | otherwise = udot u v+dotR :: KnownNat n => R n -> R n -> ℝ+dotR (extract -> u) (extract -> v) = LA.dot u v crossR :: R 3 -> R 3 -> R 3@@ -667,9 +669,7 @@ dotC :: KnownNat n => C n -> C n -> ℂ-dotC (unwrap -> u) (unwrap -> v)- | singleV u || singleV v = sumElements (conj u * v)- | otherwise = u LA.<.> v+dotC (extract -> u) (extract -> v) = LA.dot u v crossC :: C 3 -> C 3 -> C 3
src/Numeric/Matrix.hs view
@@ -32,8 +32,11 @@ import Internal.Numeric import qualified Data.Monoid as M import Data.List(partition)+import qualified Data.Foldable as F+import qualified Data.Semigroup as S import Internal.Chain + ------------------------------------------------------------------- instance Container Matrix a => Eq (Matrix a) where@@ -83,6 +86,11 @@ | isScalar x = f1 (x @@>(0,0) ) y | isScalar y = f3 x (y @@>(0,0) ) | otherwise = f2 x y++instance (Container Vector t, Eq t, Num (Vector t), Product t) => S.Semigroup (Matrix t)+ where+ (<>) = mappend+ sconcat = mconcat . F.toList instance (Container Vector t, Eq t, Num (Vector t), Product t) => M.Monoid (Matrix t) where