packages feed

arrayfire 0.5.1.0 → 0.6.0.0

raw patch · 4 files changed

+91/−74 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- ArrayFire.BLAS: dot :: Array a -> Array a -> MatProp -> MatProp -> Array a
+ ArrayFire.BLAS: dot :: AFType a => Array a -> Array a -> MatProp -> MatProp -> Array a
- ArrayFire.BLAS: dotAll :: Array a -> Array a -> MatProp -> MatProp -> Complex Double
+ ArrayFire.BLAS: dotAll :: AFType a => Array a -> Array a -> MatProp -> MatProp -> Complex Double
- ArrayFire.BLAS: matmul :: Array a -> Array a -> MatProp -> MatProp -> Array a
+ ArrayFire.BLAS: matmul :: AFType a => Array a -> Array a -> MatProp -> MatProp -> Array a
- ArrayFire.BLAS: transpose :: Array a -> Bool -> Array a
+ ArrayFire.BLAS: transpose :: AFType a => Array a -> Bool -> Array a
- ArrayFire.BLAS: transposeInPlace :: Array a -> Bool -> IO ()
+ ArrayFire.BLAS: transposeInPlace :: AFType a => Array a -> Bool -> IO ()

Files

arrayfire.cabal view
@@ -1,5 +1,5 @@ name:                arrayfire-version:             0.5.1.0+version:             0.6.0.0 synopsis:            Haskell bindings to the ArrayFire general-purpose GPU library homepage:            https://github.com/arrayfire/arrayfire-haskell license:             BSD3@@ -90,12 +90,21 @@   default-language:     Haskell2010 -  if (os(linux) || os(OSX)) && !flag(disable-default-paths)+  if os(linux) && !flag(disable-default-paths)     include-dirs:       /opt/arrayfire/include     extra-lib-dirs:-      /opt/arrayfire/lib       /opt/arrayfire/lib64+    ld-options:+      -Wl,-rpath /opt/arrayfire/lib64++  if os(OSX) && !flag(disable-default-paths)+    include-dirs:+      /opt/arrayfire/include+    extra-lib-dirs:+      /opt/arrayfire/lib+    ld-options:+      -Wl,-rpath /opt/arrayfire/lib  executable main   hs-source-dirs:
exe/Main.hs view
@@ -5,86 +5,87 @@ module Main where  import ArrayFire--import Control.Monad (unless)-import Prelude       hiding (sum, product, mod, abs, cos, sin)--main :: IO ()-main = do-  print $ constant @Double [10] 3.33-  window <- createWindow 800 600 "hey"-  let x = iota [200,1] [1,200] / 1000-      y = iota [1,200] [200,1] / 1000-  go window (1 :: Array Float) x y-    where-      go window t x y = do-        let z = 10*x*(-abs(y)) * cos(x*x*(y+t))+sin(y*(x+t))-1.5-        drawSurface window x y z (Cell (-1) (-1) "there" ColorMapDefault)-        closed <- isWindowClosed window-        unless closed $ go window (t + 0.07) x y----------------------------+import Control.Concurrent+import Control.Exception +import Prelude            hiding (sum, product)+-- import GHC.RTS +foreign import ccall safe "test_bool"+  testBool :: IO () +foreign import ccall safe "test_window"+  testWindow :: IO () +main' :: IO ()+main' = print newArray `catch` (\(e :: AFException) -> print e)+  where+    newArray = matrix @Double (2,2) [ [1..], [1..] ] * matrix @Double (2,2) [ [2..], [2..] ] +main :: IO ()+main = do+  main'+  -- testWindow+  -- ks <- randn @Double [100,100]+  -- saveArray "key" ks "array.txt" False+  -- !ks' <- readArrayKey "array.txt" "key"+  -- print ks' +--   info >> putStrLn "ok" >> afInit+--   -- Info things+--   print =<< getSizeOf (Proxy @ Double)+--   print =<< getVersion+--   print =<< getRevision+--   -- getInfo+--   -- print =<< errorToString afErrNoMem+--   putStrLn =<< getInfoString+--   print =<< getDeviceCount+--   print =<< getDevice +--   -- Create and print an array+--   -- arr1 <- constant 1 1 1 f64+--   -- arr2 <- constant 2 1 1 f64+--   -- r <- addArray arr1 arr2 True+--   -- printArray r +--   -- print =<< isLAPACKAvailable+--   -- print =<< getAvailableBackends+--   -- print =<< getActiveBackend+--   -- print =<< getAvailableBackends +--   -- array <- constant @'(10,10) 200+--   -- putStrLn "backend id"+--   -- print (getBackendID array)+--   -- putStrLn "device id"+--   -- print (getDeviceID array) +--   -- array <- randu @'(9,9,9) @Double+--   -- printArray array  -- printArray (mean array 0) +-- --  printArray (add array 1) -foreign import ccall safe "test_bool"-  testBool :: IO ()+--   -- putStrLn "got eeem"+--   -- print =<< getDataPtr x -foreign import ccall safe "test_window"-  testWindow :: IO ()+--   -- x <- constant 10 1 1 f64+--   -- printArray =<< mean x 0 --- main' :: IO ()--- main' = print newArray `catch` (\(e :: AFException) -> print e)---   where---     newArray = matrix @Double (2,2) [ [1..], [1..] ] * matrix @Double (2,2) [ [2..], [2..] ]+-- --  print =<< isLAPACKAvailable -main2 :: IO ()-main2 = do-  window <- createWindow 800 600 "hey"-  go window-    where-      go window = do-        let x = iota [1,60] [60,1] / (30 :: Array Float)-            cell = Cell (-1) (-1) mempty ColorMapDefault-        drawImage window x cell-        closed <- isWindowClosed window-        unless closed $ go window+--   a <- randu @'(3,3) @Float+--   b <- randu @'(3,3) @Float+--   printArray ((a `matmul` b) None None)+--     `catch` (\(e :: AFException) -> do+--                 putStrLn "got one"+--                 print e) +  putStrLn "create window"+  window <- createWindow 200 200 "hey"+  putStrLn "set visibility"+  setVisibility window True+  putStrLn "show window"+  showWindow window+  threadDelay (secs 10)  --   -- print =<< getActiveBackend --   -- print =<< getDeviceCount
src/ArrayFire.hs view
@@ -248,8 +248,10 @@ -- [1 1 1 1] --   10.0000 ----- >>> negate (scalar @Double 1 [10])--- -10.0+-- >>> negate (scalar @Double 10)+-- ArrayFire Array+-- [1 1 1 1]+--   -10.0000 -- -- >>> fromInteger 1.0 :: Array Double -- ArrayFire Array
src/ArrayFire/BLAS.hs view
@@ -55,7 +55,8 @@ --     7.0000    15.0000 --    10.0000    22.0000 matmul-  :: Array a+  :: AFType a+  => Array a   -- ^ 2D matrix of Array a, left-hand side   -> Array a   -- ^ 2D matrix of Array a, right-hand side@@ -75,7 +76,8 @@ -- [1 1 1 1] --   385.0000 dot-  :: Array a+  :: AFType a+  => Array a   -- ^ Left-hand side input   -> Array a   -- ^ Right-hand side input@@ -93,7 +95,8 @@ -- >>> dotAll (vector @Double 10 [1..]) (vector @Double 10 [1..]) None None -- 385.0 :+ 0.0 dotAll-  :: Array a+  :: AFType a+  => Array a   -- ^ Left-hand side array   -> Array a   -- ^ Right-hand side array@@ -126,7 +129,8 @@ --     5.0000     6.0000 -- transpose-  :: Array a+  :: AFType a+  => Array a   -- ^ Input matrix to be transposed   -> Bool   -- ^ Should perform conjugate transposition@@ -155,7 +159,8 @@ --    3.0000     4.0000 -- transposeInPlace-  :: Array a+  :: AFType a+  => Array a   -- ^ Input matrix to be transposed   -> Bool   -- ^ Should perform conjugate transposition