packages feed

hblas 0.4.0.0 → 0.4.0.1

raw patch · 6 files changed

+48/−11 lines, 6 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

- Numerical.HBLAS.BLAS.Internal.Level2: type GbmvFun el orient s m = Transpose -> Int -> Int -> Int -> Int -> el -> MDenseMatrix s orient el -> MDenseVector s Direct el -> el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type GbmvFun el orient s m = Transpose -> Int -> Int -> Int -> Int -> el -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type GemvFun el orient s m = Transpose -> el -> el -> MDenseMatrix s orient el -> MDenseVector s Direct el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type GemvFun el orient s m = Transpose -> el -> el -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type GerFun el orient s m = el -> MDenseVector s Direct el -> MDenseVector s Direct el -> MDenseMatrix s orient el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type GerFun el orient s m = el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> MDenseMatrix s orient el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type HbmvFun el orient s m = MatUpLo -> Int -> el -> MDenseMatrix s orient el -> MDenseVector s Direct el -> el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type HbmvFun el orient s m = MatUpLo -> Int -> el -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type HemvFun el orient s m = MatUpLo -> el -> MDenseMatrix s orient el -> MDenseVector s Direct el -> el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type HemvFun el orient s m = MatUpLo -> el -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type Her2Fun el orient s m = MatUpLo -> el -> MDenseVector s Direct el -> MDenseVector s Direct el -> MDenseMatrix s orient el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type Her2Fun el orient s m = MatUpLo -> el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> MDenseMatrix s orient el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type HerFun scale el orient s m = MatUpLo -> scale -> MDenseVector s Direct el -> MDenseMatrix s orient el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type HerFun scale el orient s m = MatUpLo -> scale -> MDenseVector s 'Direct el -> MDenseMatrix s orient el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type HpmvFun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s Direct el -> MDenseVector s Direct el -> el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type HpmvFun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type Hpr2Fun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s Direct el -> MDenseVector s Direct el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type Hpr2Fun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type HprFun scale el orient s m = SOrientation orient -> MatUpLo -> Int -> scale -> MDenseVector s Direct el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type HprFun scale el orient s m = SOrientation orient -> MatUpLo -> Int -> scale -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type SbmvFun el orient s m = MatUpLo -> Int -> el -> MDenseMatrix s orient el -> MDenseVector s Direct el -> el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type SbmvFun el orient s m = MatUpLo -> Int -> el -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type SpmvFun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s Direct el -> MDenseVector s Direct el -> el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type SpmvFun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type Spr2Fun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s Direct el -> MDenseVector s Direct el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type Spr2Fun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type SprFun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s Direct el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type SprFun el orient s m = SOrientation orient -> MatUpLo -> Int -> el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type SymvFun el orient s m = MatUpLo -> el -> MDenseMatrix s orient el -> MDenseVector s Direct el -> el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type SymvFun el orient s m = MatUpLo -> el -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type Syr2Fun el orient s m = MatUpLo -> el -> MDenseVector s Direct el -> MDenseVector s Direct el -> MDenseMatrix s orient el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type Syr2Fun el orient s m = MatUpLo -> el -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> MDenseMatrix s orient el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type SyrFun el orient s m = MatUpLo -> el -> MDenseVector s Direct el -> MDenseMatrix s orient el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type SyrFun el orient s m = MatUpLo -> el -> MDenseVector s 'Direct el -> MDenseMatrix s orient el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type TbmvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> Int -> MDenseMatrix s orient el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type TbmvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> Int -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type TbsvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> Int -> MDenseMatrix s orient el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type TbsvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> Int -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type TpmvFun el orient s m = SOrientation orient -> MatUpLo -> Transpose -> MatDiag -> Int -> MDenseVector s Direct el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type TpmvFun el orient s m = SOrientation orient -> MatUpLo -> Transpose -> MatDiag -> Int -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type TpsvFun el orient s m = SOrientation orient -> MatUpLo -> Transpose -> MatDiag -> Int -> MDenseVector s Direct el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type TpsvFun el orient s m = SOrientation orient -> MatUpLo -> Transpose -> MatDiag -> Int -> MDenseVector s 'Direct el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type TrmvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> MDenseMatrix s orient el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type TrmvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.BLAS.Internal.Level2: type TrsvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> MDenseMatrix s orient el -> MDenseVector s Direct el -> m ()
+ Numerical.HBLAS.BLAS.Internal.Level2: type TrsvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> MDenseMatrix s orient el -> MDenseVector s 'Direct el -> m ()
- Numerical.HBLAS.MatrixTypes: [SDirect] :: SVariant Direct
+ Numerical.HBLAS.MatrixTypes: [SDirect] :: SVariant 'Direct
- Numerical.HBLAS.MatrixTypes: [SImplicit] :: {_frontPadding :: !Int, _endPadding :: {-# UNPACK #-} !Int} -> SVariant Implicit
+ Numerical.HBLAS.MatrixTypes: [SImplicit] :: {_frontPadding :: !Int, _endPadding :: {-# UNPACK #-} !Int} -> SVariant 'Implicit
- Numerical.HBLAS.MatrixTypes: generateMutableDenseVector :: (Storable a, PrimMonad m) => Int -> (Int -> a) -> m (MDenseVector (PrimState m) Direct a)
+ Numerical.HBLAS.MatrixTypes: generateMutableDenseVector :: (Storable a, PrimMonad m) => Int -> (Int -> a) -> m (MDenseVector (PrimState m) 'Direct a)
- Numerical.HBLAS.MatrixTypes: generateMutableDenseVectorWithStride :: (Num a, Storable a, PrimMonad m) => Int -> Int -> (Int -> a) -> m (MDenseVector (PrimState m) Direct a)
+ Numerical.HBLAS.MatrixTypes: generateMutableDenseVectorWithStride :: (Num a, Storable a, PrimMonad m) => Int -> Int -> (Int -> a) -> m (MDenseVector (PrimState m) 'Direct a)
- Numerical.HBLAS.MatrixTypes: type Column = Column
+ Numerical.HBLAS.MatrixTypes: type Column = 'Column
- Numerical.HBLAS.MatrixTypes: type Row = Row
+ Numerical.HBLAS.MatrixTypes: type Row = 'Row

Files

changelog.md view
@@ -1,10 +1,10 @@ -#0.4.0.0+# 0.4.0.0 HBLAS now implements every single blas routine. Thanks to the contributors who make this possible. This release disables level1 routines for now  -#0.3.1.1+# 0.3.1.1 release, bug fixes in show and improved tests, thanks to tomas musil for catching them  # 0.3.1.0
hblas.cabal view
@@ -10,7 +10,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.4.0.0+version:             0.4.0.1  -- A short (one-line) description of the package. synopsis:            Human friendly BLAS and Lapack bindings for Haskell.@@ -142,17 +142,17 @@   if flag(OpenBLAS)     extra-libraries: openblas pthread -  if flag(OpenBLAS)&& os(OSX)+  if flag(OpenBLAS) && os(OSX)     extra-lib-dirs: /usr/local/lib -  if os(OSX)&&!flag(OpenBLAS)+  if os(OSX) && !flag(OpenBLAS)       frameworks: Accelerate       -- extra-libraries: cblas lapack    if os(windows) && !flag(OpenBLAS)       extra-libraries: blas lapack -  if !os(windows)&& !os(OSX) && !flag(OpenBLAS)+  if !os(windows) && !os(OSX) && !flag(OpenBLAS)     -- extra-libraries: blas lapack     extra-libraries: blas, lapack 
src/Numerical/HBLAS/BLAS/Internal/Level2.hs view
@@ -132,7 +132,7 @@           constHandler alpha $ \alphaPtr ->           constHandler beta $ \betaPtr ->             do unsafePrimToPrim $! (if shouldCallFast ax ay then gbmvUnsafeFFI else gbmvSafeFFI) (encodeNiceOrder ornta) (encodeFFITranspose trans) (fromIntegral m) (fromIntegral n) (fromIntegral kl) (fromIntegral ku) alphaPtr ap (fromIntegral astride) xp (fromIntegral xstride) betaPtr yp (fromIntegral ystride)-        where srcVecLen = snd $ coordSwapper trans (m, n)+        where srcVecLen = snd $ coordSwapper trans (m, n)  -- check this too               dstVecLen = fst $ coordSwapper trans (m, n)  gemvComplexity :: Integral a => a -> a -> Int64@@ -167,7 +167,7 @@             error $! "The read and write inputs for: " ++ gemvName ++ " overlap. This is a programmer error. Please fix."         | otherwise = call             where-              (newx,newy) = coordSwapper tr (ax,ay)+              (newx,newy) = coordSwapper tr (ay,ax) -- get this correct ... with care               call = unsafeWithPrim abuff $ \ap ->                      unsafeWithPrim bbuff $ \bp ->                      unsafeWithPrim cbuff $ \cp ->
src/Numerical/HBLAS/Lapack/FFI.hs view
@@ -8,7 +8,9 @@ import Data.Int  +{-?ges +-} {-  stylenote: we will not use the LAPACKE_* operations, only the
src/Numerical/HBLAS/MatrixTypes.hs view
@@ -1,4 +1,3 @@- {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeFamilies #-}@@ -226,7 +225,9 @@ data MDenseMatrix :: *  ->Orientation  -> * -> *  where     MutableDenseMatrix :: { _OrientationMutMat :: SOrientation ornt ,                             _XdimDenMutMat :: {-# UNPACK #-}!Int ,+                            --- change --XDIM to leading Dim                             _YdimDenMutMat ::  {-# UNPACK #-}!Int,+                            -- CHANGE YDIM to inner dim                             _StrideDenMutMat :: {-# UNPACK #-} !Int,                             _bufferDenMutMat :: {-# UNPACK #-} !(SM.MVector s  elem) } -> MDenseMatrix s ornt elem @@ -333,8 +334,9 @@ -- | generateDenseMatrix Row (k,k) \(i,j)-> if i == j then 1.0 else 0.0 would generate a KxK identity matrix generateDenseMatrix :: (S.Storable a)=> SOrientation x -> (Int,Int)->((Int,Int)-> a) -> DenseMatrix x a generateDenseMatrix SRow (xdim,ydim) f = DenseMatrix SRow  xdim ydim xdim $!-             S.generate (xdim * ydim) (\ix -> let !ixtup@(!_,!_) = swap $ quotRem ix xdim in-                                         f  ixtup )+             S.generate (xdim * ydim) (\ix ->+                  let !ixtup@(!_,!_) = swap $ quotRem ix xdim+                    in   f  ixtup ) generateDenseMatrix SColumn (xdim,ydim) f = DenseMatrix SColumn xdim ydim ydim $!          S.generate (xdim * ydim ) (\ix -> let  ixtup@(!_,!_) = ( quotRem ix ydim ) in                                          f ixtup )
tests/HBLAS/BLAS/Level2Spec.hs view
@@ -13,6 +13,8 @@  import Numerical.HBLAS.MatrixTypes as Matrix import Numerical.HBLAS.BLAS.Level2 as BLAS+import qualified Data.Vector.Storable as S+import qualified Data.Vector.Storable.Mutable as SM  main :: IO () main = hspec spec@@ -44,6 +46,37 @@   tpsvSpec   trmvSpec   trsvSpec+  gemvBugJune2017++gemvBugJune2017 :: Spec+gemvBugJune2017  =+  --context "?gemv bug"++ {-++++ -}+    describe "dgemv abstraction" $ do+      it "3*2 matrix vector product sadness" $+             let m = S.fromList [1,2,3, 4,5,6]+                 x = S.fromList [10,20,30]+             in+             do++              m' <- S.unsafeThaw m+              x' <- S.unsafeThaw x+              y' <- SM.new 2++              let mat   = MutableDenseMatrix SRow 3 2 3 m'+                  xvec  = MutableDenseVector SDirect 3 1 x'+                  yvec  = MutableDenseVector SDirect 2 1 y'++              dgemv NoTranspose 1 0 mat xvec yvec+              resList <-mutableVectorToList $ _bufferMutDenseVector yvec+              resList `shouldBe` [140, 320]++  gbmvSpec :: Spec gbmvSpec =