packages feed

arrayfire 0.7.0.0 → 0.7.1.0

raw patch · 51 files changed

+226/−2321 lines, 51 filesdep +HUnitdep +call-stack

Dependencies added: HUnit, call-stack

Files

arrayfire.cabal view
@@ -1,13 +1,13 @@ cabal-version:       3.0 name:                arrayfire-version:             0.7.0.0+version:             0.7.1.0 synopsis:            Haskell bindings to the ArrayFire general-purpose GPU library homepage:            https://github.com/arrayfire/arrayfire-haskell license:             BSD-3-Clause license-file:        LICENSE author:              David Johnson-maintainer:          djohnson.m@gmail.com-copyright:           David Johnson (c) 2018-2023+maintainer:          code@dmj.io+copyright:           David Johnson (c) 2018-2025 category:            Math build-type:          Custom extra-source-files:  CHANGELOG.md@@ -21,10 +21,15 @@     default:        False     manual:         True +flag disable-build-tool-depends+    description:    When enabled, don't add build-tool-depends fields to the Cabal file. Needed for working inside @nix develop@.+    default:        False+    manual:         True+ custom-setup  setup-depends:    base <5,-   Cabal,+   Cabal < 3.17,    cabal-doctest >=1 && <1.1  library@@ -75,8 +80,9 @@     ArrayFire.Internal.Types     ArrayFire.Internal.Util     ArrayFire.Internal.Vision-  build-tool-depends:-    hsc2hs:hsc2hs+  if !flag(disable-build-tool-depends)+    build-tool-depends:+      hsc2hs:hsc2hs   extra-libraries:     af   c-sources:@@ -138,6 +144,8 @@     exitcode-stdio-1.0   main-is:     Main.hs+  other-modules:+    Test.Hspec.ApproxExpect   hs-source-dirs:     test   build-depends:@@ -145,11 +153,14 @@     base < 5,     directory,     hspec,+    HUnit,     QuickCheck,     quickcheck-classes,-    vector-  build-tool-depends:-    hspec-discover:hspec-discover+    vector,+    call-stack >=0.4 && <0.5+  if !flag(disable-build-tool-depends)+    build-tool-depends:+      hspec-discover:hspec-discover   default-language:     Haskell2010   other-modules:
src/ArrayFire.hs view
@@ -3,7 +3,7 @@ -- Module      : ArrayFire -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Algorithm.hs view
@@ -6,7 +6,7 @@ -- Module      : ArrayFire.Algorithm -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Arith.hs view
@@ -7,7 +7,7 @@ -- Module      : ArrayFire.Arith -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Array.hs view
@@ -12,7 +12,7 @@ -- Module      : ArrayFire.Array -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/BLAS.hs view
@@ -4,7 +4,7 @@ -- Module      : ArrayFire.BLAS -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Backend.hs view
@@ -3,7 +3,7 @@ -- Module      : ArrayFire.Backend -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Data.hs view
@@ -12,7 +12,7 @@ -- Module      : ArrayFire.Data -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --@@ -30,7 +30,6 @@ module ArrayFire.Data where  import Control.Exception-import Control.Monad import Data.Complex import Data.Int import Data.Proxy@@ -38,6 +37,7 @@ import Foreign.C.Types import Foreign.ForeignPtr import Foreign.Marshal          hiding (void)+import Foreign.Ptr (Ptr) import Foreign.Storable import System.IO.Unsafe import Unsafe.Coerce@@ -357,20 +357,21 @@   :: Int   -> [Array a]   -> Array a-joinMany (fromIntegral -> n) arrays = unsafePerformIO . mask_ $ do-  fptrs <- forM arrays $ \(Array fptr) -> pure fptr-  newPtr <--    alloca $ \fPtrsPtr -> do-      forM_ fptrs $ \fptr ->-        withForeignPtr fptr (poke fPtrsPtr)-      alloca $ \aPtr -> do-        zeroOutArray aPtr-        throwAFError =<< af_join_many aPtr n nArrays fPtrsPtr-        peek aPtr+joinMany (fromIntegral -> n) (fmap (\(Array fp) -> fp) -> arrays) = unsafePerformIO . mask_ $ do+  newPtr <- alloca $ \aPtr -> do+    zeroOutArray aPtr+    (throwAFError =<<) $+      withManyForeignPtr arrays $ \(fromIntegral -> nArrays) fPtrsPtr ->+        af_join_many aPtr n nArrays fPtrsPtr+    peek aPtr   Array <$>     newForeignPtr af_release_array_finalizer newPtr++withManyForeignPtr :: [ForeignPtr a] -> (Int -> Ptr (Ptr a) -> IO b) -> IO b+withManyForeignPtr fptrs action = go [] fptrs   where-    nArrays = fromIntegral (length arrays)+    go ptrs [] = withArrayLen (reverse ptrs) action+    go ptrs (fptr:others) = withForeignPtr fptr $ \ptr -> go (ptr : ptrs) others  -- | Tiles an Array according to specified dimensions --
src/ArrayFire/Device.hs view
@@ -4,7 +4,7 @@ -- Module      : ArrayFire.Device -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Exception.hs view
@@ -5,7 +5,7 @@ -- Module      : ArrayFire.Exception -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/FFI.hs view
@@ -6,7 +6,7 @@ -- Module      : ArrayFire.FFI -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --@@ -72,7 +72,7 @@   :: Array b   -> Array a   -> (Ptr AFArray -> AFArray -> AFArray -> IO AFErr)-  -> Array a+  -> Array c {-# NOINLINE op2 #-} op2 (Array fptr1) (Array fptr2) op =   unsafePerformIO $ do
src/ArrayFire/Features.hs view
@@ -4,7 +4,7 @@ -- Module      : ArrayFire.Features -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Graphics.hs view
@@ -4,7 +4,7 @@ -- Module      : ArrayFire.Graphics -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Image.hs view
@@ -6,7 +6,7 @@ -- Module      : ArrayFire.Image -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Index.hs view
@@ -3,7 +3,7 @@ -- Module      : ArrayFire.Index -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --@@ -41,8 +41,20 @@      n = fromIntegral (length seqs)  -- | Lookup an Array by keys along a specified dimension-lookup :: Array a -> Array a -> Int -> Array a+lookup +  :: Array a +  -- ^ Input Array+  -> Array Int +  -- ^ Indices+  -> Int +  -- ^ Dimension+  -> Array a lookup a b n = op2 a b $ \p x y -> af_lookup p x y (fromIntegral n)++-- | A special value representing the entire axis of an 'Array'.+span :: Seq+span = Seq 1 1 0  -- From include/af/seq.h+                  -- Hard-coded here because FFI cannot import static const values.  -- af_err af_assign_seq( af_array *out, const af_array lhs, const unsigned ndims, const af_seq* const indices, const af_array rhs); -- | Calculates 'mean' of 'Array' along user-specified dimension.
− src/ArrayFire/Internal/Arith.hs
@@ -1,150 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Arith.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Arith where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_add"-    af_add :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_sub"-    af_sub :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_mul"-    af_mul :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_div"-    af_div :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_lt"-    af_lt :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_gt"-    af_gt :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_le"-    af_le :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_ge"-    af_ge :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_eq"-    af_eq :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_neq"-    af_neq :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_and"-    af_and :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_or"-    af_or :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_not"-    af_not :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_bitand"-    af_bitand :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_bitor"-    af_bitor :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_bitxor"-    af_bitxor :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_bitshiftl"-    af_bitshiftl :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_bitshiftr"-    af_bitshiftr :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_cast"-    af_cast :: Ptr AFArray -> AFArray -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_minof"-    af_minof :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_maxof"-    af_maxof :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_clamp"-    af_clamp :: Ptr AFArray -> AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_rem"-    af_rem :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_mod"-    af_mod :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_abs"-    af_abs :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_arg"-    af_arg :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sign"-    af_sign :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_round"-    af_round :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_trunc"-    af_trunc :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_floor"-    af_floor :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_ceil"-    af_ceil :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_hypot"-    af_hypot :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_sin"-    af_sin :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_cos"-    af_cos :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_tan"-    af_tan :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_asin"-    af_asin :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_acos"-    af_acos :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_atan"-    af_atan :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_atan2"-    af_atan2 :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_cplx2"-    af_cplx2 :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_cplx"-    af_cplx :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_real"-    af_real :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_imag"-    af_imag :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_conjg"-    af_conjg :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sinh"-    af_sinh :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_cosh"-    af_cosh :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_tanh"-    af_tanh :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_asinh"-    af_asinh :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_acosh"-    af_acosh :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_atanh"-    af_atanh :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_root"-    af_root :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_pow"-    af_pow :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_pow2"-    af_pow2 :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_exp"-    af_exp :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sigmoid"-    af_sigmoid :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_expm1"-    af_expm1 :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_erf"-    af_erf :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_erfc"-    af_erfc :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_log"-    af_log :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_log1p"-    af_log1p :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_log10"-    af_log10 :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_log2"-    af_log2 :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sqrt"-    af_sqrt :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_cbrt"-    af_cbrt :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_factorial"-    af_factorial :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_tgamma"-    af_tgamma :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_lgamma"-    af_lgamma :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_iszero"-    af_iszero :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_isinf"-    af_isinf :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_isnan"-    af_isnan :: Ptr AFArray -> AFArray -> IO AFErr
− src/ArrayFire/Internal/Array.hs
@@ -1,72 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Array.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Array where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_create_array"-    af_create_array :: Ptr AFArray -> Ptr () -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_create_handle"-    af_create_handle :: Ptr AFArray -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_copy_array"-    af_copy_array :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_write_array"-    af_write_array :: AFArray -> Ptr () -> CSize -> AFSource -> IO AFErr-foreign import ccall unsafe "af_get_data_ptr"-    af_get_data_ptr :: Ptr () -> AFArray -> IO AFErr-foreign import ccall unsafe "af_release_array"-    af_release_array :: AFArray -> IO AFErr-foreign import ccall unsafe "af_retain_array"-    af_retain_array :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_get_data_ref_count"-    af_get_data_ref_count :: Ptr CInt -> AFArray -> IO AFErr-foreign import ccall unsafe "af_eval"-    af_eval :: AFArray -> IO AFErr-foreign import ccall unsafe "af_eval_multiple"-    af_eval_multiple :: CInt -> Ptr AFArray -> IO AFErr-foreign import ccall unsafe "af_set_manual_eval_flag"-    af_set_manual_eval_flag :: CBool -> IO AFErr-foreign import ccall unsafe "af_get_manual_eval_flag"-    af_get_manual_eval_flag :: Ptr CBool -> IO AFErr-foreign import ccall unsafe "af_get_elements"-    af_get_elements :: Ptr DimT -> AFArray -> IO AFErr-foreign import ccall unsafe "af_get_type"-    af_get_type :: Ptr AFDtype -> AFArray -> IO AFErr-foreign import ccall unsafe "af_get_dims"-    af_get_dims :: Ptr DimT -> Ptr DimT -> Ptr DimT -> Ptr DimT -> AFArray -> IO AFErr-foreign import ccall unsafe "af_get_numdims"-    af_get_numdims :: Ptr CUInt -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_empty"-    af_is_empty :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_scalar"-    af_is_scalar :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_row"-    af_is_row :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_column"-    af_is_column :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_vector"-    af_is_vector :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_complex"-    af_is_complex :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_real"-    af_is_real :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_double"-    af_is_double :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_single"-    af_is_single :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_realfloating"-    af_is_realfloating :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_floating"-    af_is_floating :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_integer"-    af_is_integer :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_bool"-    af_is_bool :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_sparse"-    af_is_sparse :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_get_scalar"-    af_get_scalar :: Ptr () -> AFArray -> IO AFErr
− src/ArrayFire/Internal/BLAS.hs
@@ -1,20 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/BLAS.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.BLAS where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_matmul"-    af_matmul :: Ptr AFArray -> AFArray -> AFArray -> AFMatProp -> AFMatProp -> IO AFErr-foreign import ccall unsafe "af_dot"-    af_dot :: Ptr AFArray -> AFArray -> AFArray -> AFMatProp -> AFMatProp -> IO AFErr-foreign import ccall unsafe "af_dot_all"-    af_dot_all :: Ptr Double -> Ptr Double -> AFArray -> AFArray -> AFMatProp -> AFMatProp -> IO AFErr-foreign import ccall unsafe "af_transpose"-    af_transpose :: Ptr AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_transpose_inplace"-    af_transpose_inplace :: AFArray -> CBool -> IO AFErr
− src/ArrayFire/Internal/Backend.hs
@@ -1,22 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Backend.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Backend where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_set_backend"-    af_set_backend :: AFBackend -> IO AFErr-foreign import ccall unsafe "af_get_backend_count"-    af_get_backend_count :: Ptr CUInt -> IO AFErr-foreign import ccall unsafe "af_get_available_backends"-    af_get_available_backends :: Ptr CInt -> IO AFErr-foreign import ccall unsafe "af_get_backend_id"-    af_get_backend_id :: Ptr AFBackend -> AFArray -> IO AFErr-foreign import ccall unsafe "af_get_active_backend"-    af_get_active_backend :: Ptr AFBackend -> IO AFErr-foreign import ccall unsafe "af_get_device_id"-    af_get_device_id :: Ptr CInt -> AFArray -> IO AFErr
− src/ArrayFire/Internal/Data.hs
@@ -1,58 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Data.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Data where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_constant"-    af_constant :: Ptr AFArray -> Double -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_constant_complex"-    af_constant_complex :: Ptr AFArray -> Double -> Double -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_constant_long"-    af_constant_long :: Ptr AFArray -> IntL -> CUInt -> Ptr DimT -> IO AFErr-foreign import ccall unsafe "af_constant_ulong"-    af_constant_ulong :: Ptr AFArray -> UIntL -> CUInt -> Ptr DimT -> IO AFErr-foreign import ccall unsafe "af_range"-    af_range :: Ptr AFArray -> CUInt -> Ptr DimT -> CInt -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_iota"-    af_iota :: Ptr AFArray -> CUInt -> Ptr DimT -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_identity"-    af_identity :: Ptr AFArray -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_diag_create"-    af_diag_create :: Ptr AFArray -> AFArray -> CInt -> IO AFErr-foreign import ccall unsafe "af_diag_extract"-    af_diag_extract :: Ptr AFArray -> AFArray -> CInt -> IO AFErr-foreign import ccall unsafe "af_join"-    af_join :: Ptr AFArray -> CInt -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_join_many"-    af_join_many :: Ptr AFArray -> CInt -> CUInt -> Ptr AFArray -> IO AFErr-foreign import ccall unsafe "af_tile"-    af_tile :: Ptr AFArray -> AFArray -> CUInt -> CUInt -> CUInt -> CUInt -> IO AFErr-foreign import ccall unsafe "af_reorder"-    af_reorder :: Ptr AFArray -> AFArray -> CUInt -> CUInt -> CUInt -> CUInt -> IO AFErr-foreign import ccall unsafe "af_shift"-    af_shift :: Ptr AFArray -> AFArray -> CInt -> CInt -> CInt -> CInt -> IO AFErr-foreign import ccall unsafe "af_moddims"-    af_moddims :: Ptr AFArray -> AFArray -> CUInt -> Ptr DimT -> IO AFErr-foreign import ccall unsafe "af_flat"-    af_flat :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_flip"-    af_flip :: Ptr AFArray -> AFArray -> CUInt -> IO AFErr-foreign import ccall unsafe "af_lower"-    af_lower :: Ptr AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_upper"-    af_upper :: Ptr AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_select"-    af_select :: Ptr AFArray -> AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_select_scalar_r"-    af_select_scalar_r :: Ptr AFArray -> AFArray -> AFArray -> Double -> IO AFErr-foreign import ccall unsafe "af_select_scalar_l"-    af_select_scalar_l :: Ptr AFArray -> AFArray -> Double -> AFArray -> IO AFErr-foreign import ccall unsafe "af_replace"-    af_replace :: AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_replace_scalar"-    af_replace_scalar :: AFArray -> AFArray -> Double -> IO AFErr
− src/ArrayFire/Internal/Defines.hs
@@ -1,586 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Defines.hsc" #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE CPP             #-}-{-# LANGUAGE RecordWildCards #-}-module ArrayFire.Internal.Defines where--import Foreign.Ptr-import Foreign.C.Types-import Foreign.Storable-------afVersion :: Integer-afVersion = 38-{-# LINE 17 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFErr = AFErr { afError :: CInt }-  deriving (Show, Eq)--afSuccess  :: AFErr-afSuccess  = AFErr 0-afErrNoMem  :: AFErr-afErrNoMem  = AFErr 101-afErrDriver  :: AFErr-afErrDriver  = AFErr 102-afErrRuntime  :: AFErr-afErrRuntime  = AFErr 103-afErrInvalidArray  :: AFErr-afErrInvalidArray  = AFErr 201-afErrArg  :: AFErr-afErrArg  = AFErr 202-afErrSize  :: AFErr-afErrSize  = AFErr 203-afErrType  :: AFErr-afErrType  = AFErr 204-afErrDiffType  :: AFErr-afErrDiffType  = AFErr 205-afErrBatch  :: AFErr-afErrBatch  = AFErr 207-afErrDevice  :: AFErr-afErrDevice  = AFErr 208-afErrNotSupported  :: AFErr-afErrNotSupported  = AFErr 301-afErrNotConfigured  :: AFErr-afErrNotConfigured  = AFErr 302-afErrNonFree  :: AFErr-afErrNonFree  = AFErr 303-afErrNoDbl  :: AFErr-afErrNoDbl  = AFErr 401-afErrNoGfx  :: AFErr-afErrNoGfx  = AFErr 402-afErrLoadLib  :: AFErr-afErrLoadLib  = AFErr 501-afErrLoadSym  :: AFErr-afErrLoadSym  = AFErr 502-afErrArrBkndMismatch  :: AFErr-afErrArrBkndMismatch  = AFErr 503-afErrInternal  :: AFErr-afErrInternal  = AFErr 998-afErrUnknown  :: AFErr-afErrUnknown  = AFErr 999--{-# LINE 44 "src/ArrayFire/Internal/Defines.hsc" #-}---- | Low-level for representation of ArrayFire types---- | AFDType--- Newtype over ArrayFire's internal type tag-newtype AFDtype = AFDtype-  { afDType :: CInt-  -- ^ Value corresponding to ArrayFire type-  } deriving (Show, Eq, Storable)---- | Enums for AFDtype-f32  :: AFDtype-f32  = AFDtype 0-c32  :: AFDtype-c32  = AFDtype 1-f64  :: AFDtype-f64  = AFDtype 2-c64  :: AFDtype-c64  = AFDtype 3-b8  :: AFDtype-b8  = AFDtype 4-s32  :: AFDtype-s32  = AFDtype 5-u32  :: AFDtype-u32  = AFDtype 6-u8  :: AFDtype-u8  = AFDtype 7-s64  :: AFDtype-s64  = AFDtype 8-u64  :: AFDtype-u64  = AFDtype 9-s16  :: AFDtype-s16  = AFDtype 10-u16  :: AFDtype-u16  = AFDtype 11--{-# LINE 69 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFSource = AFSource CInt-  deriving (Ord, Show, Eq)--afDevice  :: AFSource-afDevice  = AFSource 0-afHost  :: AFSource-afHost  = AFSource 1--{-# LINE 77 "src/ArrayFire/Internal/Defines.hsc" #-}--afMaxDims :: Integer-afMaxDims = 4-{-# LINE 80 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFSomeEnum = AFSomeEnum Int-  deriving (Ord, Show, Eq, Storable)--afSomeEnum  :: AFSomeEnum-afSomeEnum  = AFSomeEnum 0--{-# LINE 87 "src/ArrayFire/Internal/Defines.hsc" #-}----- // A handle for an internal array object-type AFArray = Ptr ()-type AFFeatures = Ptr ()-type AFRandomEngine = Ptr ()---- // A handle for an internal array object-type AFWindow = Ptr ()--newtype AFInterpType = AFInterpType CInt-  deriving (Ord, Show, Eq, Storable)--afInterpNearest  :: AFInterpType-afInterpNearest  = AFInterpType 0-afInterpLinear  :: AFInterpType-afInterpLinear  = AFInterpType 1-afInterpBilinear  :: AFInterpType-afInterpBilinear  = AFInterpType 2-afInterpCubic  :: AFInterpType-afInterpCubic  = AFInterpType 3-afInterpLower  :: AFInterpType-afInterpLower  = AFInterpType 4-afInterpLinearCosine  :: AFInterpType-afInterpLinearCosine  = AFInterpType 5-afInterpBilinearCosine  :: AFInterpType-afInterpBilinearCosine  = AFInterpType 6-afInterpBicubic  :: AFInterpType-afInterpBicubic  = AFInterpType 7-afInterpCubicSpline  :: AFInterpType-afInterpCubicSpline  = AFInterpType 8-afInterpBicubicSpline  :: AFInterpType-afInterpBicubicSpline  = AFInterpType 9--{-# LINE 112 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFBorderType = AFBorderType CInt-  deriving (Ord, Show, Eq, Storable)--afBorderPadZero  :: AFBorderType-afBorderPadZero  = AFBorderType 0-afPadSym  :: AFBorderType-afPadSym  = AFBorderType 1--{-# LINE 120 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFConnectivity = AFConnectivity CInt-  deriving (Ord, Show, Eq, Storable)--afConnectivity4  :: AFConnectivity-afConnectivity4  = AFConnectivity 4-afConnectivity8  :: AFConnectivity-afConnectivity8  = AFConnectivity 8--{-# LINE 128 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFConvMode = AFConvMode CInt-  deriving (Ord, Show, Eq, Storable)--afConvDefault  :: AFConvMode-afConvDefault  = AFConvMode 0-afConvExpand  :: AFConvMode-afConvExpand  = AFConvMode 1--{-# LINE 136 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFConvDomain = AFConvDomain CInt-  deriving (Ord, Show, Eq, Storable)--afConvAuto  :: AFConvDomain-afConvAuto  = AFConvDomain 0-afConvSpatial  :: AFConvDomain-afConvSpatial  = AFConvDomain 1-afConvFreq  :: AFConvDomain-afConvFreq  = AFConvDomain 2--{-# LINE 145 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFMatchType = AFMatchType CInt-  deriving (Ord, Show, Eq, Storable)--afSAD   :: AFMatchType-afSAD   = AFMatchType 0-afZSAD  :: AFMatchType-afZSAD  = AFMatchType 1-afLSAD  :: AFMatchType-afLSAD  = AFMatchType 2-afSSD   :: AFMatchType-afSSD   = AFMatchType 3-afZSSD  :: AFMatchType-afZSSD  = AFMatchType 4-afLSSD  :: AFMatchType-afLSSD  = AFMatchType 5-afNCC   :: AFMatchType-afNCC   = AFMatchType 6-afZNCC  :: AFMatchType-afZNCC  = AFMatchType 7-afSHD   :: AFMatchType-afSHD   = AFMatchType 8--{-# LINE 160 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFYccStd = AFYccStd Int-  deriving (Ord, Show, Eq, Storable)--afYcc601  :: AFYccStd-afYcc601  = AFYccStd 601-afYcc709  :: AFYccStd-afYcc709  = AFYccStd 709-afYcc2020  :: AFYccStd-afYcc2020  = AFYccStd 2020--{-# LINE 169 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFCSpace = AFCSpace Int-  deriving (Ord, Show, Eq, Storable)--afGray  :: AFCSpace-afGray  = AFCSpace 0-afRgb  :: AFCSpace-afRgb  = AFCSpace 1-afHsv  :: AFCSpace-afHsv  = AFCSpace 2-afYCbCr  :: AFCSpace-afYCbCr  = AFCSpace 3--{-# LINE 179 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFMatProp = AFMatProp Int-  deriving (Ord, Show, Eq, Storable)--afMatNone  :: AFMatProp-afMatNone  = AFMatProp 0-afMatTrans  :: AFMatProp-afMatTrans  = AFMatProp 1-afMatCtrans  :: AFMatProp-afMatCtrans  = AFMatProp 2-afMatConj  :: AFMatProp-afMatConj  = AFMatProp 4-afMatUpper  :: AFMatProp-afMatUpper  = AFMatProp 32-afMatLower  :: AFMatProp-afMatLower  = AFMatProp 64-afMatDiagUnit  :: AFMatProp-afMatDiagUnit  = AFMatProp 128-afMatSym  :: AFMatProp-afMatSym  = AFMatProp 512-afMatPosdef  :: AFMatProp-afMatPosdef  = AFMatProp 1024-afMatOrthog  :: AFMatProp-afMatOrthog  = AFMatProp 2048-afMatTriDiag  :: AFMatProp-afMatTriDiag  = AFMatProp 4096-afMatBlockDiag  :: AFMatProp-afMatBlockDiag  = AFMatProp 8192--{-# LINE 197 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFNormType = AFNormType Int-  deriving (Ord, Show, Eq, Storable)--afNormVector1  :: AFNormType-afNormVector1  = AFNormType 0-afNormVectorInf  :: AFNormType-afNormVectorInf  = AFNormType 1-afNormVector2  :: AFNormType-afNormVector2  = AFNormType 2-afNormVectorP  :: AFNormType-afNormVectorP  = AFNormType 3-afNormMatrix1  :: AFNormType-afNormMatrix1  = AFNormType 4-afNormMatrixInf  :: AFNormType-afNormMatrixInf  = AFNormType 5-afNormMatrix2  :: AFNormType-afNormMatrix2  = AFNormType 6-afNormMatrixLPq  :: AFNormType-afNormMatrixLPq  = AFNormType 7-afNormEuclid  :: AFNormType-afNormEuclid  = AFNormType 2--{-# LINE 212 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFImageFormat = AFImageFormat Int-  deriving (Ord, Show, Eq, Storable)--afFIFBmp  :: AFImageFormat-afFIFBmp  = AFImageFormat 0-afFIFIco  :: AFImageFormat-afFIFIco  = AFImageFormat 1-afFIFJpeg  :: AFImageFormat-afFIFJpeg  = AFImageFormat 2-afFIFJng  :: AFImageFormat-afFIFJng  = AFImageFormat 3-afFIFPng  :: AFImageFormat-afFIFPng  = AFImageFormat 13-afFIFPpm  :: AFImageFormat-afFIFPpm  = AFImageFormat 14-afFIFPpmraw  :: AFImageFormat-afFIFPpmraw  = AFImageFormat 15-afFIFTiff  :: AFImageFormat-afFIFTiff  = AFImageFormat 18-afFIFPsd  :: AFImageFormat-afFIFPsd  = AFImageFormat 20-afFIFHdr  :: AFImageFormat-afFIFHdr  = AFImageFormat 26-afFIFExr  :: AFImageFormat-afFIFExr  = AFImageFormat 29-afFIFJp2  :: AFImageFormat-afFIFJp2  = AFImageFormat 31-afFIFRaw  :: AFImageFormat-afFIFRaw  = AFImageFormat 34--{-# LINE 231 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFMomentType = AFMomentType Int-  deriving (Ord, Show, Eq, Storable)--afMomentM00  :: AFMomentType-afMomentM00  = AFMomentType 1-afMomentM01  :: AFMomentType-afMomentM01  = AFMomentType 2-afMomentM10  :: AFMomentType-afMomentM10  = AFMomentType 4-afMomentM11  :: AFMomentType-afMomentM11  = AFMomentType 8-afMomentFirstOrder  :: AFMomentType-afMomentFirstOrder  = AFMomentType 15--{-# LINE 242 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFHomographyType = AFHomographyType CInt-  deriving (Ord, Show, Eq, Storable)--afHomographyRansac  :: AFHomographyType-afHomographyRansac  = AFHomographyType 0-afHomographyLmeds   :: AFHomographyType-afHomographyLmeds   = AFHomographyType 1--{-# LINE 250 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFBackend = AFBackend CInt-  deriving (Ord, Show, Eq, Storable)--afBackendDefault  :: AFBackend-afBackendDefault  = AFBackend 0-afBackendCpu      :: AFBackend-afBackendCpu      = AFBackend 0-afBackendCuda     :: AFBackend-afBackendCuda     = AFBackend 2-afBackendOpencl   :: AFBackend-afBackendOpencl   = AFBackend 4--{-# LINE 260 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFID = AFID CInt-  deriving (Ord, Show, Eq, Storable)---{-# LINE 267 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFBinaryOp = AFBinaryOp CInt-  deriving (Ord, Show, Eq, Storable)--afBinaryAdd   :: AFBinaryOp-afBinaryAdd   = AFBinaryOp 0-afBinaryMul   :: AFBinaryOp-afBinaryMul   = AFBinaryOp 1-afBinaryMin   :: AFBinaryOp-afBinaryMin   = AFBinaryOp 2-afBinaryMax   :: AFBinaryOp-afBinaryMax   = AFBinaryOp 3--{-# LINE 277 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFRandomEngineType = AFRandomEngineType CInt-  deriving (Ord, Show, Eq, Storable)--afRandomEnginePhilox4X3210  :: AFRandomEngineType-afRandomEnginePhilox4X3210  = AFRandomEngineType 100-afRandomEngineThreefry2X3216  :: AFRandomEngineType-afRandomEngineThreefry2X3216  = AFRandomEngineType 200-afRandomEngineMersenneGp11213  :: AFRandomEngineType-afRandomEngineMersenneGp11213  = AFRandomEngineType 300-afRandomEnginePhilox   :: AFRandomEngineType-afRandomEnginePhilox   = AFRandomEngineType 100-afRandomEngineThreefry  :: AFRandomEngineType-afRandomEngineThreefry  = AFRandomEngineType 200-afRandomEngineMersenne  :: AFRandomEngineType-afRandomEngineMersenne  = AFRandomEngineType 300-afRandomEngineDefault  :: AFRandomEngineType-afRandomEngineDefault  = AFRandomEngineType 100--{-# LINE 290 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFColorMap = AFColorMap CInt-  deriving (Ord, Show, Eq, Storable)--afColormapDefault  :: AFColorMap-afColormapDefault  = AFColorMap 0-afColormapSpectrum :: AFColorMap-afColormapSpectrum = AFColorMap 1-afColormapColors   :: AFColorMap-afColormapColors   = AFColorMap 2-afColormapRed      :: AFColorMap-afColormapRed      = AFColorMap 3-afColormapMood     :: AFColorMap-afColormapMood     = AFColorMap 4-afColormapHeat     :: AFColorMap-afColormapHeat     = AFColorMap 5-afColormapBlue     :: AFColorMap-afColormapBlue     = AFColorMap 6-afColormapInferno  :: AFColorMap-afColormapInferno  = AFColorMap 7-afColormapMagma    :: AFColorMap-afColormapMagma    = AFColorMap 8-afColormapPlasma   :: AFColorMap-afColormapPlasma   = AFColorMap 9-afColormapViridis  :: AFColorMap-afColormapViridis  = AFColorMap 10--{-# LINE 307 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFMarkerType = AFMarkerType CInt-  deriving (Ord, Show, Eq, Storable)--afMarkerNone      :: AFMarkerType-afMarkerNone      = AFMarkerType 0-afMarkerPoint     :: AFMarkerType-afMarkerPoint     = AFMarkerType 1-afMarkerCircle    :: AFMarkerType-afMarkerCircle    = AFMarkerType 2-afMarkerSquare    :: AFMarkerType-afMarkerSquare    = AFMarkerType 3-afMarkerTriangle  :: AFMarkerType-afMarkerTriangle  = AFMarkerType 4-afMarkerCross     :: AFMarkerType-afMarkerCross     = AFMarkerType 5-afMarkerPlus      :: AFMarkerType-afMarkerPlus      = AFMarkerType 6-afMarkerStar      :: AFMarkerType-afMarkerStar      = AFMarkerType 7--{-# LINE 321 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFCannyThreshold = AFCannyThreshold CInt-  deriving (Ord, Show, Eq, Storable)--afCannyThresholdManual  :: AFCannyThreshold-afCannyThresholdManual  = AFCannyThreshold 0-afCannyThresholdAutoOtsu  :: AFCannyThreshold-afCannyThresholdAutoOtsu  = AFCannyThreshold 1--{-# LINE 329 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFStorage = AFStorage CInt-  deriving (Ord, Show, Eq, Storable)--afStorageDense  :: AFStorage-afStorageDense  = AFStorage 0-afStorageCsr  :: AFStorage-afStorageCsr  = AFStorage 1-afStorageCsc  :: AFStorage-afStorageCsc  = AFStorage 2-afStorageCoo  :: AFStorage-afStorageCoo  = AFStorage 3--{-# LINE 339 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFFluxFunction = AFFluxFunction CInt-  deriving (Ord, Show, Eq, Storable)--afFluxQuadratic  :: AFFluxFunction-afFluxQuadratic  = AFFluxFunction 1-afFluxExponential  :: AFFluxFunction-afFluxExponential  = AFFluxFunction 2-afFluxDefault  :: AFFluxFunction-afFluxDefault  = AFFluxFunction 0--{-# LINE 348 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFDiffusionEq = AFDiffusionEq CInt-  deriving (Ord, Show, Eq, Storable)--afDiffusionGrad  :: AFDiffusionEq-afDiffusionGrad  = AFDiffusionEq 1-afDiffusionMcde  :: AFDiffusionEq-afDiffusionMcde  = AFDiffusionEq 2-afDiffusionDefault  :: AFDiffusionEq-afDiffusionDefault  = AFDiffusionEq 0--{-# LINE 357 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFTopkFunction = AFTopkFunction CInt-  deriving (Ord, Show, Eq, Storable)--afTopkMin  :: AFTopkFunction-afTopkMin  = AFTopkFunction 1-afTopkMax  :: AFTopkFunction-afTopkMax  = AFTopkFunction 2-afTopkDefault  :: AFTopkFunction-afTopkDefault  = AFTopkFunction 0--{-# LINE 366 "src/ArrayFire/Internal/Defines.hsc" #-}--newtype AFIterativeDeconvAlgo = AFIterativeDeconvAlgo CInt-  deriving (Ord, Show, Eq, Storable)---- #{enum AFIterativeDeconvAlgo, AFIterativeDeconvAlgo--- , afIterativeDeconvLandweber       = AF_ITERATIVE_DECONV_LANDWEBER--- , afIterativeDeconvRichardsonlucy  = AF_ITERATIVE_DECONV_RICHARDSONLUCY--- , afIterativeDeconvDefault         = AF_ITERATIVE_DECONV_DEFAULT--- }--newtype AFInverseDeconvAlgo = AFInverseDeconvAlgo CInt-  deriving (Ord, Show, Eq, Storable)---{-# LINE 383 "src/ArrayFire/Internal/Defines.hsc" #-}---- newtype AFVarBias = AFVarBias Int---   deriving (Ord, Show, Eq)---- #{enum AFVarBias, AFVarBias---  , afVarianceDefault = AF_VARIANCE_DEFAULT---  , afVarianceSample = AF_VARIANCE_SAMPLE---  , afVariancePopulation = AF_VARIANCE_POPULATION--- }--newtype DimT = DimT CLLong-  deriving (Show, Eq, Storable, Num, Integral, Real, Enum, Ord)--newtype UIntL = UIntL CULLong-  deriving (Show, Eq, Storable, Num, Integral, Real, Enum, Ord)--newtype IntL = IntL CLLong-  deriving (Show, Eq, Storable, Num, Integral, Real, Enum, Ord)---- static const af_seq af_span = {1, 1, 0};---- newtype AFCLPlatform = AFCLPlatform Int---   deriving (Show, Eq)---- #{enum AFCLPlatform, AFCLPlatform---  , afclPlatformAMD = AFCL_PLATFORM_AMD---  , afclPlatformApple = AFCL_PLATFORM_APPLE---  , afclPlatformIntel = AFCL_PLATFORM_INTEL---  , afclPlatformNVIDIA = AFCL_PLATFORM_NVIDIA---  , afclPlatformBEIGNET = AFCL_PLATFORM_BEIGNET---  , afclPlatformPOCL = AFCL_PLATFORM_POCL---  , afclPlatformUnknown = AFCL_PLATFORM_UNKNOWN--- }---- newtype DeviceType = DeviceType Int---   deriving (Show, Eq)---- #{enum DeviceType, DeviceType---  , afCLDeviceTypeCPU = AFCL_DEVICE_TYPE_CPU---  , afCLDeviceTypeGPU = AFCL_DEVICE_TYPE_GPU---  , afCLDeviceTypeAccel = AFCL_DEVICE_TYPE_ACCEL---  , afCLDeviceTypeUnknown = AFCL_DEVICE_TYPE_UNKNOWN--- }
− src/ArrayFire/Internal/Device.hs
@@ -1,62 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Device.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Device where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_info"-    af_info :: IO AFErr-foreign import ccall unsafe "af_init"-    af_init :: IO AFErr-foreign import ccall unsafe "af_info_string"-    af_info_string :: Ptr (Ptr CChar) -> CBool -> IO AFErr-foreign import ccall unsafe "af_device_info"-    af_device_info :: Ptr CChar -> Ptr CChar -> Ptr CChar -> Ptr CChar -> IO AFErr-foreign import ccall unsafe "af_get_device_count"-    af_get_device_count :: Ptr CInt -> IO AFErr-foreign import ccall unsafe "af_get_dbl_support"-    af_get_dbl_support :: Ptr CBool -> CInt -> IO AFErr-foreign import ccall unsafe "af_set_device"-    af_set_device :: CInt -> IO AFErr-foreign import ccall unsafe "af_get_device"-    af_get_device :: Ptr CInt -> IO AFErr-foreign import ccall unsafe "af_sync"-    af_sync :: CInt -> IO AFErr-foreign import ccall unsafe "af_alloc_device"-    af_alloc_device :: Ptr (Ptr ()) -> DimT -> IO AFErr-foreign import ccall unsafe "af_free_device"-    af_free_device :: Ptr () -> IO AFErr-foreign import ccall unsafe "af_alloc_pinned"-    af_alloc_pinned :: Ptr (Ptr ()) -> DimT -> IO AFErr-foreign import ccall unsafe "af_free_pinned"-    af_free_pinned :: Ptr () -> IO AFErr-foreign import ccall unsafe "af_alloc_host"-    af_alloc_host :: Ptr (Ptr ()) -> DimT -> IO AFErr-foreign import ccall unsafe "af_free_host"-    af_free_host :: Ptr () -> IO AFErr-foreign import ccall unsafe "af_device_array"-    af_device_array :: Ptr AFArray -> Ptr () -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_device_mem_info"-    af_device_mem_info :: Ptr CSize -> Ptr CSize -> Ptr CSize -> Ptr CSize -> IO AFErr-foreign import ccall unsafe "af_print_mem_info"-    af_print_mem_info :: Ptr CChar -> CInt -> IO AFErr-foreign import ccall unsafe "af_device_gc"-    af_device_gc :: IO AFErr-foreign import ccall unsafe "af_set_mem_step_size"-    af_set_mem_step_size :: CSize -> IO AFErr-foreign import ccall unsafe "af_get_mem_step_size"-    af_get_mem_step_size :: Ptr CSize -> IO AFErr-foreign import ccall unsafe "af_lock_device_ptr"-    af_lock_device_ptr :: AFArray -> IO AFErr-foreign import ccall unsafe "af_unlock_device_ptr"-    af_unlock_device_ptr :: AFArray -> IO AFErr-foreign import ccall unsafe "af_lock_array"-    af_lock_array :: AFArray -> IO AFErr-foreign import ccall unsafe "af_is_locked_array"-    af_is_locked_array :: Ptr CBool -> AFArray -> IO AFErr-foreign import ccall unsafe "af_get_device_ptr"-    af_get_device_ptr :: Ptr (Ptr ()) -> AFArray -> IO AFErr
− src/ArrayFire/Internal/Exception.hs
@@ -1,14 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Exception.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Exception where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_get_last_error"-    af_get_last_error :: Ptr (Ptr CChar) -> Ptr DimT -> IO ()-foreign import ccall unsafe "af_err_to_string"-    af_err_to_string :: AFErr -> IO (Ptr CChar)
− src/ArrayFire/Internal/Features.hs
@@ -1,28 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Features.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Features where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_create_features"-    af_create_features :: Ptr AFFeatures -> DimT -> IO AFErr-foreign import ccall unsafe "af_retain_features"-    af_retain_features :: Ptr AFFeatures -> AFFeatures -> IO AFErr-foreign import ccall unsafe "af_get_features_num"-    af_get_features_num :: Ptr DimT -> AFFeatures -> IO AFErr-foreign import ccall unsafe "af_get_features_xpos"-    af_get_features_xpos :: Ptr AFArray -> AFFeatures -> IO AFErr-foreign import ccall unsafe "af_get_features_ypos"-    af_get_features_ypos :: Ptr AFArray -> AFFeatures -> IO AFErr-foreign import ccall unsafe "af_get_features_score"-    af_get_features_score :: Ptr AFArray -> AFFeatures -> IO AFErr-foreign import ccall unsafe "af_get_features_orientation"-    af_get_features_orientation :: Ptr AFArray -> AFFeatures -> IO AFErr-foreign import ccall unsafe "af_get_features_size"-    af_get_features_size :: Ptr AFArray -> AFFeatures -> IO AFErr-foreign import ccall unsafe "&af_release_features"-    af_release_features :: FunPtr (AFFeatures -> IO ())
− src/ArrayFire/Internal/Graphics.hs
@@ -1,69 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Graphics.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Graphics where--import ArrayFire.Internal.Defines-import ArrayFire.Internal.Types--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_create_window"-    af_create_window :: Ptr AFWindow -> CInt -> CInt -> Ptr CChar -> IO AFErr-foreign import ccall unsafe "af_set_position"-    af_set_position :: AFWindow -> CUInt -> CUInt -> IO AFErr-foreign import ccall unsafe "af_set_title"-    af_set_title :: AFWindow -> Ptr CChar -> IO AFErr-foreign import ccall unsafe "af_set_size"-    af_set_size :: AFWindow -> CUInt -> CUInt -> IO AFErr-foreign import ccall unsafe "af_draw_image"-    af_draw_image :: AFWindow -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_plot"-    af_draw_plot :: AFWindow -> AFArray -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_plot3"-    af_draw_plot3 :: AFWindow -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_plot_nd"-    af_draw_plot_nd :: AFWindow -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_plot_2d"-    af_draw_plot_2d :: AFWindow -> AFArray -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_plot_3d"-    af_draw_plot_3d :: AFWindow -> AFArray -> AFArray -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_scatter"-    af_draw_scatter :: AFWindow -> AFArray -> AFArray -> AFMarkerType -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_scatter3"-    af_draw_scatter3 :: AFWindow -> AFArray -> AFMarkerType -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_scatter_nd"-    af_draw_scatter_nd :: AFWindow -> AFArray -> AFMarkerType -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_scatter_2d"-    af_draw_scatter_2d :: AFWindow -> AFArray -> AFArray -> AFMarkerType -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_scatter_3d"-    af_draw_scatter_3d :: AFWindow -> AFArray -> AFArray -> AFArray -> AFMarkerType -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_hist"-    af_draw_hist :: AFWindow -> AFArray -> Double -> Double -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_surface"-    af_draw_surface :: AFWindow -> AFArray -> AFArray -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_vector_field_nd"-    af_draw_vector_field_nd :: AFWindow -> AFArray -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_vector_field_3d"-    af_draw_vector_field_3d :: AFWindow -> AFArray -> AFArray -> AFArray -> AFArray -> AFArray -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_draw_vector_field_2d"-    af_draw_vector_field_2d :: AFWindow -> AFArray -> AFArray -> AFArray -> AFArray -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_grid"-    af_grid :: AFWindow -> CInt -> CInt -> IO AFErr-foreign import ccall unsafe "af_set_axes_limits_compute"-    af_set_axes_limits_compute :: AFWindow -> AFArray -> AFArray -> AFArray -> CBool -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_set_axes_limits_2d"-    af_set_axes_limits_2d :: AFWindow -> Float -> Float -> Float -> Float -> CBool -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_set_axes_limits_3d"-    af_set_axes_limits_3d :: AFWindow -> Float -> Float -> Float -> Float -> Float -> Float -> CBool -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_set_axes_titles"-    af_set_axes_titles :: AFWindow -> Ptr CChar -> Ptr CChar -> Ptr CChar -> Ptr AFCell -> IO AFErr-foreign import ccall unsafe "af_show"-    af_show :: AFWindow -> IO AFErr-foreign import ccall unsafe "af_is_window_closed"-    af_is_window_closed :: Ptr CBool -> AFWindow -> IO AFErr-foreign import ccall unsafe "af_set_visibility"-    af_set_visibility :: AFWindow -> CBool -> IO AFErr-foreign import ccall unsafe "af_destroy_window"-    af_destroy_window :: AFWindow -> IO AFErr
− src/ArrayFire/Internal/Image.hs
@@ -1,96 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Image.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Image where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_gradient"-    af_gradient :: Ptr AFArray -> Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_load_image"-    af_load_image :: Ptr AFArray -> Ptr CChar -> CBool -> IO AFErr-foreign import ccall unsafe "af_save_image"-    af_save_image :: Ptr CChar -> AFArray -> IO AFErr-foreign import ccall unsafe "af_load_image_memory"-    af_load_image_memory :: Ptr AFArray -> Ptr () -> IO AFErr-foreign import ccall unsafe "af_save_image_memory"-    af_save_image_memory :: Ptr (Ptr ()) -> AFArray -> AFImageFormat -> IO AFErr-foreign import ccall unsafe "af_delete_image_memory"-    af_delete_image_memory :: Ptr () -> IO AFErr-foreign import ccall unsafe "af_load_image_native"-    af_load_image_native :: Ptr AFArray -> Ptr CChar -> IO AFErr-foreign import ccall unsafe "af_save_image_native"-    af_save_image_native :: Ptr CChar -> AFArray -> IO AFErr-foreign import ccall unsafe "af_is_image_io_available"-    af_is_image_io_available :: Ptr CBool -> IO AFErr-foreign import ccall unsafe "af_resize"-    af_resize :: Ptr AFArray -> AFArray -> DimT -> DimT -> AFInterpType -> IO AFErr-foreign import ccall unsafe "af_transform"-    af_transform :: Ptr AFArray -> AFArray -> AFArray -> DimT -> DimT -> AFInterpType -> CBool -> IO AFErr-foreign import ccall unsafe "af_transform_coordinates"-    af_transform_coordinates :: Ptr AFArray -> AFArray -> Float -> Float -> IO AFErr-foreign import ccall unsafe "af_rotate"-    af_rotate :: Ptr AFArray -> AFArray -> Float -> CBool -> AFInterpType -> IO AFErr-foreign import ccall unsafe "af_translate"-    af_translate :: Ptr AFArray -> AFArray -> Float -> Float -> DimT -> DimT -> AFInterpType -> IO AFErr-foreign import ccall unsafe "af_scale"-    af_scale :: Ptr AFArray -> AFArray -> Float -> Float -> DimT -> DimT -> AFInterpType -> IO AFErr-foreign import ccall unsafe "af_skew"-    af_skew :: Ptr AFArray -> AFArray -> Float -> Float -> DimT -> DimT -> AFInterpType -> CBool -> IO AFErr-foreign import ccall unsafe "af_histogram"-    af_histogram :: Ptr AFArray -> AFArray -> CUInt -> Double -> Double -> IO AFErr-foreign import ccall unsafe "af_dilate"-    af_dilate :: Ptr AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_dilate3"-    af_dilate3 :: Ptr AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_erode"-    af_erode :: Ptr AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_erode3"-    af_erode3 :: Ptr AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_bilateral"-    af_bilateral :: Ptr AFArray -> AFArray -> Float -> Float -> CBool -> IO AFErr-foreign import ccall unsafe "af_mean_shift"-    af_mean_shift :: Ptr AFArray -> AFArray -> Float -> Float -> CUInt -> CBool -> IO AFErr-foreign import ccall unsafe "af_minfilt"-    af_minfilt :: Ptr AFArray -> AFArray -> DimT -> DimT -> AFBorderType -> IO AFErr-foreign import ccall unsafe "af_maxfilt"-    af_maxfilt :: Ptr AFArray -> AFArray -> DimT -> DimT -> AFBorderType -> IO AFErr-foreign import ccall unsafe "af_regions"-    af_regions :: Ptr AFArray -> AFArray -> AFConnectivity -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_sobel_operator"-    af_sobel_operator :: Ptr AFArray -> Ptr AFArray -> AFArray -> CUInt -> IO AFErr-foreign import ccall unsafe "af_rgb2gray"-    af_rgb2gray :: Ptr AFArray -> AFArray -> Float -> Float -> Float -> IO AFErr-foreign import ccall unsafe "af_gray2rgb"-    af_gray2rgb :: Ptr AFArray -> AFArray -> Float -> Float -> Float -> IO AFErr-foreign import ccall unsafe "af_hist_equal"-    af_hist_equal :: Ptr AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_gaussian_kernel"-    af_gaussian_kernel :: Ptr AFArray -> CInt -> CInt -> Double -> Double -> IO AFErr-foreign import ccall unsafe "af_hsv2rgb"-    af_hsv2rgb :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_rgb2hsv"-    af_rgb2hsv :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_color_space"-    af_color_space :: Ptr AFArray -> AFArray -> AFCSpace -> AFCSpace -> IO AFErr-foreign import ccall unsafe "af_unwrap"-    af_unwrap :: Ptr AFArray -> AFArray -> DimT -> DimT -> DimT -> DimT -> DimT -> DimT -> CBool -> IO AFErr-foreign import ccall unsafe "af_wrap"-    af_wrap :: Ptr AFArray -> AFArray -> DimT -> DimT -> DimT -> DimT -> DimT -> DimT -> DimT -> DimT -> CBool -> IO AFErr-foreign import ccall unsafe "af_sat"-    af_sat :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_ycbcr2rgb"-    af_ycbcr2rgb :: Ptr AFArray -> AFArray -> AFYccStd -> IO AFErr-foreign import ccall unsafe "af_rgb2ycbcr"-    af_rgb2ycbcr :: Ptr AFArray -> AFArray -> AFYccStd -> IO AFErr-foreign import ccall unsafe "af_moments"-    af_moments :: Ptr AFArray -> AFArray -> AFMomentType -> IO AFErr-foreign import ccall unsafe "af_moments_all"-    af_moments_all :: Ptr Double -> AFArray -> AFMomentType -> IO AFErr-foreign import ccall unsafe "af_canny"-    af_canny :: Ptr AFArray -> AFArray -> AFCannyThreshold -> Float -> Float -> CUInt -> CBool -> IO AFErr-foreign import ccall unsafe "af_anisotropic_diffusion"-    af_anisotropic_diffusion :: Ptr AFArray -> AFArray -> Float -> Float -> CUInt -> AFFluxFunction -> AFDiffusionEq -> IO AFErr
− src/ArrayFire/Internal/Index.hs
@@ -1,31 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Index.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Index where--import ArrayFire.Internal.Defines-import ArrayFire.Internal.Types--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_index"-    af_index :: Ptr AFArray -> AFArray -> CUInt -> Ptr AFSeq -> IO AFErr-foreign import ccall unsafe "af_lookup"-    af_lookup :: Ptr AFArray -> AFArray -> AFArray -> CUInt -> IO AFErr-foreign import ccall unsafe "af_assign_seq"-    af_assign_seq :: Ptr AFArray -> AFArray -> CUInt -> Ptr AFSeq -> AFArray -> IO AFErr-foreign import ccall unsafe "af_index_gen"-    af_index_gen :: Ptr AFArray -> AFArray -> DimT -> Ptr AFIndex -> IO AFErr-foreign import ccall unsafe "af_assign_gen"-    af_assign_gen :: Ptr AFArray -> AFArray -> DimT -> Ptr AFIndex -> AFArray -> IO AFErr-foreign import ccall unsafe "af_create_indexers"-    af_create_indexers :: Ptr (Ptr AFIndex) -> IO AFErr-foreign import ccall unsafe "af_set_array_indexer"-    af_set_array_indexer :: Ptr AFIndex -> AFArray -> DimT -> IO AFErr-foreign import ccall unsafe "af_set_seq_indexer"-    af_set_seq_indexer :: Ptr AFIndex -> Ptr AFSeq -> DimT -> CBool -> IO AFErr-foreign import ccall unsafe "af_set_seq_param_indexer"-    af_set_seq_param_indexer :: Ptr AFIndex -> Double -> Double -> Double -> DimT -> CBool -> IO AFErr-foreign import ccall unsafe "af_release_indexers"-    af_release_indexers :: Ptr AFIndex -> IO AFErr
− src/ArrayFire/Internal/LAPACK.hs
@@ -1,40 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/LAPACK.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.LAPACK where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_svd"-    af_svd :: Ptr AFArray -> Ptr AFArray -> Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_svd_inplace"-    af_svd_inplace :: Ptr AFArray -> Ptr AFArray -> Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_lu"-    af_lu :: Ptr AFArray -> Ptr AFArray -> Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_lu_inplace"-    af_lu_inplace :: Ptr AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_qr"-    af_qr :: Ptr AFArray -> Ptr AFArray -> Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_qr_inplace"-    af_qr_inplace :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_cholesky"-    af_cholesky :: Ptr AFArray -> Ptr CInt -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_cholesky_inplace"-    af_cholesky_inplace :: Ptr CInt -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_solve"-    af_solve :: Ptr AFArray -> AFArray -> AFArray -> AFMatProp -> IO AFErr-foreign import ccall unsafe "af_solve_lu"-    af_solve_lu :: Ptr AFArray -> AFArray -> AFArray -> AFArray -> AFMatProp -> IO AFErr-foreign import ccall unsafe "af_inverse"-    af_inverse :: Ptr AFArray -> AFArray -> AFMatProp -> IO AFErr-foreign import ccall unsafe "af_rank"-    af_rank :: Ptr CUInt -> AFArray -> Double -> IO AFErr-foreign import ccall unsafe "af_det"-    af_det :: Ptr Double -> Ptr Double -> AFArray -> IO AFErr-foreign import ccall unsafe "af_norm"-    af_norm :: Ptr Double -> AFArray -> AFNormType -> Double -> Double -> IO AFErr-foreign import ccall unsafe "af_is_lapack_available"-    af_is_lapack_available :: Ptr CBool -> IO AFErr
− src/ArrayFire/Internal/Random.hs
@@ -1,40 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Random.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Random where--import ArrayFire.Internal.Defines--import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_create_random_engine"-    af_create_random_engine :: Ptr AFRandomEngine -> AFRandomEngineType -> UIntL -> IO AFErr-foreign import ccall unsafe "af_retain_random_engine"-    af_retain_random_engine :: Ptr AFRandomEngine -> AFRandomEngine -> IO AFErr-foreign import ccall unsafe "af_random_engine_set_type"-    af_random_engine_set_type :: Ptr AFRandomEngine -> AFRandomEngineType -> IO AFErr-foreign import ccall unsafe "af_random_engine_get_type"-    af_random_engine_get_type :: Ptr AFRandomEngineType -> AFRandomEngine -> IO AFErr-foreign import ccall unsafe "af_random_uniform"-    af_random_uniform :: Ptr AFArray -> CUInt -> Ptr DimT -> AFDtype -> AFRandomEngine -> IO AFErr-foreign import ccall unsafe "af_random_normal"-    af_random_normal :: Ptr AFArray -> CUInt -> Ptr DimT -> AFDtype -> AFRandomEngine -> IO AFErr-foreign import ccall unsafe "af_random_engine_set_seed"-    af_random_engine_set_seed :: Ptr AFRandomEngine -> UIntL -> IO AFErr-foreign import ccall unsafe "af_get_default_random_engine"-    af_get_default_random_engine :: Ptr AFRandomEngine -> IO AFErr-foreign import ccall unsafe "af_set_default_random_engine_type"-    af_set_default_random_engine_type :: AFRandomEngineType -> IO AFErr-foreign import ccall unsafe "af_random_engine_get_seed"-    af_random_engine_get_seed :: Ptr UIntL -> AFRandomEngine -> IO AFErr-foreign import ccall unsafe "af_release_random_engine"-    af_release_random_engine :: AFRandomEngine -> IO AFErr-foreign import ccall unsafe "af_randu"-    af_randu :: Ptr AFArray -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_randn"-    af_randn :: Ptr AFArray -> CUInt -> Ptr DimT -> AFDtype -> IO AFErr-foreign import ccall unsafe "af_set_seed"-    af_set_seed :: UIntL -> IO AFErr-foreign import ccall unsafe "af_get_seed"-    af_get_seed :: Ptr UIntL -> IO AFErr
− src/ArrayFire/Internal/Signal.hs
@@ -1,75 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Signal.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Signal where--import ArrayFire.Internal.Defines-import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_approx1"-    af_approx1 :: Ptr AFArray -> AFArray -> AFArray -> AFInterpType -> Float -> IO AFErr-foreign import ccall unsafe "af_approx2"-    af_approx2 :: Ptr AFArray -> AFArray -> AFArray -> AFArray -> AFInterpType -> Float -> IO AFErr-foreign import ccall unsafe "af_fft"-    af_fft :: Ptr AFArray -> AFArray -> Double -> DimT -> IO AFErr-foreign import ccall unsafe "af_fft_inplace"-    af_fft_inplace :: AFArray -> Double -> IO AFErr-foreign import ccall unsafe "af_fft2"-    af_fft2 :: Ptr AFArray -> AFArray -> Double -> DimT -> DimT -> IO AFErr-foreign import ccall unsafe "af_fft2_inplace"-    af_fft2_inplace :: AFArray -> Double -> IO AFErr-foreign import ccall unsafe "af_fft3"-    af_fft3 :: Ptr AFArray -> AFArray -> Double -> DimT -> DimT -> DimT -> IO AFErr-foreign import ccall unsafe "af_fft3_inplace"-    af_fft3_inplace :: AFArray -> Double -> IO AFErr-foreign import ccall unsafe "af_ifft"-    af_ifft :: Ptr AFArray -> AFArray -> Double -> DimT -> IO AFErr-foreign import ccall unsafe "af_ifft_inplace"-    af_ifft_inplace :: AFArray -> Double -> IO AFErr-foreign import ccall unsafe "af_ifft2"-    af_ifft2 :: Ptr AFArray -> AFArray -> Double -> DimT -> DimT -> IO AFErr-foreign import ccall unsafe "af_ifft2_inplace"-    af_ifft2_inplace :: AFArray -> Double -> IO AFErr-foreign import ccall unsafe "af_ifft3"-    af_ifft3 :: Ptr AFArray -> AFArray -> Double -> DimT -> DimT -> DimT -> IO AFErr-foreign import ccall unsafe "af_ifft3_inplace"-    af_ifft3_inplace :: AFArray -> Double -> IO AFErr-foreign import ccall unsafe "af_fft_r2c"-    af_fft_r2c :: Ptr AFArray -> AFArray -> Double -> DimT -> IO AFErr-foreign import ccall unsafe "af_fft2_r2c"-    af_fft2_r2c :: Ptr AFArray -> AFArray -> Double -> DimT -> DimT -> IO AFErr-foreign import ccall unsafe "af_fft3_r2c"-    af_fft3_r2c :: Ptr AFArray -> AFArray -> Double -> DimT -> DimT -> DimT -> IO AFErr-foreign import ccall unsafe "af_fft_c2r"-    af_fft_c2r :: Ptr AFArray -> AFArray -> Double -> CBool -> IO AFErr-foreign import ccall unsafe "af_fft2_c2r"-    af_fft2_c2r :: Ptr AFArray -> AFArray -> Double -> CBool -> IO AFErr-foreign import ccall unsafe "af_fft3_c2r"-    af_fft3_c2r :: Ptr AFArray -> AFArray -> Double -> CBool -> IO AFErr-foreign import ccall unsafe "af_convolve1"-    af_convolve1 :: Ptr AFArray -> AFArray -> AFArray -> AFConvMode -> AFConvDomain -> IO AFErr-foreign import ccall unsafe "af_convolve2"-    af_convolve2 :: Ptr AFArray -> AFArray -> AFArray -> AFConvMode -> AFConvDomain -> IO AFErr-foreign import ccall unsafe "af_convolve3"-    af_convolve3 :: Ptr AFArray -> AFArray -> AFArray -> AFConvMode -> AFConvDomain -> IO AFErr-foreign import ccall unsafe "af_convolve2_sep"-    af_convolve2_sep :: Ptr AFArray -> AFArray -> AFArray -> AFArray -> AFConvMode -> IO AFErr-foreign import ccall unsafe "af_fft_convolve1"-    af_fft_convolve1 :: Ptr AFArray -> AFArray -> AFArray -> AFConvMode -> IO AFErr-foreign import ccall unsafe "af_fft_convolve2"-    af_fft_convolve2 :: Ptr AFArray -> AFArray -> AFArray -> AFConvMode -> IO AFErr-foreign import ccall unsafe "af_fft_convolve3"-    af_fft_convolve3 :: Ptr AFArray -> AFArray -> AFArray -> AFConvMode -> IO AFErr-foreign import ccall unsafe "af_fir"-    af_fir :: Ptr AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_iir"-    af_iir :: Ptr AFArray -> AFArray -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_medfilt"-    af_medfilt :: Ptr AFArray -> AFArray -> DimT -> DimT -> AFBorderType -> IO AFErr-foreign import ccall unsafe "af_medfilt1"-    af_medfilt1 :: Ptr AFArray -> AFArray -> DimT -> AFBorderType -> IO AFErr-foreign import ccall unsafe "af_medfilt2"-    af_medfilt2 :: Ptr AFArray -> AFArray -> DimT -> DimT -> AFBorderType -> IO AFErr-foreign import ccall unsafe "af_set_fft_plan_cache_size"-    af_set_fft_plan_cache_size :: CSize -> IO AFErr
− src/ArrayFire/Internal/Sparse.hs
@@ -1,31 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Sparse.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Sparse where--import ArrayFire.Internal.Defines-import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_create_sparse_array"-    af_create_sparse_array :: Ptr AFArray -> DimT -> DimT -> AFArray -> AFArray -> AFArray -> AFStorage -> IO AFErr-foreign import ccall unsafe "af_create_sparse_array_from_ptr"-    af_create_sparse_array_from_ptr :: Ptr AFArray -> DimT -> DimT -> DimT -> Ptr () -> Ptr CInt -> Ptr CInt -> AFDtype -> AFStorage -> AFSource -> IO AFErr-foreign import ccall unsafe "af_create_sparse_array_from_dense"-    af_create_sparse_array_from_dense :: Ptr AFArray -> AFArray -> AFStorage -> IO AFErr-foreign import ccall unsafe "af_sparse_convert_to"-    af_sparse_convert_to :: Ptr AFArray -> AFArray -> AFStorage -> IO AFErr-foreign import ccall unsafe "af_sparse_to_dense"-    af_sparse_to_dense :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sparse_get_info"-    af_sparse_get_info :: Ptr AFArray -> Ptr AFArray -> Ptr AFArray -> Ptr AFStorage -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sparse_get_values"-    af_sparse_get_values :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sparse_get_row_idx"-    af_sparse_get_row_idx :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sparse_get_col_idx"-    af_sparse_get_col_idx :: Ptr AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sparse_get_nnz"-    af_sparse_get_nnz :: Ptr DimT -> AFArray -> IO AFErr-foreign import ccall unsafe "af_sparse_get_storage"-    af_sparse_get_storage :: Ptr AFStorage -> AFArray -> IO AFErr
− src/ArrayFire/Internal/Statistics.hs
@@ -1,39 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Statistics.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Statistics where--import ArrayFire.Internal.Defines-import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_mean"-    af_mean :: Ptr AFArray -> AFArray -> DimT -> IO AFErr-foreign import ccall unsafe "af_mean_weighted"-    af_mean_weighted :: Ptr AFArray -> AFArray -> AFArray -> DimT -> IO AFErr-foreign import ccall unsafe "af_var"-    af_var :: Ptr AFArray -> AFArray -> CBool -> DimT -> IO AFErr-foreign import ccall unsafe "af_var_weighted"-    af_var_weighted :: Ptr AFArray -> AFArray -> AFArray -> DimT -> IO AFErr-foreign import ccall unsafe "af_stdev"-    af_stdev :: Ptr AFArray -> AFArray -> DimT -> IO AFErr-foreign import ccall unsafe "af_cov"-    af_cov :: Ptr AFArray -> AFArray -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_median"-    af_median :: Ptr AFArray -> AFArray -> DimT -> IO AFErr-foreign import ccall unsafe "af_mean_all"-    af_mean_all :: Ptr Double -> Ptr Double -> AFArray -> IO AFErr-foreign import ccall unsafe "af_mean_all_weighted"-    af_mean_all_weighted :: Ptr Double -> Ptr Double -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_var_all"-    af_var_all :: Ptr Double -> Ptr Double -> AFArray -> CBool -> IO AFErr-foreign import ccall unsafe "af_var_all_weighted"-    af_var_all_weighted :: Ptr Double -> Ptr Double -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_stdev_all"-    af_stdev_all :: Ptr Double -> Ptr Double -> AFArray -> IO AFErr-foreign import ccall unsafe "af_median_all"-    af_median_all :: Ptr Double -> Ptr Double -> AFArray -> IO AFErr-foreign import ccall unsafe "af_corrcoef"-    af_corrcoef :: Ptr Double -> Ptr Double -> AFArray -> AFArray -> IO AFErr-foreign import ccall unsafe "af_topk"-    af_topk :: Ptr AFArray -> Ptr AFArray -> AFArray -> CInt -> CInt -> AFTopkFunction -> IO AFErr
− src/ArrayFire/Internal/Types.hs
@@ -1,728 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Types.hsc" #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE ViewPatterns      #-}-{-# LANGUAGE RecordWildCards   #-}-{-# LANGUAGE CPP               #-}-module ArrayFire.Internal.Types where-------import ArrayFire.Internal.Defines--import Data.Complex-import Data.Proxy-import Data.Word-import Foreign.C.String-import Foreign.C.Types-import Foreign.ForeignPtr-import Foreign.Storable-import GHC.Int--data AFSeq-  = AFSeq-  { afSeqBegin :: {-# UNPACK #-} !Double-  , afSeqEnd   :: {-# UNPACK #-} !Double-  , afSeqStep  :: {-# UNPACK #-} !Double-  } deriving (Show, Eq)--instance Storable AFSeq where-  sizeOf _ = (24)-{-# LINE 32 "src/ArrayFire/Internal/Types.hsc" #-}-  alignment _ = 8-{-# LINE 33 "src/ArrayFire/Internal/Types.hsc" #-}-  peek ptr = do-    afSeqBegin <- (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr-{-# LINE 35 "src/ArrayFire/Internal/Types.hsc" #-}-    afSeqEnd <- (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr-{-# LINE 36 "src/ArrayFire/Internal/Types.hsc" #-}-    afSeqStep <- (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr-{-# LINE 37 "src/ArrayFire/Internal/Types.hsc" #-}-    pure AFSeq {..}-  poke ptr AFSeq{..} = do-    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr afSeqBegin-{-# LINE 40 "src/ArrayFire/Internal/Types.hsc" #-}-    (\hsc_ptr -> pokeByteOff hsc_ptr 8) ptr afSeqEnd-{-# LINE 41 "src/ArrayFire/Internal/Types.hsc" #-}-    (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr afSeqStep-{-# LINE 42 "src/ArrayFire/Internal/Types.hsc" #-}---- | Type used for indexing into 'Array'-data AFIndex-  = AFIndex-  { afIdx :: !(Either AFArray AFSeq)-  , afIsSeq :: !Bool-  , afIsBatch :: !Bool-  }-instance Storable AFIndex where-  sizeOf _ = (32)-{-# LINE 52 "src/ArrayFire/Internal/Types.hsc" #-}-  alignment _ = 8-{-# LINE 53 "src/ArrayFire/Internal/Types.hsc" #-}-  peek ptr = do-    afIsSeq <- (\hsc_ptr -> peekByteOff hsc_ptr 24) ptr-{-# LINE 55 "src/ArrayFire/Internal/Types.hsc" #-}-    afIsBatch <- (\hsc_ptr -> peekByteOff hsc_ptr 25) ptr-{-# LINE 56 "src/ArrayFire/Internal/Types.hsc" #-}-    afIdx <--      if afIsSeq-        then Left <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr-{-# LINE 59 "src/ArrayFire/Internal/Types.hsc" #-}-        else Right <$> (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr-{-# LINE 60 "src/ArrayFire/Internal/Types.hsc" #-}-    pure AFIndex{..}-  poke ptr AFIndex{..} = do-    case afIdx of-      Left afarr -> (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr afarr-{-# LINE 64 "src/ArrayFire/Internal/Types.hsc" #-}-      Right afseq -> (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr afseq-{-# LINE 65 "src/ArrayFire/Internal/Types.hsc" #-}-    (\hsc_ptr -> pokeByteOff hsc_ptr 24) ptr afIsSeq-{-# LINE 66 "src/ArrayFire/Internal/Types.hsc" #-}-    (\hsc_ptr -> pokeByteOff hsc_ptr 25) ptr afIsBatch-{-# LINE 67 "src/ArrayFire/Internal/Types.hsc" #-}--data AFCFloat-  = AFCFloat-  { afcReal :: {-# UNPACK #-} !Float-  , afcImag :: {-# UNPACK #-} !Float-  } deriving (Eq, Show)--instance Storable AFCFloat where-  sizeOf _ = (8)-{-# LINE 76 "src/ArrayFire/Internal/Types.hsc" #-}-  alignment _ = 4-{-# LINE 77 "src/ArrayFire/Internal/Types.hsc" #-}-  peek ptr = do-    afcReal <- (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr-{-# LINE 79 "src/ArrayFire/Internal/Types.hsc" #-}-    afcImag <- (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr-{-# LINE 80 "src/ArrayFire/Internal/Types.hsc" #-}-    pure AFCFloat{..}-  poke ptr AFCFloat{..} = do-    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr afcReal-{-# LINE 83 "src/ArrayFire/Internal/Types.hsc" #-}-    (\hsc_ptr -> pokeByteOff hsc_ptr 4) ptr afcImag-{-# LINE 84 "src/ArrayFire/Internal/Types.hsc" #-}--data AFCell-  = AFCell-  { afCellRow :: {-# UNPACK #-} !Int-  , afCellCol :: {-# UNPACK #-} !Int-  , afCellTitle :: {-# UNPACK #-} !CString-  , afCellColorMap :: {-# UNPACK #-} !AFColorMap-  } deriving (Show, Eq)--instance Storable AFCell where-  sizeOf _ = (24)-{-# LINE 95 "src/ArrayFire/Internal/Types.hsc" #-}-  alignment _ = 8-{-# LINE 96 "src/ArrayFire/Internal/Types.hsc" #-}-  peek ptr = do-    afCellRow <- (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr-{-# LINE 98 "src/ArrayFire/Internal/Types.hsc" #-}-    afCellCol <- (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr-{-# LINE 99 "src/ArrayFire/Internal/Types.hsc" #-}-    afCellTitle <- (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr-{-# LINE 100 "src/ArrayFire/Internal/Types.hsc" #-}-    afCellColorMap <- (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr-{-# LINE 101 "src/ArrayFire/Internal/Types.hsc" #-}-    pure AFCell{..}-  poke ptr AFCell{..} = do-    (\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr afCellRow-{-# LINE 104 "src/ArrayFire/Internal/Types.hsc" #-}-    (\hsc_ptr -> pokeByteOff hsc_ptr 4) ptr afCellCol-{-# LINE 105 "src/ArrayFire/Internal/Types.hsc" #-}-    (\hsc_ptr -> pokeByteOff hsc_ptr 8) ptr afCellTitle-{-# LINE 106 "src/ArrayFire/Internal/Types.hsc" #-}-    (\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr afCellColorMap-{-# LINE 107 "src/ArrayFire/Internal/Types.hsc" #-}---- | ArrayFire 'Array'-newtype Array a = Array (ForeignPtr ())---- | ArrayFire 'Features'-newtype Features = Features (ForeignPtr ())---- | ArrayFire 'RandomEngine'-newtype RandomEngine = RandomEngine (ForeignPtr ())---- | ArrayFire 'Window'-newtype Window = Window (ForeignPtr ())---- | Mapping of Haskell types to ArrayFire types-class Storable a => AFType a where-  afType :: Proxy a -> AFDtype--instance AFType Double where-  afType Proxy = f64--instance AFType Float where-  afType Proxy = f32--instance AFType (Complex Double) where-  afType Proxy = c64--instance AFType (Complex Float) where-  afType Proxy = c32--instance AFType CBool where-  afType Proxy = b8--instance AFType Int32 where-  afType Proxy = s32--instance AFType Word32 where-  afType Proxy = u32--instance AFType Word8 where-  afType Proxy = u8--instance AFType Int64 where-  afType Proxy = s64--instance AFType Int where-  afType Proxy = s64--instance AFType Int16 where-  afType Proxy = s16--instance AFType Word16 where-  afType Proxy = u16--instance AFType Word64 where-  afType Proxy = u64--instance AFType Word where-  afType Proxy = u64---- | ArrayFire backends-data Backend-  = Default-  | CPU-  | CUDA-  | OpenCL-  deriving (Show, Eq, Ord)---- | Low-level to high-level Backend conversion-toBackend :: AFBackend -> Backend-toBackend (AFBackend 0) = Default-toBackend (AFBackend 1) = CPU-toBackend (AFBackend 2) = CUDA-toBackend (AFBackend 4) = OpenCL-toBackend (AFBackend x) = error $ "Invalid backend: " <> show x---- | High-level to low-level Backend conversion-toAFBackend :: Backend -> AFBackend-toAFBackend Default = (AFBackend 0)-toAFBackend CPU = (AFBackend 1)-toAFBackend CUDA = (AFBackend 2)-toAFBackend OpenCL = (AFBackend 4)---- | Read multiple backends-toBackends :: Int -> [Backend]-toBackends 1 = [CPU]-toBackends 2 = [CUDA]-toBackends 3 = [CPU,CUDA]-toBackends 4 = [OpenCL]-toBackends 5 = [CPU,OpenCL]-toBackends 6 = [CUDA,OpenCL]-toBackends 7 = [CPU,CUDA,OpenCL]-toBackends _ = []---- | Matrix properties-data MatProp-  = None-  | Trans-  | CTrans-  | Conj-  | Upper-  | Lower-  | DiagUnit-  | Sym-  | PosDef-  | Orthog-  | TriDiag-  | BlockDiag-  deriving (Show, Eq, Ord)---- | Low-level to High-level 'MatProp' conversion-fromMatProp-  :: AFMatProp-  -> MatProp-fromMatProp (AFMatProp 0) = None-fromMatProp (AFMatProp 1) = Trans-fromMatProp (AFMatProp 2) = CTrans-fromMatProp (AFMatProp 4) = Conj-fromMatProp (AFMatProp 32) = Upper-fromMatProp (AFMatProp 64) = Lower-fromMatProp (AFMatProp 128) = DiagUnit-fromMatProp (AFMatProp 512) = Sym-fromMatProp (AFMatProp 1024) = PosDef-fromMatProp (AFMatProp 2048) = Orthog-fromMatProp (AFMatProp 4096) = TriDiag-fromMatProp (AFMatProp 8192) = BlockDiag-fromMatProp x = error $ "Invalid AFMatProp value: " <> show x---- | High-level to low-level 'MatProp' conversion-toMatProp-  :: MatProp-  -> AFMatProp-toMatProp None = (AFMatProp 0)-toMatProp Trans = (AFMatProp 1)-toMatProp CTrans = (AFMatProp 2)-toMatProp Conj = (AFMatProp 4)-toMatProp Upper = (AFMatProp 32)-toMatProp Lower = (AFMatProp 64)-toMatProp DiagUnit = (AFMatProp 128)-toMatProp Sym = (AFMatProp 512)-toMatProp PosDef = (AFMatProp 1024)-toMatProp Orthog = (AFMatProp 2048)-toMatProp TriDiag = (AFMatProp 4096)-toMatProp BlockDiag = (AFMatProp 8192)---- | Binary operation support-data BinaryOp-  = Add-  | Mul-  | Min-  | Max-  deriving (Show, Eq, Ord)---- | High-level to low-level 'MatProp' conversion-toBinaryOp :: BinaryOp -> AFBinaryOp-toBinaryOp Add = AFBinaryOp 0-toBinaryOp Mul = AFBinaryOp 1-toBinaryOp Min = AFBinaryOp 2-toBinaryOp Max = AFBinaryOp 3---- | 'BinaryOp' conversion helper-fromBinaryOp :: AFBinaryOp -> BinaryOp-fromBinaryOp (AFBinaryOp 0) = Add-fromBinaryOp (AFBinaryOp 1) = Mul-fromBinaryOp (AFBinaryOp 2) = Min-fromBinaryOp (AFBinaryOp 3) = Max-fromBinaryOp x = error ("Invalid Binary Op: " <> show x)---- | Storage type used for Sparse arrays-data Storage-  = Dense-  | CSR-  | CSC-  | COO-  deriving (Show, Eq, Ord, Enum)--toStorage :: Storage -> AFStorage-toStorage = AFStorage . fromIntegral . fromEnum--fromStorage :: AFStorage -> Storage-fromStorage (AFStorage (fromIntegral -> x))-  | x `elem` [0..3] = toEnum x-  | otherwise = error $ "Invalid Storage " <> (show x)---- | Type for different RandomEngines-data RandomEngineType-  = Philox-  | ThreeFry-  | Mersenne-  deriving (Eq, Show)--toRandomEngine :: AFRandomEngineType -> RandomEngineType-toRandomEngine (AFRandomEngineType 100) = Philox-toRandomEngine (AFRandomEngineType 200) = ThreeFry-toRandomEngine (AFRandomEngineType 300) = Mersenne-toRandomEngine (AFRandomEngineType x) =-  error ("Invalid random engine: " <> show x)--fromRandomEngine :: RandomEngineType ->  AFRandomEngineType-fromRandomEngine Philox = (AFRandomEngineType 100)-fromRandomEngine ThreeFry = (AFRandomEngineType 200)-fromRandomEngine Mersenne = (AFRandomEngineType 300)---- | Interpolation type-data InterpType-  = Nearest-  | Linear-  | Bilinear-  | Cubic-  | LowerInterp-  | LinearCosine-  | BilinearCosine-  | Bicubic-  | CubicSpline-  | BicubicSpline-  deriving (Show, Eq, Ord, Enum)--toInterpType :: AFInterpType -> InterpType-toInterpType (AFInterpType (fromIntegral -> x)) = toEnum x--fromInterpType :: InterpType -> AFInterpType-fromInterpType = AFInterpType . fromIntegral . fromEnum---- | Border Type-data BorderType-  = PadZero-  | PadSym-  deriving (Show, Ord, Enum, Eq)--toBorderType :: AFBorderType -> BorderType-toBorderType (AFBorderType (fromIntegral -> x)) = toEnum x--fromBorderType :: BorderType -> AFBorderType-fromBorderType = AFBorderType . fromIntegral . fromEnum---- | Connectivity Type-data Connectivity-  = Conn4-  | Conn8-  deriving (Show, Ord, Enum, Eq)--toConnectivity :: AFConnectivity -> Connectivity-toConnectivity (AFConnectivity 4) = Conn4-toConnectivity (AFConnectivity 8) = Conn4-toConnectivity (AFConnectivity x) = error ("Unknown connectivity option: " <> show x)--fromConnectivity :: Connectivity -> AFConnectivity-fromConnectivity Conn4 = AFConnectivity 4-fromConnectivity Conn8 = AFConnectivity 8---- | Color Space type-data CSpace-  = Gray-  | RGB-  | HSV-  | YCBCR-  deriving (Show, Eq, Ord, Enum)--toCSpace :: AFCSpace -> CSpace-toCSpace (AFCSpace (fromIntegral -> x)) = toEnum x--fromCSpace :: CSpace -> AFCSpace-fromCSpace = AFCSpace . fromIntegral . fromEnum---- | YccStd type-data YccStd-  = Ycc601-  | Ycc709-  | Ycc2020-  deriving (Show, Eq, Ord)--toAFYccStd :: AFYccStd -> YccStd-toAFYccStd (AFYccStd 601) = Ycc601-toAFYccStd (AFYccStd 709) = Ycc709-toAFYccStd (AFYccStd 2020) = Ycc2020-toAFYccStd (AFYccStd x) = error ("Unknown AFYccStd option: " <> show x)--fromAFYccStd :: YccStd -> AFYccStd-fromAFYccStd Ycc601 = afYcc601-fromAFYccStd Ycc709 = afYcc709-fromAFYccStd Ycc2020 = afYcc2020---- | Moment types-data MomentType-  = M00-  | M01-  | M10-  | M11-  | FirstOrder-  deriving (Show, Eq, Ord)--toMomentType :: AFMomentType -> MomentType-toMomentType x-  | x == afMomentM00 = M00-  | x == afMomentM01 = M01-  | x == afMomentM10 = M10-  | x == afMomentM11 = M11-  | x == afMomentFirstOrder = FirstOrder-  | otherwise = error ("Unknown moment type: " <> show x)--fromMomentType :: MomentType -> AFMomentType-fromMomentType M00 = afMomentM00-fromMomentType M01 = afMomentM01-fromMomentType M10 = afMomentM10-fromMomentType M11 = afMomentM11-fromMomentType FirstOrder = afMomentFirstOrder---- | Canny Theshold type-data CannyThreshold-  = Manual-  | AutoOtsu-  deriving (Show, Eq, Ord, Enum)--toCannyThreshold :: AFCannyThreshold -> CannyThreshold-toCannyThreshold (AFCannyThreshold (fromIntegral -> x)) = toEnum x--fromCannyThreshold :: CannyThreshold -> AFCannyThreshold-fromCannyThreshold = AFCannyThreshold . fromIntegral . fromEnum---- | Flux function type-data FluxFunction-  = FluxDefault-  | FluxQuadratic-  | FluxExponential-  deriving (Show, Eq, Ord, Enum)--toFluxFunction :: AFFluxFunction -> FluxFunction-toFluxFunction (AFFluxFunction (fromIntegral -> x)) = toEnum x--fromFluxFunction :: FluxFunction -> AFFluxFunction-fromFluxFunction = AFFluxFunction . fromIntegral . fromEnum---- | Diffusion type-data DiffusionEq-  = DiffusionDefault-  | DiffusionGrad-  | DiffusionMCDE-  deriving (Show, Eq, Ord, Enum)--toDiffusionEq :: AFDiffusionEq -> DiffusionEq-toDiffusionEq (AFDiffusionEq (fromIntegral -> x)) = toEnum x--fromDiffusionEq :: DiffusionEq -> AFDiffusionEq-fromDiffusionEq = AFDiffusionEq . fromIntegral . fromEnum---- | Iterative deconvolution algo type-data IterativeDeconvAlgo-  = DeconvDefault-  | DeconvLandweber-  | DeconvRichardsonLucy-  deriving (Show, Eq, Ord, Enum)--toIterativeDeconvAlgo :: AFIterativeDeconvAlgo -> IterativeDeconvAlgo-toIterativeDeconvAlgo (AFIterativeDeconvAlgo (fromIntegral -> x)) = toEnum x--fromIterativeDeconvAlgo :: IterativeDeconvAlgo -> AFIterativeDeconvAlgo-fromIterativeDeconvAlgo = AFIterativeDeconvAlgo . fromIntegral . fromEnum---- | Inverse deconvolution algo type-data InverseDeconvAlgo-  = InverseDeconvDefault-  | InverseDeconvTikhonov-  deriving (Show, Eq, Ord, Enum)--toInverseDeconvAlgo :: AFInverseDeconvAlgo -> InverseDeconvAlgo-toInverseDeconvAlgo (AFInverseDeconvAlgo (fromIntegral -> x)) = toEnum x--fromInverseDeconvAlgo :: InverseDeconvAlgo -> AFInverseDeconvAlgo-fromInverseDeconvAlgo = AFInverseDeconvAlgo . fromIntegral . fromEnum---- | Cell type, used in Graphics module-data Cell-  = Cell-  { cellRow :: Int-  , cellCol :: Int-  , cellTitle :: String-  , cellColorMap :: ColorMap-  } deriving (Show, Eq)--cellToAFCell :: Cell -> IO AFCell-cellToAFCell Cell {..} =-  withCString cellTitle $ \cstr ->-    pure AFCell { afCellRow = cellRow-                , afCellCol = cellCol-                , afCellTitle = cstr-                , afCellColorMap = fromColorMap cellColorMap-                }---- | ColorMap type-data ColorMap-  = ColorMapDefault-  | ColorMapSpectrum-  | ColorMapColors-  | ColorMapRed-  | ColorMapMood-  | ColorMapHeat-  | ColorMapBlue-  | ColorMapInferno-  | ColorMapMagma-  | ColorMapPlasma-  | ColorMapViridis-  deriving (Show, Eq, Ord, Enum)--fromColorMap :: ColorMap -> AFColorMap-fromColorMap = AFColorMap . fromIntegral . fromEnum--toColorMap :: AFColorMap -> ColorMap-toColorMap (AFColorMap (fromIntegral -> x)) = toEnum x---- | Marker type-data MarkerType-  = MarkerTypeNone-  | MarkerTypePoint-  | MarkerTypeCircle-  | MarkerTypeSquare-  | MarkerTypeTriangle-  | MarkerTypeCross-  | MarkerTypePlus-  | MarkerTypeStar-  deriving (Show, Eq, Ord, Enum)--fromMarkerType :: MarkerType -> AFMarkerType-fromMarkerType = AFMarkerType . fromIntegral . fromEnum--toMarkerType :: AFMarkerType -> MarkerType-toMarkerType (AFMarkerType (fromIntegral -> x)) = toEnum x---- | Match type-data MatchType-  = MatchTypeSAD-  | MatchTypeZSAD-  | MatchTypeLSAD-  | MatchTypeSSD-  | MatchTypeZSSD-  | MatchTypeLSSD-  | MatchTypeNCC-  | MatchTypeZNCC-  | MatchTypeSHD-  deriving (Show, Eq, Ord, Enum)--fromMatchType :: MatchType -> AFMatchType-fromMatchType = AFMatchType . fromIntegral . fromEnum--toMatchType :: AFMatchType -> MatchType-toMatchType (AFMatchType (fromIntegral -> x)) = toEnum x---- | TopK type-data TopK-  = TopKDefault-  | TopKMin-  | TopKMax-  deriving (Show, Eq, Ord, Enum)--fromTopK :: TopK -> AFTopkFunction-fromTopK = AFTopkFunction . fromIntegral . fromEnum--toTopK :: AFTopkFunction -> TopK-toTopK (AFTopkFunction (fromIntegral -> x)) = toEnum x---- | Homography Type-data HomographyType-  = RANSAC-  | LMEDS-  deriving (Show, Eq, Ord, Enum)--fromHomographyType :: HomographyType -> AFHomographyType-fromHomographyType = AFHomographyType . fromIntegral . fromEnum--toHomographyType :: AFHomographyType -> HomographyType-toHomographyType (AFHomographyType (fromIntegral -> x)) = toEnum x---- | Sequence Type-data Seq-  = Seq-  { seqBegin :: !Double-  , seqEnd :: !Double-  , seqStep :: !Double-  } deriving (Show, Eq, Ord)--toAFSeq :: Seq -> AFSeq-toAFSeq (Seq x y z) = (AFSeq x y z)---- | Index Type-data Index a-  = Index-  { idx :: Either (Array a) Seq-  , isSeq :: !Bool-  , isBatch :: !Bool-  }--seqIdx :: Seq -> Bool -> Index a-seqIdx s = Index (Right s) True--arrIdx :: Array a -> Bool -> Index a-arrIdx a = Index (Left a) False--toAFIndex :: Index a -> IO AFIndex-toAFIndex (Index a b c) = do-  case a of-    Right s -> pure $ AFIndex (Right (toAFSeq s)) b c-    Left (Array fptr) -> do-      withForeignPtr fptr $ \ptr ->-        pure $ AFIndex (Left ptr) b c----- | Type alias for ArrayFire API version-type Version = (Int,Int,Int)---- | Norm Type-data NormType-  = NormVectorOne-  -- ^ treats the input as a vector and returns the sum of absolute values-  | NormVectorInf-  -- ^ treats the input as a vector and returns the max of absolute values-  | NormVector2-  -- ^ treats the input as a vector and returns euclidean norm-  | NormVectorP-  -- ^ treats the input as a vector and returns the p-norm-  | NormMatrix1-  -- ^ return the max of column sums-  | NormMatrixInf-  -- ^ return the max of row sums-  | NormMatrix2-  -- ^ returns the max singular value). Currently NOT SUPPORTED-  | NormMatrixLPQ-  -- ^ returns Lpq-norm-  | NormEuclid-  -- ^ The default. Same as AF_NORM_VECTOR_2-  deriving (Show, Eq, Enum)--fromNormType :: NormType -> AFNormType-fromNormType = AFNormType . fromIntegral . fromEnum--toNormType :: AFNormType -> NormType-toNormType (AFNormType (fromIntegral -> x)) = toEnum x---- | Convolution Domain-data ConvDomain-  = ConvDomainAuto-  -- ^ ArrayFire automatically picks the right convolution algorithm-  | ConvDomainSpatial-  -- ^ Perform convolution in spatial domain-  | ConvDomainFreq-  -- ^ Perform convolution in frequency domain-  deriving (Show, Eq, Enum)---- | Convolution Mode-data ConvMode-  = ConvDefault-  -- ^ Output of the convolution is the same size as input-  | ConvExpand-  -- ^ Output of the convolution is signal_len + filter_len - 1-  deriving (Show, Eq, Enum)--fromConvDomain :: ConvDomain -> AFConvDomain-fromConvDomain = AFConvDomain . fromIntegral . fromEnum--toConvDomain :: AFConvDomain -> ConvDomain-toConvDomain (AFConvDomain (fromIntegral -> x)) = toEnum x--fromConvMode :: AFConvMode -> ConvMode-fromConvMode (AFConvMode (fromIntegral -> x)) = toEnum x--toConvMode :: ConvMode -> AFConvMode-toConvMode = AFConvMode . fromIntegral . fromEnum---- | Array Fire types-data AFDType-  = F32-  | C32-  | F64-  | C64-  | B8-  | S32-  | U32-  | U8-  | S64-  | U64-  | S16-  | U16-  deriving (Show, Eq, Enum)--fromAFType :: AFDtype -> AFDType-fromAFType (AFDtype (fromIntegral -> x)) = toEnum x--toAFType :: AFDType -> AFDtype-toAFType = AFDtype . fromIntegral . fromEnum-
− src/ArrayFire/Internal/Util.hs
@@ -1,31 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Util.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Util where--import ArrayFire.Internal.Defines-import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_print_array"-    af_print_array :: AFArray -> IO AFErr-foreign import ccall unsafe "af_print_array_gen"-    af_print_array_gen :: Ptr CChar -> AFArray -> CInt -> IO AFErr-foreign import ccall unsafe "af_save_array"-    af_save_array :: Ptr CInt -> Ptr CChar -> AFArray -> Ptr CChar -> CBool -> IO AFErr-foreign import ccall unsafe "af_read_array_index"-    af_read_array_index :: Ptr AFArray -> Ptr CChar -> CUInt -> IO AFErr-foreign import ccall unsafe "af_read_array_key"-    af_read_array_key :: Ptr AFArray -> Ptr CChar -> Ptr CChar -> IO AFErr-foreign import ccall unsafe "af_read_array_key_check"-    af_read_array_key_check :: Ptr CInt -> Ptr CChar -> Ptr CChar -> IO AFErr-foreign import ccall unsafe "af_array_to_string"-    af_array_to_string :: Ptr (Ptr CChar) -> Ptr CChar -> AFArray -> CInt -> CBool -> IO AFErr-foreign import ccall unsafe "af_example_function"-    af_example_function :: Ptr AFArray -> AFArray -> AFSomeEnum -> IO AFErr-foreign import ccall unsafe "af_get_version"-    af_get_version :: Ptr CInt -> Ptr CInt -> Ptr CInt -> IO AFErr-foreign import ccall unsafe "af_get_revision"-    af_get_revision :: IO (Ptr CChar)-foreign import ccall unsafe "af_get_size_of"-    af_get_size_of :: Ptr CSize -> AFDtype -> IO AFErr
− src/ArrayFire/Internal/Vision.hs
@@ -1,31 +0,0 @@-{-# LINE 1 "src/ArrayFire/Internal/Vision.hsc" #-}-{-# LANGUAGE CPP #-}-module ArrayFire.Internal.Vision where--import ArrayFire.Internal.Defines-import Foreign.Ptr-import Foreign.C.Types---foreign import ccall unsafe "af_fast"-    af_fast :: Ptr AFFeatures -> AFArray -> Float -> CUInt -> CBool -> Float -> CUInt -> IO AFErr-foreign import ccall unsafe "af_harris"-    af_harris :: Ptr AFFeatures -> AFArray -> CUInt -> Float -> Float -> CUInt -> Float -> IO AFErr-foreign import ccall unsafe "af_orb"-    af_orb :: Ptr AFFeatures -> Ptr AFArray -> AFArray -> Float -> CUInt -> Float -> CUInt -> CBool -> IO AFErr-foreign import ccall unsafe "af_sift"-    af_sift :: Ptr AFFeatures -> Ptr AFArray -> AFArray -> CUInt -> Float -> Float -> Float -> CBool -> Float -> Float -> IO AFErr-foreign import ccall unsafe "af_gloh"-    af_gloh :: Ptr AFFeatures -> Ptr AFArray -> AFArray -> CUInt -> Float -> Float -> Float -> CBool -> Float -> Float -> IO AFErr-foreign import ccall unsafe "af_hamming_matcher"-    af_hamming_matcher :: Ptr AFArray -> Ptr AFArray -> AFArray -> AFArray -> DimT -> CUInt -> IO AFErr-foreign import ccall unsafe "af_nearest_neighbour"-    af_nearest_neighbour :: Ptr AFArray -> Ptr AFArray -> AFArray -> AFArray -> DimT -> CUInt -> AFMatchType -> IO AFErr-foreign import ccall unsafe "af_match_template"-    af_match_template :: Ptr AFArray -> AFArray -> AFArray -> AFMatchType -> IO AFErr-foreign import ccall unsafe "af_susan"-    af_susan :: Ptr AFFeatures -> AFArray -> CUInt -> Float -> Float -> Float -> CUInt -> IO AFErr-foreign import ccall unsafe "af_dog"-    af_dog :: Ptr AFArray -> AFArray -> CInt -> CInt -> IO AFErr-foreign import ccall unsafe "af_homography"-    af_homography :: Ptr AFArray -> Ptr CInt -> AFArray -> AFArray -> AFArray -> AFArray -> AFHomographyType -> Float -> CUInt -> AFDtype -> IO AFErr
src/ArrayFire/LAPACK.hs view
@@ -4,7 +4,7 @@ -- Module      : ArrayFire.LAPACK -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Orphans.hs view
@@ -8,7 +8,7 @@ -- Module      : ArrayFire.Orphans -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --@@ -32,7 +32,7 @@   x + y       = A.add x y   x * y       = A.mul x y   abs         = A.abs-  signum      = A.sign+  signum x    = A.sign (-x) - A.sign x   negate arr  = do     let (w,x,y,z) = A.getDims arr     A.cast (A.constant @a [w,x,y,z] 0) `A.sub` arr@@ -50,8 +50,12 @@   pi   = A.scalar @a 3.14159   exp  = A.exp @a   log  = A.log @a+  sqrt = A.sqrt @a+  (**) = A.pow @a   sin  = A.sin @a   cos  = A.cos @a+  tan = A.tan @a+  tanh = A.tanh @a   asin = A.asin @a   acos = A.acos @a   atan = A.atan @a
src/ArrayFire/Random.hs view
@@ -13,7 +13,7 @@ -- Module      : ArrayFire.Random -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Signal.hs view
@@ -4,7 +4,7 @@ -- Module      : ArrayFire.Signal -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Sparse.hs view
@@ -4,7 +4,7 @@ -- Module      : ArrayFire.Sparse -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Statistics.hs view
@@ -5,7 +5,7 @@ -- Module      : ArrayFire.Statistics -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Types.hs view
@@ -16,7 +16,7 @@ -- Module      : ArrayFire.Types -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Util.hs view
@@ -6,7 +6,7 @@ -- Module      : ArrayFire.Util -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
src/ArrayFire/Vision.hs view
@@ -6,7 +6,7 @@ -- Module      : ArrayFire.Vision -- Copyright   : David Johnson (c) 2019-2020 -- License     : BSD 3--- Maintainer  : David Johnson <djohnson.m@gmail.com>+-- Maintainer  : David Johnson <code@dmj.io> -- Stability   : Experimental -- Portability : GHC --
test/ArrayFire/ArithSpec.hs view
@@ -1,18 +1,83 @@+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}+ module ArrayFire.ArithSpec where -import ArrayFire  hiding (acos)-import Prelude    hiding (sqrt, div, and, or, not, isNaN)-import Test.Hspec+import ArrayFire (AFType, Array, cast, clamp, getType, isInf, isZero, matrix, maxOf, minOf, mkArray, scalar, vector)+import qualified ArrayFire+import Control.Exception (throwIO)+import Control.Monad (unless, when) import Foreign.C+import GHC.Exts (IsList (..))+import GHC.Stack+import Test.HUnit.Lang (FailureReason (..), HUnitFailure (..))+import Test.Hspec+import Test.Hspec.QuickCheck+import Prelude hiding (div) +compareWith :: (HasCallStack, Show a) => (a -> a -> Bool) -> a -> a -> Expectation+compareWith comparator result expected =+  unless (comparator result expected) $ do+    throwIO (HUnitFailure location $ ExpectedButGot Nothing expectedMsg actualMsg)+ where+  expectedMsg = show expected+  actualMsg = show result+  location = case reverse (toList callStack) of+    (_, loc) : _ -> Just loc+    [] -> Nothing++class (Num a) => HasEpsilon a where+  eps :: a++instance HasEpsilon Float where+  eps = 1.1920929e-7++instance HasEpsilon Double where+  eps = 2.220446049250313e-16++approxWith :: (Ord a, Num a) => a -> a -> a -> a -> Bool+approxWith rtol atol a b = abs (a - b) <= Prelude.max atol (rtol * Prelude.max (abs a) (abs b))++approx :: (Ord a, HasEpsilon a) => a -> a -> Bool+approx a b = approxWith (2 * eps * Prelude.max (abs a) (abs b)) (4 * eps) a b++shouldBeApprox :: (Ord a, HasEpsilon a, Show a) => a -> a -> Expectation+shouldBeApprox = compareWith approx++evalf :: (AFType a) => Array a -> a+evalf = ArrayFire.getScalar++shouldMatchBuiltin ::+  (AFType a, Ord a, RealFloat a, HasEpsilon a, Show a) =>+  (Array a -> Array a) ->+  (a -> a) ->+  a ->+  Expectation+shouldMatchBuiltin f f' x+  | isInfinite y && isInfinite y' = pure ()+  | Prelude.isNaN y && Prelude.isNaN y' = pure ()+  | otherwise = y `shouldBeApprox` y'+ where+  y = evalf (f (scalar x))+  y' = f' x++shouldMatchBuiltin2 ::+  (AFType a, Ord a, RealFloat a, HasEpsilon a, Show a) =>+  (Array a -> Array a -> Array a) ->+  (a -> a -> a) ->+  a ->+  a ->+  Expectation+shouldMatchBuiltin2 f f' a = shouldMatchBuiltin (f (scalar a)) (f' a)+ spec :: Spec spec =   describe "Arith tests" $ do     it "Should negate scalar value" $ do       negate (scalar @Int 1) `shouldBe` (-1)     it "Should negate a vector" $ do-      negate (vector @Int 3 [2,2,2]) `shouldBe` vector @Int 3 [-2,-2,-2]+      negate (vector @Int 3 [2, 2, 2]) `shouldBe` vector @Int 3 [-2, -2, -2]     it "Should add two scalar arrays" $ do       scalar @Int 1 + 2 `shouldBe` 3     it "Should add two scalar bool arrays" $ do@@ -20,78 +85,84 @@     it "Should subtract two scalar arrays" $ do       scalar @Int 4 - 2 `shouldBe` 2     it "Should multiply two scalar arrays" $ do-      scalar @Double 4 `mul` 2 `shouldBe` 8+      scalar @Double 4 `ArrayFire.mul` 2 `shouldBe` 8     it "Should divide two scalar arrays" $ do-      div @Double 8 2 `shouldBe` 4+      ArrayFire.div @Double 8 2 `shouldBe` 4     it "Should add two matrices" $ do-      matrix @Int (2,2) [[1,1],[1,1]] + matrix @Int (2,2) [[1,1],[1,1]]-        `shouldBe`-           matrix @Int (2,2) [[2,2],[2,2]]-    it "Should take cubed root" $ do-      3 `shouldBe` cbrt @Double 27-    it "Should take square root" $ do-      2 `shouldBe` sqrt @Double 4+      matrix @Int (2, 2) [[1, 1], [1, 1]] + matrix @Int (2, 2) [[1, 1], [1, 1]]+        `shouldBe` matrix @Int (2, 2) [[2, 2], [2, 2]]+    prop "Should take cubed root" $ \(x :: Double) ->+      evalf (ArrayFire.cbrt (scalar (x * x * x))) `shouldBeApprox` x      it "Should lte Array" $ do-      2 `le` (3 :: Array Double) `shouldBe` 1+      2 `ArrayFire.le` (3 :: Array Double) `shouldBe` 1     it "Should gte Array" $ do-      2 `ge` (3 :: Array Double) `shouldBe` 0+      2 `ArrayFire.ge` (3 :: Array Double) `shouldBe` 0     it "Should gt Array" $ do-      2 `gt` (3 :: Array Double) `shouldBe` 0+      2 `ArrayFire.gt` (3 :: Array Double) `shouldBe` 0     it "Should lt Array" $ do-      2 `le` (3 :: Array Double) `shouldBe` 1+      2 `ArrayFire.le` (3 :: Array Double) `shouldBe` 1     it "Should eq Array" $ do       3 == (3 :: Array Double) `shouldBe` True     it "Should and Array" $ do-      (mkArray @CBool [1] [0] `and` mkArray [1] [1])-         `shouldBe` mkArray [1] [0]+      (mkArray @CBool [1] [0] `ArrayFire.and` mkArray [1] [1])+        `shouldBe` mkArray [1] [0]     it "Should and Array" $ do-      (mkArray @CBool [2] [0,0] `and` mkArray [2] [1,0])-         `shouldBe` mkArray [2] [0, 0]+      (mkArray @CBool [2] [0, 0] `ArrayFire.and` mkArray [2] [1, 0])+        `shouldBe` mkArray [2] [0, 0]     it "Should or Array" $ do-      (mkArray @CBool [2] [0,0] `or` mkArray [2] [1,0])-         `shouldBe` mkArray [2] [1, 0]+      (mkArray @CBool [2] [0, 0] `ArrayFire.or` mkArray [2] [1, 0])+        `shouldBe` mkArray [2] [1, 0]     it "Should not Array" $ do-      not (mkArray @CBool [2] [1,0]) `shouldBe` mkArray [2] [0,1]+      ArrayFire.not (mkArray @CBool [2] [1, 0]) `shouldBe` mkArray [2] [0, 1]     it "Should bitwise and array" $ do-      bitAnd (scalar @Int 1) (scalar @Int 0)-        `shouldBe`-           0+      ArrayFire.bitAnd (scalar @Int 1) (scalar @Int 0)+        `shouldBe` 0     it "Should bitwise or array" $ do-      bitOr (scalar @Int 1) (scalar @Int 0)-        `shouldBe`-           1+      ArrayFire.bitOr (scalar @Int 1) (scalar @Int 0)+        `shouldBe` 1     it "Should bitwise xor array" $ do-      bitXor (scalar @Int 1) (scalar @Int 1)-        `shouldBe`-           0+      ArrayFire.bitXor (scalar @Int 1) (scalar @Int 1)+        `shouldBe` 0     it "Should bitwise shift left an array" $ do-       bitShiftL (scalar @Int 1) (scalar @Int 3)-        `shouldBe`-           8+      ArrayFire.bitShiftL (scalar @Int 1) (scalar @Int 3)+        `shouldBe` 8     it "Should cast an array" $ do       getType (cast (scalar @Int 1) :: Array Double)-        `shouldBe`-           F64+        `shouldBe` ArrayFire.F64     it "Should find the minimum of two arrays" $ do       minOf (scalar @Int 1) (scalar @Int 0)-        `shouldBe`-           0+        `shouldBe` 0     it "Should find the max of two arrays" $ do       maxOf (scalar @Int 1) (scalar @Int 0)-        `shouldBe`-           1+        `shouldBe` 1     it "Should take the clamp of 3 arrays" $ do       clamp (scalar @Int 2) (scalar @Int 1) (scalar @Int 3)-       `shouldBe`-          2+        `shouldBe` 2     it "Should check if an array has positive or negative infinities" $ do       isInf (scalar @Double (1 / 0)) `shouldBe` scalar @Double 1       isInf (scalar @Double 10) `shouldBe` scalar @Double 0     it "Should check if an array has any NaN values" $ do-      isNaN (scalar @Double (acos 2)) `shouldBe` scalar @Double 1-      isNaN (scalar @Double 10) `shouldBe` scalar @Double 0+      ArrayFire.isNaN (scalar @Double (acos 2)) `shouldBe` scalar @Double 1+      ArrayFire.isNaN (scalar @Double 10) `shouldBe` scalar @Double 0     it "Should check if an array has any Zero values" $ do       isZero (scalar @Double (acos 2)) `shouldBe` scalar @Double 0       isZero (scalar @Double 0) `shouldBe` scalar @Double 1       isZero (scalar @Double 1) `shouldBe` scalar @Double 0++    prop "Floating @Float (exp)" $ \(x :: Float) -> exp `shouldMatchBuiltin` exp $ x+    prop "Floating @Float (log)" $ \(x :: Float) -> log `shouldMatchBuiltin` log $ x+    prop "Floating @Float (sqrt)" $ \(x :: Float) -> sqrt `shouldMatchBuiltin` sqrt $ x+    prop "Floating @Float (**)" $ \(x :: Float) (y :: Float) -> ((**) `shouldMatchBuiltin2` (**)) x y+    prop "Floating @Float (sin)" $ \(x :: Float) -> sin `shouldMatchBuiltin` sin $ x+    prop "Floating @Float (cos)" $ \(x :: Float) -> cos `shouldMatchBuiltin` cos $ x+    prop "Floating @Float (tan)" $ \(x :: Float) -> tan `shouldMatchBuiltin` tan $ x+    prop "Floating @Float (asin)" $ \(x :: Float) -> asin `shouldMatchBuiltin` asin $ x+    prop "Floating @Float (acos)" $ \(x :: Float) -> acos `shouldMatchBuiltin` acos $ x+    prop "Floating @Float (atan)" $ \(x :: Float) -> atan `shouldMatchBuiltin` atan $ x+    prop "Floating @Float (sinh)" $ \(x :: Float) -> sinh `shouldMatchBuiltin` sinh $ x+    prop "Floating @Float (cosh)" $ \(x :: Float) -> cosh `shouldMatchBuiltin` cosh $ x+    prop "Floating @Float (tanh)" $ \(x :: Float) -> tanh `shouldMatchBuiltin` tanh $ x+    prop "Floating @Float (asinh)" $ \(x :: Float) -> asinh `shouldMatchBuiltin` asinh $ x+    prop "Floating @Float (acosh)" $ \(x :: Float) -> acosh `shouldMatchBuiltin` acosh $ x+    prop "Floating @Float (atanh)" $ \(x :: Float) -> atanh `shouldMatchBuiltin` atanh $ x
test/ArrayFire/DataSpec.hs view
@@ -32,3 +32,8 @@       constant @(Complex Float) [1] (1.0 :+ 1.0)         `shouldBe`           constant @(Complex Float) [1] (1.0 :+ 1.0)+    it "Should join Arrays along the specified dimension" $ do+      join 0 (constant @Int [1, 3] 1) (constant @Int [1, 3] 2) `shouldBe` mkArray @Int [2, 3] [1, 2, 1, 2, 1, 2]+      join 1 (constant @Int [1, 2] 1) (constant @Int [1, 2] 2) `shouldBe` mkArray @Int [1, 4] [1, 1, 2, 2]+      joinMany 0 [constant @Int [1, 3] 1, constant @Int [1, 3] 2] `shouldBe` mkArray @Int [2, 3] [1, 2, 1, 2, 1, 2]+      joinMany 1 [constant @Int [1, 2] 1, constant @Int [1, 1] 2, constant @Int [1, 3] 3] `shouldBe` mkArray @Int [1, 6] [1, 1, 2, 3, 3, 3]
test/ArrayFire/LAPACKSpec.hs view
@@ -4,6 +4,7 @@ import qualified ArrayFire       as A import           Prelude import           Test.Hspec+import Test.Hspec.ApproxExpect  spec :: Spec spec =@@ -33,9 +34,9 @@     it "Should get determinant of Double" $ do       let eles = [[3 A.:+ 1, 8 A.:+ 1], [4 A.:+ 1, 6 A.:+ 1]]           (x,y) = A.det (A.matrix @(A.Complex Double) (2,2) eles)-      x `shouldBe` (-14)+      x `shouldBeApprox` (-14)       let (x,y) = A.det $ A.matrix @Double (2,2) [[3,8],[4,6]]-      x `shouldBe` (-14)+      x `shouldBeApprox` (-14) --    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]]
test/ArrayFire/StatisticsSpec.hs view
@@ -5,6 +5,7 @@  import Data.Complex import Test.Hspec+import Test.Hspec.ApproxExpect  spec :: Spec spec =@@ -15,7 +16,7 @@            5.5     it "Should find the weighted-mean" $ do       meanWeighted (vector @Double 10 [1..]) (vector @Double 10 [1..]) 0-        `shouldBe`+        `shouldBeApprox`            7.0     it "Should find the variance" $ do       var (vector @Double 8 [1..8]) False 0
test/ArrayFire/UtilSpec.hs view
@@ -30,8 +30,10 @@       A.getSizeOf (Proxy @(Complex Float)) `shouldBe` 8       A.getSizeOf (Proxy @(Complex Double)) `shouldBe` 16     it "Should get version" $ do-      x <- A.getVersion-      x `shouldBe` (3,8,2)+      (major, minor, patch) <- A.getVersion+      major `shouldBe` 3+      minor `shouldSatisfy` (>= 8)+      patch `shouldSatisfy` (>= 0)     it "Should get revision" $ do       x <- A.getRevision       x `shouldSatisfy` (not . null)
test/Main.hs view
@@ -20,6 +20,7 @@  main :: IO () main = do+  A.setBackend A.CPU --  checks (Proxy :: Proxy (A.Array (A.Complex Float))) --  checks (Proxy :: Proxy (A.Array (A.Complex Double))) --  checks (Proxy :: Proxy (A.Array Double))
+ test/Test/Hspec/ApproxExpect.hs view
@@ -0,0 +1,19 @@+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE ScopedTypeVariables #-}+module Test.Hspec.ApproxExpect where++import Data.CallStack (HasCallStack)++import Test.Hspec (shouldSatisfy, Expectation)++infix 1 `shouldBeApprox`++shouldBeApprox :: (HasCallStack, Show a, Fractional a, Eq a)+    => a -> a -> Expectation+shouldBeApprox actual tgt+       -- This is a hackish way of checking, without requiring a specific+       -- type or an 'Ord' instance, whether two floating-point values+       -- are only some epsilons apart: when the difference is small enough+       -- so scaling it down some more makes it a no-op for addition.+   = actual `shouldSatisfy` \x -> (x-tgt) * 1e-4 + tgt == tgt+