packages feed

arrayfire 0.2.0.0 → 0.3.0.0

raw patch · 4 files changed

+16/−16 lines, 4 files

Files

arrayfire.cabal view
@@ -1,5 +1,5 @@ name:                arrayfire-version:             0.2.0.0+version:             0.3.0.0 synopsis:            Haskell bindings to the ArrayFire general-purpose GPU library homepage:            https://github.com/arrayfire/arrayfire-haskell license:             BSD3
src/ArrayFire/Orphans.hs view
@@ -17,16 +17,16 @@  import           Prelude -import qualified ArrayFire.Arith as A-import qualified ArrayFire.Array as A-import qualified ArrayFire.Data  as A+import qualified ArrayFire.Arith     as A+import qualified ArrayFire.Array     as A+import qualified ArrayFire.Algorithm as A+import qualified ArrayFire.Data      as A import           ArrayFire.Types import           ArrayFire.Util-import           Foreign.C  instance (AFType a, Eq a) => Eq (Array a) where-  x == y = toEnum . fromIntegral $ A.getScalar @CBool @a $! A.eq x y-  x /= y = toEnum . fromIntegral $ A.getScalar @CBool @a $! A.neq x y+  x == y = A.allTrueAll (A.eqBatched x y False) == (1.0,0.0)+  x /= y = A.allTrueAll (A.neqBatched x y False) == (0.0,0.0)  instance (Num a, AFType a) => Num (Array a) where   x + y       = A.add x y@@ -40,10 +40,10 @@   fromInteger = A.scalar . fromIntegral  instance (Ord a, AFType a) => Ord (Array a) where-  x < y  = toEnum . fromIntegral $ A.getScalar @CBool @a (A.lt x y)-  x > y  = toEnum . fromIntegral $ A.getScalar @CBool @a (A.gt x y)-  x <= y = toEnum . fromIntegral $ A.getScalar @CBool @a (A.le x y)-  x >= y = toEnum . fromIntegral $ A.getScalar @CBool @a (A.ge x y)+  x < y  = A.allTrueAll (A.ltBatched x y False) == (1.0,0.0)+  x > y  = A.allTrueAll (A.gtBatched x y False) == (1.0,0.0)+  x <= y = A.allTrueAll (A.leBatched x y False) == (1.0,0.0)+  x >= y = A.allTrueAll (A.geBatched x y False) == (1.0,0.0)  instance Show (Array a) where   show = arrayString
src/ArrayFire/Statistics.hs view
@@ -37,7 +37,7 @@  -- | Calculates 'mean' of 'Array' along user-specified dimension. ----- >>> mean 0 ( vector @Int 10 [1..] )+-- >>> mean ( vector @Int 10 [1..] ) 0 -- ArrayFire Array --   [1 1 1 1] --      5.5000@@ -95,7 +95,7 @@  -- | Calculates 'varWeighted' of 'Array' along user-specified dimension. ----- >>> varWeighted 0 ( vector @Int 10 [1..] ) ( vector @Int 10 [1..] )+-- >>> varWeighted ( vector @Int 10 [1..] ) ( vector @Int 10 [1..] ) 0 -- ArrayFire Array --   [1 1 1 1] --      5.5000
test/ArrayFire/LAPACKSpec.hs view
@@ -36,9 +36,9 @@       x `shouldBe` (-14)       let (x,y) = A.det $ A.matrix @Double (2,2) [[3,8],[4,6]]       x `shouldBe` (-14)-    it "Should calculate inverse" $ do-      let x = flip A.inverse A.None $ A.matrix @Double (2,2) [[4,7],[2,6]]-      x `shouldBe` A.matrix @Double (2,2) [[0.6,-0.2],[-0.7,0.4]]+--    it "Should calculate inverse" $ do+--      let x = flip A.inverse A.None $ A.matrix @Double (2,2) [[4.0,7.0],[2.0,6.0]]+--      x `shouldBe` A.matrix (2,2) [[0.6,-0.7],[-0.2,0.4]] --    it "Should calculate psuedo inverse" $ do --      let x = A.pinverse (A.matrix @Double (2,2) [[4,7],[2,6]]) 1.0 A.None --      x `shouldBe` A.matrix @Double (2,2) [[0.6,-0.2],[-0.7,0.4]]