sparse-linear-algebra 0.3 → 0.3.1
raw patch · 5 files changed
+25/−14 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Sparse.SpMatrix: contractSub :: Elt a => SpMatrix a -> SpMatrix a -> IxRow -> IxCol -> Int -> a
+ Data.Sparse.SpMatrix: contractSub :: Num a => SpMatrix a -> SpMatrix a -> IxRow -> IxCol -> Int -> a
Files
- CHANGELOG.markdown +7/−0
- CONTRIBUTORS.md +3/−3
- sparse-linear-algebra.cabal +8/−6
- src/Data/Sparse/SpMatrix.hs +6/−4
- src/Numeric/LinearAlgebra/Sparse.hs +1/−1
CHANGELOG.markdown view
@@ -1,3 +1,10 @@+ 0.3.1+ * Changed `SpMatrix` to use `foldlWithKey'` for efficiency (Joshua Moerman)+ + * Bumped LTS to 11.3 (GHC 8.2.2)+ + * Removed unneeded dependencies from stack.yaml+ 0.3 * Fixed a number of instances, un-commented tests (Joshua Moerman)
CONTRIBUTORS.md view
@@ -1,9 +1,9 @@ # Original author -Marco Zocca (@ocramz)+[Marco Zocca](https://github.com/ocramz) # Contributors -Gregory Schwartz (@GregorySchwartz)+[Gregory Schwartz](https://github.com/GregorySchwartz) -Joshua Moerman (@Jaxan)+[Joshua Moerman](https://github.com/Jaxan)
sparse-linear-algebra.cabal view
@@ -1,5 +1,5 @@ name: sparse-linear-algebra-version: 0.3+version: 0.3.1 synopsis: Numerical computing in native Haskell description: /Overview/@@ -17,7 +17,7 @@ license-file: LICENSE author: Marco Zocca maintainer: zocca.marco gmail-copyright: 2016-2017 Marco Zocca+copyright: 2016-2018 Marco Zocca category: Numeric build-type: Simple extra-source-files: README.md@@ -72,18 +72,20 @@ Numeric.LinearAlgebra.LinearSolvers.Experimental Numeric.LinearAlgebra.EigenSolvers.Experimental build-depends: base >= 4.7 && < 5- , primitive -- , deepseq , containers+ , exceptions+ , mtl >= 2.2.1 + , primitive+ , transformers , vector , vector-algorithms -- , hybrid-vectors- , exceptions- , mtl >= 2.2.1 - , transformers -- , writer-cps-transformers -- , monad-log == 0.1.1.0 -- , monad-par++ -- -- DEBUG , QuickCheck >= 2.8.2 , hspec -- , primitive >= 0.6.1.0
src/Data/Sparse/SpMatrix.hs view
@@ -843,13 +843,15 @@ -- ** Partial inner product -- | Contract row `i` of A with column `j` of B up to an index `n`, i.e. summing over repeated indices: --- Aij Bjk , for j in [0 .. n] -contractSub :: Elt a => SpMatrix a -> SpMatrix a -> IxRow -> IxCol -> Int -> a+-- Aik Bkj , for k in [0 .. n] +contractSub :: Num a => SpMatrix a -> SpMatrix a -> IxRow -> IxCol -> Int -> a contractSub a b i j n | ncols a == nrows b && isValidIxSM a (i,j) &&- n <= ncols a = sum $ map (\i' -> (a@@!(i,i'))*b@@!(i',j)) [0 .. n]- | otherwise = error "contractSub : n must be <= i"+ n <= ncols a = case I.lookup i (smData a) of+ Nothing -> 0+ Just r -> I.foldlWithKey' (\acc k x -> if k > n then acc else acc + x * b @@! (k, j)) 0 r+ | otherwise = error "contractSub: matrices have incompatible dimensions or i,j,n are too big"
src/Numeric/LinearAlgebra/Sparse.hs view
@@ -478,7 +478,7 @@ luInit | isNz u00 = return (1, l0, u0) | otherwise = oops (0 :: Int) where- l0 = insertCol (eye n) ((extractSubCol aa 0 (1, n-1)) ./ u00 ) 0+ l0 = insertCol (eye n) (extractSubCol aa 0 (1, n-1) ./ u00 ) 0 u0 = insertRow (zeroSM n n) (extractRow aa 0) 0 -- initial U u00 = u0 @@! (0,0) -- make sure this is non-zero by applying permutation luUpd (i, l, u) = do -- (i + 1, l', u')