packages feed

hmatrix 0.16.0.4 → 0.16.0.5

raw patch · 8 files changed

+84/−13 lines, 8 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Numeric.LinearAlgebra.Static: (#) :: (KnownNat n, KnownNat m) => R n -> R m -> R (n + m)
+ Numeric.LinearAlgebra.Static: (#>) :: (KnownNat m, KnownNat n) => L m n -> R n -> R m
+ Numeric.LinearAlgebra.Static: (&) :: (KnownNat n, 1 <= n) => R n -> ℝ -> R (n + 1)
+ Numeric.LinearAlgebra.Static: (<>) :: (KnownNat m, KnownNat k, KnownNat n) => L m k -> L k n -> L m n
+ Numeric.LinearAlgebra.Static: (<\>) :: (KnownNat m, KnownNat n, KnownNat r) => L m n -> L m r -> L n r
+ Numeric.LinearAlgebra.Static: (<·>) :: R n -> R n -> ℝ
+ Numeric.LinearAlgebra.Static: (¦) :: (KnownNat ((+) r1 r2), KnownNat r2, KnownNat c, KnownNat r1) => L c r1 -> L c r2 -> L c ((+) r1 r2)
+ Numeric.LinearAlgebra.Static: (——) :: (KnownNat r1, KnownNat r2, KnownNat c) => L r1 c -> L r2 c -> L (r1 + r2) c
+ Numeric.LinearAlgebra.Static: app :: (Domain field vec mat, KnownNat m, KnownNat n) => mat m n -> vec n -> vec m
+ Numeric.LinearAlgebra.Static: blockAt :: (KnownNat m, KnownNat n) => ℝ -> Int -> Int -> Matrix Double -> L m n
+ Numeric.LinearAlgebra.Static: build :: (KnownNat n, KnownNat m) => (ℝ -> ℝ -> ℝ) -> L m n
+ Numeric.LinearAlgebra.Static: class Diag m d | m -> d
+ Numeric.LinearAlgebra.Static: class Disp t
+ Numeric.LinearAlgebra.Static: class Domain field vec mat | mat -> vec field, vec -> mat field, field -> mat vec
+ Numeric.LinearAlgebra.Static: class Eigen m l v | m -> l, m -> v
+ Numeric.LinearAlgebra.Static: class Num t => Sized t s d | s -> t, s -> d
+ Numeric.LinearAlgebra.Static: col :: KnownNat n => R n -> L n 1
+ Numeric.LinearAlgebra.Static: create :: Sized t s d => d t -> Maybe s
+ Numeric.LinearAlgebra.Static: cross :: Domain field vec mat => vec 3 -> vec 3 -> vec 3
+ Numeric.LinearAlgebra.Static: data C n
+ Numeric.LinearAlgebra.Static: data Her n
+ Numeric.LinearAlgebra.Static: data L m n
+ Numeric.LinearAlgebra.Static: data M m n
+ Numeric.LinearAlgebra.Static: data R n
+ Numeric.LinearAlgebra.Static: data Sym n
+ Numeric.LinearAlgebra.Static: diag :: KnownNat n => R n -> Sq n
+ Numeric.LinearAlgebra.Static: diagR :: (Domain field vec mat, KnownNat m, KnownNat n, KnownNat k) => field -> vec k -> mat m n
+ Numeric.LinearAlgebra.Static: dim :: KnownNat n => R n
+ Numeric.LinearAlgebra.Static: disp :: Disp t => Int -> t -> IO ()
+ Numeric.LinearAlgebra.Static: dot :: (Domain field vec mat, KnownNat n) => vec n -> vec n -> field
+ Numeric.LinearAlgebra.Static: eigensystem :: Eigen m l v => m -> (l, v)
+ Numeric.LinearAlgebra.Static: eigenvalues :: Eigen m l v => m -> l
+ Numeric.LinearAlgebra.Static: extract :: Sized t s d => s -> d t
+ Numeric.LinearAlgebra.Static: eye :: KnownNat n => Sq n
+ Numeric.LinearAlgebra.Static: fromList :: Sized t s d => [t] -> s
+ Numeric.LinearAlgebra.Static: headTail :: (KnownNat n, 1 <= n) => R n -> (ℝ, R (n - 1))
+ Numeric.LinearAlgebra.Static: her :: KnownNat n => M n n -> Her n
+ Numeric.LinearAlgebra.Static: instance [overlap ok] (KnownNat m, KnownNat n, m <= (n + 1)) => Diag (L m n) (R m)
+ Numeric.LinearAlgebra.Static: instance [overlap ok] (KnownNat m, KnownNat n, n <= (m + 1)) => Diag (L m n) (R n)
+ Numeric.LinearAlgebra.Static: instance [overlap ok] (KnownNat n', KnownNat m') => Testable (L n' m')
+ Numeric.LinearAlgebra.Static: instance [overlap ok] Domain ℂ C M
+ Numeric.LinearAlgebra.Static: instance [overlap ok] Domain ℝ R L
+ Numeric.LinearAlgebra.Static: instance [overlap ok] KnownNat n => Diag (L n n) (R n)
+ Numeric.LinearAlgebra.Static: instance [overlap ok] KnownNat n => Eigen (Sq n) (C n) (M n n)
+ Numeric.LinearAlgebra.Static: instance [overlap ok] KnownNat n => Eigen (Sym n) (R n) (L n n)
+ Numeric.LinearAlgebra.Static: instance [overlap ok] KnownNat n => Show (Sym n)
+ Numeric.LinearAlgebra.Static: konst :: Sized t s d => t -> s
+ Numeric.LinearAlgebra.Static: linSolve :: (KnownNat m, KnownNat n) => L m m -> L m n -> Maybe (L m n)
+ Numeric.LinearAlgebra.Static: linspace :: KnownNat n => (ℝ, ℝ) -> R n
+ Numeric.LinearAlgebra.Static: mTm :: (KnownNat m, KnownNat n) => L m n -> Sym n
+ Numeric.LinearAlgebra.Static: matrix :: (KnownNat m, KnownNat n) => [ℝ] -> L m n
+ Numeric.LinearAlgebra.Static: mean :: (KnownNat n, 1 <= n) => R n -> ℝ
+ Numeric.LinearAlgebra.Static: mul :: (Domain field vec mat, KnownNat m, KnownNat k, KnownNat n) => mat m k -> mat k n -> mat m n
+ Numeric.LinearAlgebra.Static: qr :: (KnownNat m, KnownNat n) => L m n -> (L m m, L m n)
+ Numeric.LinearAlgebra.Static: range :: KnownNat n => R n
+ Numeric.LinearAlgebra.Static: row :: R n -> L 1 n
+ Numeric.LinearAlgebra.Static: size :: Sized t s d => s -> IndexOf d
+ Numeric.LinearAlgebra.Static: split :: (KnownNat p, KnownNat n, p <= n) => R n -> (R p, R (n - p))
+ Numeric.LinearAlgebra.Static: splitCols :: (KnownNat p, KnownNat m, KnownNat n, KnownNat (n - p), p <= n) => L m n -> (L m p, L m (n - p))
+ Numeric.LinearAlgebra.Static: splitRows :: (KnownNat p, KnownNat m, KnownNat n, p <= m) => L m n -> (L p n, L (m - p) n)
+ Numeric.LinearAlgebra.Static: svd :: (KnownNat m, KnownNat n) => L m n -> (L m m, R n, L n n)
+ Numeric.LinearAlgebra.Static: svdFlat :: (KnownNat m, KnownNat n, m <= n) => L m n -> (L m m, R m, L n m)
+ Numeric.LinearAlgebra.Static: svdTall :: (KnownNat m, KnownNat n, n <= m) => L m n -> (L m n, R n, L n n)
+ Numeric.LinearAlgebra.Static: sym :: KnownNat n => Sq n -> Sym n
+ Numeric.LinearAlgebra.Static: takeDiag :: Diag m d => m -> d
+ Numeric.LinearAlgebra.Static: toColumns :: (KnownNat m, KnownNat n) => L m n -> [R m]
+ Numeric.LinearAlgebra.Static: toRows :: (KnownNat m, KnownNat n) => L m n -> [R n]
+ Numeric.LinearAlgebra.Static: tr :: Transposable m mt => m -> mt
+ Numeric.LinearAlgebra.Static: type Sq n = L n n
+ Numeric.LinearAlgebra.Static: type ℝ = Double
+ Numeric.LinearAlgebra.Static: unSym :: Sym n -> Sq n
+ Numeric.LinearAlgebra.Static: uncol :: KnownNat n => L n 1 -> R n
+ Numeric.LinearAlgebra.Static: unrow :: L 1 n -> R n
+ Numeric.LinearAlgebra.Static: unwrap :: Sized t s d => s -> d t
+ Numeric.LinearAlgebra.Static: vec2 :: ℝ -> ℝ -> R 2
+ Numeric.LinearAlgebra.Static: vec3 :: ℝ -> ℝ -> ℝ -> R 3
+ Numeric.LinearAlgebra.Static: vec4 :: ℝ -> ℝ -> ℝ -> ℝ -> R 4
+ Numeric.LinearAlgebra.Static: vector :: KnownNat n => [ℝ] -> R n
+ Numeric.LinearAlgebra.Static: withCompactSVD :: (KnownNat m, KnownNat n) => L m n -> (forall k. KnownNat k => (L m k, R k, L n k) -> z) -> z
+ Numeric.LinearAlgebra.Static: withMatrix :: Matrix ℝ -> (forall m n. (KnownNat m, KnownNat n) => L m n -> z) -> z
+ Numeric.LinearAlgebra.Static: withNullspace :: (KnownNat m, KnownNat n) => L m n -> (forall k. KnownNat k => L n k -> z) -> z
+ Numeric.LinearAlgebra.Static: withVector :: Vector ℝ -> (forall n. KnownNat n => R n -> z) -> z
+ Numeric.LinearAlgebra.Static: 𝑖 :: Sized ℂ s c => s

Files

CHANGELOG view
@@ -11,9 +11,11 @@         Numeric.LinearAlgebra.Data         Numeric.LinearAlgebra.Devel -      The documentation is now hidden for Data.Packed.*, Numeric.Container, and+      For normal usage we only need to import Numeric.LinearAlgebra.HMatrix.++      (The documentation is now hidden for Data.Packed.*, Numeric.Container, and       the other Numeric.LinearAlgebra.* modules, but they continue to be exposed-      for backwards compatibility.+      for backwards compatibility.)      * Added support for empty arrays, extending automatic conformability       (very useful for construction of block matrices).
THANKS.md view
@@ -139,7 +139,8 @@  - Clemens Lang updated the MacPort installation instructions. -- Henning Thielemann reported the pinv inefficient implementation.+- Henning Thielemann reported the pinv inefficient implementation and the need of+  pkgconfig-depends.  - bdoering reported the problem of zero absolute tolerance in the integration functions. @@ -156,4 +157,14 @@ - Samium Gromoff reported a build failure caused by a size_t - int mismatch.  - Denis Laxalde separated the gsl tests from the base ones.++- Dominic Steinitz (idontgetoutmuch) reported a bug in the static diagonal creation functions.++- Dylan Thurston reported an error in the glpk documentation and ambiguity in+  the description of linearSolve.++- Adrian Victor Crisciu developed an installation method for platforms which+  don't provide shared lapack libraries.++- Ian Ross reported the max/minIndex bug. 
hmatrix.cabal view
@@ -1,5 +1,5 @@ Name:               hmatrix-Version:            0.16.0.4+Version:            0.16.0.5 License:            BSD3 License-file:       LICENSE Author:             Alberto Ruiz
src/C/vector-aux.c view
@@ -172,7 +172,7 @@ double vector_max_index(KDVEC(x)) {     int k, r = 0;     for (k = 1; k<xn; k++) {-        if(xp[k]>xp[0]) {+        if(xp[k]>xp[r]) {             r = k;         }     }@@ -182,7 +182,7 @@ double vector_min_index(KDVEC(x)) {     int k, r = 0;     for (k = 1; k<xn; k++) {-        if(xp[k]<xp[0]) {+        if(xp[k]<xp[r]) {             r = k;         }     }@@ -237,7 +237,7 @@ float vector_max_index_f(KFVEC(x)) {     int k, r = 0;     for (k = 1; k<xn; k++) {-        if(xp[k]>xp[0]) {+        if(xp[k]>xp[r]) {             r = k;         }     }@@ -247,7 +247,7 @@ float vector_min_index_f(KFVEC(x)) {     int k, r = 0;     for (k = 1; k<xn; k++) {-        if(xp[k]<xp[0]) {+        if(xp[k]<xp[r]) {             r = k;         }     }
src/Data/Packed/Numeric.hs view
@@ -160,7 +160,29 @@  -------------------------------------------------------------------------------- --- | least squares solution of a linear system, similar to the \\ operator of Matlab\/Octave (based on linearSolveSVD)+{- | Least squares solution of a linear system, similar to the \\ operator of Matlab\/Octave (based on linearSolveSVD)++@+a = (3><2)+ [ 1.0,  2.0+ , 2.0,  4.0+ , 2.0, -1.0 ]+@++@+v = vector [13.0,27.0,1.0]+@++>>> let x = a <\> v+>>> x+fromList [3.0799999999999996,5.159999999999999]++>>> a #> x+fromList [13.399999999999999,26.799999999999997,1.0]++It also admits multiple right-hand sides stored as columns in a matrix.++-} infixl 7 <\> (<\>) :: (LSDiv c, Field t) => Matrix t -> c t -> c t (<\>) = linSolve
src/Numeric/LinearAlgebra/HMatrix.hs view
@@ -194,7 +194,37 @@ mul = mXm  --- | Solve a linear system (for square coefficient matrix and several right-hand sides) using the LU decomposition, returning Nothing for a singular system. For underconstrained or overconstrained systems use 'linearSolveLS' or 'linearSolveSVD'. +{- | Solve a linear system (for square coefficient matrix and several right-hand sides) using the LU decomposition, returning Nothing for a singular system. For underconstrained or overconstrained systems use 'linearSolveLS' or 'linearSolveSVD'.++@+a = (2><2)+ [ 1.0, 2.0+ , 3.0, 5.0 ]+@++@+b = (2><3)+ [  6.0, 1.0, 10.0+ , 15.0, 3.0, 26.0 ]+@++>>> linearSolve a b+Just (2><3)+ [ -1.4802973661668753e-15,     0.9999999999999997, 1.999999999999997+ ,       3.000000000000001, 1.6653345369377348e-16, 4.000000000000002 ]++>>> let Just x = it+>>> disp 5 x+2x3+-0.00000  1.00000  2.00000+ 3.00000  0.00000  4.00000++>>> a <> x+(2><3)+ [  6.0, 1.0, 10.0+ , 15.0, 3.0, 26.0 ]++-} linearSolve m b = A.mbLinearSolve m b  -- | return an orthonormal basis of the null space of a matrix. See also 'nullspaceSVD'.
src/Numeric/LinearAlgebra/Static.hs view
@@ -512,7 +512,10 @@ --------------------------------------------------------------------------------  diagRectR :: forall m n k . (KnownNat m, KnownNat n, KnownNat k) => ℝ -> R k -> L m n-diagRectR x v = r+diagRectR x v+    | m' == 1 = mkL (LA.diagRect x ev m' n')+    | m'*n' > 0 = r+    | otherwise = matrix []   where     r = mkL (asRow (vjoin [scalar x, ev, zeros]))     ev = extract v@@ -521,7 +524,10 @@   diagRectC :: forall m n k . (KnownNat m, KnownNat n, KnownNat k) => ℂ -> C k -> M m n-diagRectC x v = r+diagRectC x v+    | m' == 1 = mkM (LA.diagRect x ev m' n')+    | m'*n' > 0 = r+    | otherwise = fromList []   where     r = mkM (asRow (vjoin [scalar x, ev, zeros]))     ev = extract v
src/Numeric/LinearAlgebra/Static/Internal.hs view
@@ -150,7 +150,7 @@     (xs,rest) = splitAt (m'*n') xs'     v = LA.fromList xs     x = reshape n' v-    ok = rem (LA.size v) n' == 0 && LA.size x == (m',n') && null rest+    ok = null rest && ((n' == 0 && dim v == 0) || n'> 0 && (rem (LA.size v) n' == 0) && LA.size x == (m',n'))     m' = fromIntegral . natVal $ (undefined :: Proxy m) :: Int     n' = fromIntegral . natVal $ (undefined :: Proxy n) :: Int     abort info = error $ st ++" "++show m' ++ " " ++ show n'++" can't be created from elements " ++ info