-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell bindings to the ArrayFire general-purpose GPU library -- -- High-level Haskell bindings to the ArrayFire General-purpose GPU -- library -- @package arrayfire @version 0.5.1.0 -- | Various Types related to the ArrayFire API module ArrayFire.Types -- | Exception type for ArrayFire API data AFException AFException :: AFExceptionType -> Int -> String -> AFException -- | The Exception type to throw [afExceptionType] :: AFException -> AFExceptionType -- | Code representing the exception [afExceptionCode] :: AFException -> Int -- | Exception message [afExceptionMsg] :: AFException -> String -- | ArrayFire exception type data AFExceptionType NoMemoryError :: AFExceptionType DriverError :: AFExceptionType RuntimeError :: AFExceptionType InvalidArrayError :: AFExceptionType ArgError :: AFExceptionType SizeError :: AFExceptionType TypeError :: AFExceptionType DiffTypeError :: AFExceptionType BatchError :: AFExceptionType DeviceError :: AFExceptionType NotSupportedError :: AFExceptionType NotConfiguredError :: AFExceptionType NonFreeError :: AFExceptionType NoDblError :: AFExceptionType NoGfxError :: AFExceptionType LoadLibError :: AFExceptionType LoadSymError :: AFExceptionType BackendMismatchError :: AFExceptionType InternalError :: AFExceptionType UnknownError :: AFExceptionType UnhandledError :: AFExceptionType -- | ArrayFire Array data Array a -- | ArrayFire Window data Window -- | ArrayFire RandomEngine data RandomEngine -- | ArrayFire Features data Features -- | Mapping of Haskell types to ArrayFire types class Storable a => AFType a afType :: AFType a => Proxy a -> AFDtype -- | TopK type data TopK TopKDefault :: TopK TopKMin :: TopK TopKMax :: TopK -- | ArrayFire backends data Backend Default :: Backend CPU :: Backend CUDA :: Backend OpenCL :: Backend -- | Match type data MatchType MatchTypeSAD :: MatchType MatchTypeZSAD :: MatchType MatchTypeLSAD :: MatchType MatchTypeSSD :: MatchType MatchTypeZSSD :: MatchType MatchTypeLSSD :: MatchType MatchTypeNCC :: MatchType MatchTypeZNCC :: MatchType MatchTypeSHD :: MatchType -- | Binary operation support data BinaryOp Add :: BinaryOp Mul :: BinaryOp Min :: BinaryOp Max :: BinaryOp -- | Matrix properties data MatProp None :: MatProp Trans :: MatProp CTrans :: MatProp Conj :: MatProp Upper :: MatProp Lower :: MatProp DiagUnit :: MatProp Sym :: MatProp PosDef :: MatProp Orthog :: MatProp TriDiag :: MatProp BlockDiag :: MatProp -- | Homography Type data HomographyType RANSAC :: HomographyType LMEDS :: HomographyType -- | Type for different RandomEngines data RandomEngineType Philox :: RandomEngineType ThreeFry :: RandomEngineType Mersenne :: RandomEngineType -- | Cell type, used in Graphics module data Cell Cell :: Int -> Int -> String -> ColorMap -> Cell [cellRow] :: Cell -> Int [cellCol] :: Cell -> Int [cellTitle] :: Cell -> String [cellColorMap] :: Cell -> ColorMap -- | Marker type data MarkerType MarkerTypeNone :: MarkerType MarkerTypePoint :: MarkerType MarkerTypeCircle :: MarkerType MarkerTypeSquare :: MarkerType MarkerTypeTriangle :: MarkerType MarkerTypeCross :: MarkerType MarkerTypePlus :: MarkerType MarkerTypeStar :: MarkerType -- | Interpolation type data InterpType Nearest :: InterpType Linear :: InterpType Bilinear :: InterpType Cubic :: InterpType LowerInterp :: InterpType LinearCosine :: InterpType BilinearCosine :: InterpType Bicubic :: InterpType CubicSpline :: InterpType BicubicSpline :: InterpType -- | Connectivity Type data Connectivity Conn4 :: Connectivity Conn8 :: Connectivity -- | Color Space type data CSpace Gray :: CSpace RGB :: CSpace HSV :: CSpace YCBCR :: CSpace -- | YccStd type data YccStd Ycc601 :: YccStd Ycc709 :: YccStd Ycc2020 :: YccStd -- | Moment types data MomentType M00 :: MomentType M01 :: MomentType M10 :: MomentType M11 :: MomentType FirstOrder :: MomentType -- | Canny Theshold type data CannyThreshold Manual :: CannyThreshold AutoOtsu :: CannyThreshold -- | Flux function type data FluxFunction FluxDefault :: FluxFunction FluxQuadratic :: FluxFunction FluxExponential :: FluxFunction -- | Diffusion type data DiffusionEq DiffusionDefault :: DiffusionEq DiffusionGrad :: DiffusionEq DiffusionMCDE :: DiffusionEq -- | Iterative deconvolution algo type data IterativeDeconvAlgo DeconvDefault :: IterativeDeconvAlgo DeconvLandweber :: IterativeDeconvAlgo DeconvRichardsonLucy :: IterativeDeconvAlgo -- | Inverse deconvolution algo type data InverseDeconvAlgo InverseDeconvDefault :: InverseDeconvAlgo InverseDeconvTikhonov :: InverseDeconvAlgo -- | Sequence Type data Seq Seq :: !Double -> !Double -> !Double -> Seq [seqBegin] :: Seq -> !Double [seqEnd] :: Seq -> !Double [seqStep] :: Seq -> !Double -- | Index Type data Index a Index :: Either (Array a) Seq -> !Bool -> !Bool -> Index a [idx] :: Index a -> Either (Array a) Seq [isSeq] :: Index a -> !Bool [isBatch] :: Index a -> !Bool -- | Norm Type data NormType -- | treats the input as a vector and returns the sum of absolute values NormVectorOne :: NormType -- | treats the input as a vector and returns the max of absolute values NormVectorInf :: NormType -- | treats the input as a vector and returns euclidean norm NormVector2 :: NormType -- | treats the input as a vector and returns the p-norm NormVectorP :: NormType -- | return the max of column sums NormMatrix1 :: NormType -- | return the max of row sums NormMatrixInf :: NormType -- | returns the max singular value). Currently NOT SUPPORTED NormMatrix2 :: NormType -- | returns Lpq-norm NormMatrixLPQ :: NormType -- | The default. Same as AF_NORM_VECTOR_2 NormEuclid :: NormType -- | Convolution Mode data ConvMode -- | Output of the convolution is the same size as input ConvDefault :: ConvMode -- | Output of the convolution is signal_len + filter_len - 1 ConvExpand :: ConvMode -- | Convolution Domain data ConvDomain -- | ArrayFire automatically picks the right convolution algorithm ConvDomainAuto :: ConvDomain -- | Perform convolution in spatial domain ConvDomainSpatial :: ConvDomain -- | Perform convolution in frequency domain ConvDomainFreq :: ConvDomain -- | Border Type data BorderType PadZero :: BorderType PadSym :: BorderType -- | Storage type used for Sparse arrays data Storage Dense :: Storage CSR :: Storage CSC :: Storage COO :: Storage -- | Array Fire types data AFDType F32 :: AFDType C32 :: AFDType F64 :: AFDType C64 :: AFDType B8 :: AFDType S32 :: AFDType U32 :: AFDType U8 :: AFDType S64 :: AFDType U64 :: AFDType S16 :: AFDType U16 :: AFDType newtype AFDtype AFDtype :: CInt -> AFDtype -- | Value corresponding to ArrayFire type [afDType] :: AFDtype -> CInt -- | ColorMap type data ColorMap ColorMapDefault :: ColorMap ColorMapSpectrum :: ColorMap ColorMapColors :: ColorMap ColorMapRed :: ColorMap ColorMapMood :: ColorMap ColorMapHeat :: ColorMap ColorMapBlue :: ColorMap ColorMapInferno :: ColorMap ColorMapMagma :: ColorMap ColorMapPlasma :: ColorMap ColorMapViridis :: ColorMap -- | ArrayFire Docs Functions to create and handle sparse arrays and -- matrix operations. -- --
-- >>> createSparseArray 10 10 (matrix @Double (10,10) [[1,2],[3,4]]) (vector @Int32 10 [1..]) (vector @Int32 10 [1..]) CSR --module ArrayFire.Sparse -- | This function converts af::array of values, row indices and column -- indices into a sparse array. -- -- ArrayFire Docs -- --
-- >>> createSparseArray 10 10 (matrix @Double (10,10) [[1,2],[3,4]]) (vector @Int32 10 [1..]) (vector @Int32 10 [1..]) CSR --createSparseArray :: (AFType a, Fractional a) => Int -> Int -> Array a -> Array Int32 -> Array Int32 -> Storage -> Array a -- | This function converts a dense af_array into a sparse array. -- -- ArrayFire Docs -- --
-- >>> createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR -- ArrayFire Array -- Storage Format : AF_STORAGE_CSR -- [2 2 1 1] -- ArrayFire Array: Values -- [4 1 1 1] -- 1.0000 3.0000 2.0000 4.0000 -- ArrayFire Array: RowIdx -- [3 1 1 1] -- 0 2 4 -- ArrayFire Array: ColIdx -- [4 1 1 1] -- 0 1 0 1 --createSparseArrayFromDense :: (AFType a, Fractional a) => Array a -> Storage -> Array a -- | Convert an existing sparse array into a different storage format. -- -- ArrayFire Docs -- -- Converting storage formats is allowed between CSR, COO -- and DENSE. -- -- When converting to DENSE, a dense array is returned. -- --
-- >>> array = createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR -- -- >>> array -- ArrayFire Array -- Storage Format : AF_STORAGE_CSR -- [2 2 1 1] -- ArrayFire Array: Values -- [4 1 1 1] -- 1.0000 -- 3.0000 -- 2.0000 -- 4.0000 --sparseConvertTo :: (AFType a, Fractional a) => Array a -> Storage -> Array a -- | Returns a dense array from a sparse input -- -- ArrayFire Docs -- -- Converts the sparse matrix into a dense matrix and returns it -- --
-- >>> array = createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR -- -- >>> array -- ArrayFire Array -- Storage Format : AF_STORAGE_CSR -- [2 2 1 1] -- ArrayFire Array: Values -- [4 1 1 1] -- 1.0000 -- 3.0000 -- 2.0000 -- 4.0000 ---- -- ArrayFire Array: RowIdx [3 1 1 1] 0 2 4 -- -- ArrayFire Array: ColIdx [4 1 1 1] 0 1 0 1 sparseToDense :: (AFType a, Fractional a) => Array a -> Array a -- | Returns reference to components of the input sparse array. -- -- ArrayFire Docs -- -- Returns reference to values, row indices, column indices and storage -- format of an input sparse array -- --
-- >>> (values, cols, rows, storage) = sparseGetInfo $ createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR -- -- >>> values -- ArrayFire Array -- [4 1 1 1] -- 1.0000 -- 3.0000 -- 2.0000 -- 4.0000 ---- --
-- >>> cols -- ArrayFire Array -- [3 1 1 1] -- 0 -- 2 -- 4 ---- --
-- >>> rows -- ArrayFire Array -- [4 1 1 1] -- 0 -- 1 -- 0 -- 1 ---- --
-- >>> storage -- CSR --sparseGetInfo :: (AFType a, Fractional a) => Array a -> (Array a, Array a, Array a, Storage) -- | Returns reference to the values component of the sparse array. -- -- ArrayFire Docs -- -- Returns reference to the values component of the sparse array. Values -- is the Array containing the non-zero elements of the dense -- matrix. -- --
-- >>> sparseGetValues (createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR) -- ArrayFire Array -- [4 1 1 1] -- 1.0000 -- 3.0000 -- 2.0000 -- 4.0000 --sparseGetValues :: (AFType a, Fractional a) => Array a -> Array a -- | Returns reference to the row indices component of the sparse array. -- More... -- -- ArrayFire Docs -- -- Returns reference to the row indices component of the sparse array. -- Row indices is the Array containing the column indices of the -- sparse array. -- --
-- >>> sparseGetRowIdx (createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR) -- ArrayFire Array -- [3 1 1 1] -- 0 -- 2 -- 4 --sparseGetRowIdx :: (AFType a, Fractional a) => Array a -> Array a -- | Returns reference to the column indices component of the sparse array. -- More... -- -- ArrayFire Docs -- -- Returns reference to the column indices component of the sparse array. -- Column indices is the Array containing the column indices of -- the sparse array. -- --
-- >>> sparseGetColIdx (createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR) -- ArrayFire Array -- [4 1 1 1] -- 0 -- 1 -- 0 -- 1 --sparseGetColIdx :: (AFType a, Fractional a) => Array a -> Array a -- | Returns the storage type of a sparse array. -- -- ArrayFire Docs -- -- Returns the number of non zero elements in the sparse array. This is -- always equal to the size of the values array. -- --
-- >>> sparseGetStorage $ createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR -- CSR --sparseGetStorage :: (AFType a, Fractional a) => Array a -> Storage -- | Returns the number of non zero elements in the sparse array. More... -- -- ArrayFire Docs -- -- Returns the number of non zero elements in the sparse array. This is -- always equal to the size of the values array. -- --
-- >>> sparseGetNNZ $ createSparseArrayFromDense (matrix @Double (2,2) [[1,2],[3,4]]) CSR -- 4 --sparseGetNNZ :: (AFType a, Fractional a) => Array a -> Int -- | ArrayFire Docs -- -- Functions performing signal processing on Array -- --
-- >>> input = vector 3 [10,20,30] -- -- >>> positions = vector 5 [0.0, 0.5, 1.0, 1.5, 2.0] -- -- >>> approx1 @Double input positions Cubic 0.0 -- ArrayFire Array -- [5 1 1 1] -- 10.0000 -- 13.7500 -- 20.0000 -- 26.2500 -- 30.0000 --module ArrayFire.Signal -- | approx1 interpolates data along the first dimensions -- -- ArrayFire Docs -- -- Interpolation is performed assuming input data is equally spaced with -- indices in the range [0, n). The positions are sampled with respect to -- data at these locations. -- --
-- >>> input = vector 3 [10,20,30] -- -- >>> positions = vector 5 [0.0, 0.5, 1.0, 1.5, 2.0] -- -- >>> approx1 @Double input positions Cubic 0.0 -- ArrayFire Array -- [5 1 1 1] -- 10.0000 -- 13.7500 -- 20.0000 -- 26.2500 -- 30.0000 --approx1 :: AFType a => Array a -> Array a -> InterpType -> Float -> Array a -- | approx2 performs interpolation on data along the first and second -- dimensions. -- -- ArrayFire Docs -- -- Interpolation is performed assuming input data is equally spaced with -- indices in the range [0, n) along each dimension. The positions are -- sampled with respect to data at these locations. -- --
-- >>> input = matrix @Double (3,3) [ [ 1.0,1.0,1.0 ], [ 2.0, 2.0, 2.0 ], [ 3.0,3.0,3.0 ] ] -- -- >>> positions1 = matrix @Double (2,2) [ [ 0.5,1.5 ],[ 0.5,1.5 ] ] -- -- >>> positions2 = matrix @Double (2,2) [ [ 0.5,0.5 ],[ 1.5,1.5 ] ] -- -- >>> approx2 @Double input positions1 positions2 Cubic 0.0 -- ArrayFire Array -- [2 2 1 1] -- 1.3750 2.6250 -- 1.3750 2.6250 --approx2 :: AFType a => Array a -> Array a -> Array a -> InterpType -> Float -> Array a -- | Fast Fourier Transform -- -- ArrayFire Docs -- -- The Fast Fourier Transform (FFT) is an efficient algorithm to compute -- the discrete Fourier transform (DFT) of a signal or array. This is -- most commonly used to convert data in the time (or space) domain to -- the frequency domain, Then, the inverse FFT (iFFT) is used to return -- the data to the original domain. -- --
-- >>> fft (vector @Double 10 [1..]) 2.0 10 -- ArrayFire Array -- [10 1 1 1] -- (110.0000,0.0000) -- (-10.0000,30.7768) -- (-10.0000,13.7638) -- (-10.0000,7.2654) -- (-10.0000,3.2492) -- (-10.0000,0.0000) -- (-10.0000,-3.2492) -- (-10.0000,-7.2654) -- (-10.0000,-13.7638) -- (-10.0000,-30.7768) --fft :: (AFType a, Fractional a) => Array a -> Double -> Int -> Array a -- | Fast Fourier Transform (in-place) -- -- ArrayFire Docs -- -- C Interface for fast fourier transform on one dimensional signals. -- --
-- >>> setFFTPlanCacheSize 2 -- () --setFFTPlanCacheSize :: Int -> IO () -- | RandomEngine generation, Random Array generation. -- --
-- {-# LANGUAGE TypeApplications #-}
-- module Main where
--
-- import ArrayFire
--
-- main :: IO ()
-- main = do
-- seed <- getSeed
-- -- ^ Retrieves seed
-- engine <- createRandomEngine Mersenne seed
-- -- ^ Creates engine
-- array <- randomUniform [3,3] engine
-- -- ^ Creates random Array from engine with uniformly distributed data
-- print array
--
-- print =<< randu @Double [2,2]
-- -- ^ Shorthand for creating random Array
--
--
-- -- ArrayFire Array -- [3 3 1 1] -- 0.4446 0.1143 0.4283 -- 0.5725 0.1456 0.9182 -- 0.1915 0.1643 0.5997 ---- --
-- ArrayFire Array -- [2 2 1 1] -- 0.6010 0.0278 -- 0.9806 0.2126 --module ArrayFire.Random -- | Create random number generator object. -- --
-- >>> engine <- createRandomEngine 100 Philox --createRandomEngine :: Int -> RandomEngineType -> IO RandomEngine -- | Retains RandomEngine reference -- --
-- >>> nextEngine <- retainRandomEngine engine --retainRandomEngine :: RandomEngine -> IO RandomEngine -- | Sets RandomEngine to a new RandomEngineType -- --
-- >>> setRandomEngine engine Philox --setRandomEngine :: RandomEngine -> RandomEngineType -> IO () -- | Retrieves RandomEngine -- --
-- >>> randomEngineType <- getRandomEngineType engine --getRandomEngineType :: RandomEngine -> IO RandomEngineType -- | Sets seed on RandomEngine -- --
-- >>> randomEngineSetSeed engine 100 --randomEngineSetSeed :: RandomEngine -> Int -> IO () -- | Retrieve default RandomEngine -- --
-- >>> engine <- getDefaultRandomEngine --getDefaultRandomEngine :: IO RandomEngine -- | Set defualt RandomEngine type -- --
-- >>> setDefaultRandomEngineType Philox --setDefaultRandomEngineType :: RandomEngineType -> IO () -- | Retrieve seed of RandomEngine -- --
-- >>> seed <- randomEngineGetSeed engine --randomEngineGetSeed :: RandomEngine -> IO Int -- | Set random seed -- --
-- >>> setSeed 100 --setSeed :: Int -> IO () -- | Retrieve random seed -- --
-- >>> seed <- getSeed --getSeed :: IO Int -- | Generate random Array -- --
-- >>> randn @Double [2,2] ---- --
-- ArrayFire Array -- [2 2 1 1] -- 0.9428 -0.9523 -- -1.0564 -0.4199 --randn :: forall a. (AFType a, Fractional a) => [Int] -> IO (Array a) -- | Generate random uniform Array -- --
-- >>> randu @Double [2,2] ---- --
-- ArrayFire Array -- [2 2 1 1] -- 0.6010 0.0278 -- 0.9806 0.2126 --randu :: forall a. AFType a => [Int] -> IO (Array a) -- | Generate random uniform Array -- --
-- >>> randomUniform @Double [2,2] =<< getDefaultRandomEngine ---- --
-- ArrayFire Array -- [2 2 1 1] -- 0.6010 0.9806 -- 0.0278 0.2126 --randomUniform :: forall a. AFType a => [Int] -> RandomEngine -> IO (Array a) -- | Generate random uniform Array -- --
-- >>> randomNormal @Double [2,2] =<< getDefaultRandomEngine ---- --
-- ArrayFire Array -- [2 2 1 1] -- -1.4394 0.1952 -- 0.7982 -0.9783 --randomNormal :: forall a. AFType a => [Int] -> RandomEngine -> IO (Array a) -- | LAPACK — Linear Algebra PACKage -- --
-- >>> (u,e,d) = svd (constant @Double [3,3] 10) -- >>> u -- ArrayFire Array -- [3 3 1 1] -- -0.5774 0.8165 -0.0000 -- -0.5774 -0.4082 -0.7071 -- -0.5774 -0.4082 0.7071 -- -- >>> e -- ArrayFire Array -- [3 1 1 1] -- 30.0000 -- 0.0000 -- 0.0000 -- -- >>> d -- ArrayFire Array -- [3 3 1 1] -- -0.5774 -0.5774 -0.5774 -- -0.8165 0.4082 0.4082 -- -0.0000 0.7071 -0.7071 --module ArrayFire.LAPACK -- | Singular Value Decomposition -- -- ArrayFire Docs -- -- The arrayfire function only returns the non zero diagonal elements of -- S. svd :: AFType a => Array a -> (Array a, Array a, Array a) -- | Singular Value Decomposition (in-place) -- -- ArrayFire Docs -- -- The arrayfire function only returns the non zero diagonal elements of -- S. svdInPlace :: AFType a => Array a -> (Array a, Array a, Array a) -- | Perform LU decomposition -- -- ArrayFire Docs -- -- C Interface for LU decomposition. lu :: AFType a => Array a -> (Array a, Array a, Array a) -- | Perform LU decomposition (in-place). -- -- ArrayFire Docs -- -- C Interface for in place LU decomposition. luInPlace :: AFType a => Array a -> Bool -> Array a -- | Perform QR decomposition -- -- ArrayFire Docs -- -- C Interface for QR decomposition. qr :: AFType a => Array a -> (Array a, Array a, Array a) -- | Perform QR decomposition -- -- ArrayFire Docs -- -- C Interface for QR decomposition. qrInPlace :: AFType a => Array a -> Array a -- | Perform Cholesky Decomposition -- -- ArrayFire Docs -- -- This function decomposes a positive definite matrix A into two -- triangular matrices. cholesky :: AFType a => Array a -> Bool -> (Int, Array a) -- | Perform Cholesky Decomposition -- -- ArrayFire Docs -- -- C Interface for in place cholesky decomposition. choleskyInplace :: AFType a => Array a -> Bool -> Int -- | Solve a system of equations -- -- ArrayFire Docs solve :: AFType a => Array a -> Array a -> MatProp -> Array a -- | Solve a system of equations. -- -- ArrayFire Docs solveLU :: AFType a => Array a -> Array a -> Array a -> MatProp -> Array a -- | Invert a matrix. -- -- ArrayFire Docs -- -- C Interface for inverting a matrix. inverse :: AFType a => Array a -> MatProp -> Array a -- | Pseudo-inverse -- -- Not implemented in 3.6.4 -- -- ArrayFire Docs -- -- pinverse :: AFType a => Array a -> Double -> MatProp -> -- Array a pinverse a d m = op1 a (x y -> af_pinverse x y d (toMatProp -- m)) -- -- Find the rank of the input matrix -- -- ArrayFire Docs -- -- This function uses af::qr to find the rank of the input matrix within -- the given tolerance. rank :: AFType a => Array a -> Double -> Int -- | Find the determinant of a Matrix -- -- ArrayFire Docs -- -- C Interface for finding the determinant of a matrix. det :: AFType a => Array a -> (Double, Double) -- | Find the norm of the input matrix. -- -- ArrayFire Docs -- -- This function can return the norm using various metrics based on the -- type paramter. norm :: AFType a => Array a -> NormType -> Double -> Double -> Double -- | Is LAPACK available -- -- ArrayFire Docs isLAPACKAvailable :: Bool -- | Functions for indexing into an Array module ArrayFire.Index -- | Index into an Array by Seq index :: Array a -> [Seq] -> Array a -- | Lookup an Array by keys along a specified dimension lookup :: Array a -> Array a -> Int -> Array a -- | Functions for displaying Array graphically. -- --
-- >>> window <- createWindow 800 600 "New Chart" --module ArrayFire.Graphics -- | Create window -- -- ArrayFire Docs -- --
-- >>> window <- createWindow 800 600 "New Chart" --createWindow :: Int -> Int -> String -> IO Window -- | Sets Window position -- -- ArrayFire Docs -- --
-- >>> window <- createWindow 800 600 "New Chart" -- -- >>> setPosition window 800 600 --setPosition :: Window -> Int -> Int -> IO () -- | Sets Window title -- -- ArrayFire Docs -- --
-- >>> window <- createWindow 800 600 "New Chart" -- -- >>> setTitle window "window title" --setTitle :: Window -> String -> IO () -- | Sets Window size -- -- ArrayFire Docs -- --
-- >>> window <- createWindow 800 600 "New Chart" -- -- >>> setSize window 800 600 --setSize :: Window -> Int -> Int -> IO () -- | Draw an image onto a Window -- -- ArrayFire Docs -- --
-- >>> drawImage window ('constant' \@'Int' 1) ('Cell' 10 10 "test" 'ColorMapSpectrum')
--
drawImage :: Window -> Array a -> Cell -> IO ()
-- | Draw a plot onto a Window
--
-- ArrayFire Docs
--
--
-- >>> drawPlot window ('constant' \@'Int' 1) ('constant' \@'Int' 1) ('Cell' 10 10 "test" 'ColorMapSpectrum')
--
--
-- -- >>> createFeatures 10 --module ArrayFire.Features -- | Construct Features -- --
-- >>> features = createFeatures 10 --createFeatures :: Int -> Features -- | Retain Features -- --
-- >>> features = retainFeatures (createFeatures 10) --retainFeatures :: Features -> Features -- | Get number of Features -- -- link -- --
-- >>> getFeaturesNum (createFeatures 10) -- 10 --getFeaturesNum :: Features -> Int -- | Get Feature X-position -- --
-- >>> getFeaturesXPos (createFeatures 10) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 1.8750 -- 0.0000 -- 2.3750 -- 0.0000 -- 2.5938 -- 0.0000 -- 2.0000 -- 0.0000 -- 2.4375 --getFeaturesXPos :: Features -> Array a -- | Get Feature Y-position -- --
-- >>> getFeaturesYPos (createFeatures 10) -- ArrayFire Array -- [10 1 1 1] -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan --getFeaturesYPos :: Features -> Array a -- | Get Feature Score -- --
-- >>> getFeaturesScore (createFeatures 10) -- ArrayFire Array -- [10 1 1 1] -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan --getFeaturesScore :: Features -> Array a -- | Get Feature orientation -- --
-- >>> getFeaturesOrientation (createFeatures 10) -- ArrayFire Array -- [10 1 1 1] -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan --getFeaturesOrientation :: Features -> Array a -- | Get Feature size -- --
-- >>> getFeaturesSize (createFeatures 10) -- ArrayFire Array -- [10 1 1 1] -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan --getFeaturesSize :: Features -> Array a -- | Information about ArrayFire API and devices -- --
-- >>> info -- ArrayFire v3.6.4 (OpenCL, 64-bit Mac OSX, build 1b8030c5) -- [0] APPLE: AMD Radeon Pro 555X Compute Engine, 4096 MB -- -1- APPLE: Intel(R) UHD Graphics 630, 1536 MB --module ArrayFire.Device -- | Retrieve info from ArrayFire API -- --
-- ArrayFire v3.6.4 (OpenCL, 64-bit Mac OSX, build 1b8030c5) -- [0] APPLE: AMD Radeon Pro 555X Compute Engine, 4096 MB -- -1- APPLE: Intel(R) UHD Graphics 630, 1536 MB --info :: IO () -- | Calls af_init C function from ArrayFire API -- --
-- >>> afInit -- () --afInit :: IO () -- | Retrieves ArrayFire device information as String, same as -- info. -- --
-- >>> getInfoString -- "ArrayFire v3.6.4 (OpenCL, 64-bit Mac OSX, build 1b8030c5)\n[0] APPLE: AMD Radeon Pro 555X Compute Engine, 4096 MB\n-1- APPLE: Intel(R) UHD Graphics 630, 1536 MB\n" --getInfoString :: IO String -- | Retrieves count of devices -- --
-- >>> getDeviceCount -- 2 --getDeviceCount :: IO Int -- | Sets a device by Int -- --
-- >>> setDevice 0 -- () --setDevice :: Int -> IO () -- | Retrieves device identifier -- --
-- >>> getDevice -- 0 --getDevice :: IO Int -- | Set and get available ArrayFire Backends. -- --
-- module Main where -- -- import ArrayFire -- -- main :: IO () -- main = print =<< getAvailableBackends ---- --
-- [CPU,OpenCL] --module ArrayFire.Backend -- | Set specific Backend to use -- --
-- >>> setBackend OpenCL -- () --setBackend :: Backend -> IO () -- | Retrieve count of Backends available -- --
-- >>> getBackendCount -- 2 --getBackendCount :: IO Int -- | Retrieve available Backends -- --
-- >>> mapM_ print =<< getAvailableBackends -- CPU -- OpenCL --getAvailableBackends :: IO [Backend] -- | Retrieve Backend that specific Array was created from -- --
-- >>> getBackend (scalar @Double 2.0) -- OpenCL --getBackend :: Array a -> Backend -- | Retrieve active Backend -- --
-- >>> getActiveBackend -- OpenCL --getActiveBackend :: IO Backend -- | Retrieve Device ID that Array was created from -- --
-- >>> getDeviceID (scalar \@Double 2.0) -- 1 --getDeviceID :: Array a -> Int -- | Basic Linear Algebra Subprograms (BLAS) API -- --
-- main :: IO () -- main = print (matmul x y xProp yProp) -- where -- x,y :: Array Double -- x = matrix (2,3) [[1,2],[3,4],[5,6]] -- y = matrix (3,2) [[1,2,3],[4,5,6]] -- -- xProp, yProp :: MatProp -- xProp = None -- yProp = None ---- --
-- ArrayFire Array -- [2 2 1 1] -- 22.0000 49.0000 -- 28.0000 64.0000 --module ArrayFire.BLAS -- | The following applies for Sparse-Dense matrix multiplication. -- -- This function can be used with one sparse input. The sparse input must -- always be the lhs and the dense matrix must be rhs. -- -- The sparse array can only be of CSR format. -- -- The returned array is always dense. -- -- optLhs an only be one of AF_MAT_NONE, AF_MAT_TRANS, AF_MAT_CTRANS. -- -- optRhs can only be AF_MAT_NONE. -- --
-- >>> matmul (matrix @Double (2,2) [[1,2],[3,4]]) (matrix @Double (2,2) [[1,2],[3,4]]) None None -- ArrayFire Array -- [2 2 1 1] -- 7.0000 15.0000 -- 10.0000 22.0000 --matmul :: Array a -> Array a -> MatProp -> MatProp -> Array a -- | Scalar dot product between two vectors. Also referred to as the inner -- product. -- --
-- >>> dot (vector @Double 10 [1..]) (vector @Double 10 [1..]) None None -- ArrayFire Array -- [1 1 1 1] -- 385.0000 --dot :: Array a -> Array a -> MatProp -> MatProp -> Array a -- | Scalar dot product between two vectors. Also referred to as the inner -- product. Returns the result as a host scalar. -- --
-- >>> dotAll (vector @Double 10 [1..]) (vector @Double 10 [1..]) None None -- 385.0 :+ 0.0 --dotAll :: Array a -> Array a -> MatProp -> MatProp -> Complex Double -- | Transposes a matrix. -- --
-- >>> array = matrix @Double (2,3) [[2,3],[3,4],[5,6]] -- -- >>> array -- ArrayFire Array -- [2 3 1 1] -- 2.0000 3.0000 5.0000 -- 3.0000 4.0000 6.0000 ---- --
-- >>> transpose array True -- ArrayFire Array -- [3 2 1 1] -- 2.0000 3.0000 -- 3.0000 4.0000 -- 5.0000 6.0000 --transpose :: Array a -> Bool -> Array a -- | Transposes a matrix. -- --
-- >>> array = matrix @Double (2,2) [[1,2],[3,4]] -- -- >>> array -- ArrayFire Array -- [3 2 1 1] -- 1.0000 4.0000 -- 2.0000 5.0000 -- 3.0000 6.0000 ---- --
-- >>> transposeInPlace array False -- -- >>> array -- ArrayFire Array -- [2 2 1 1] -- 1.0000 2.0000 -- 3.0000 4.0000 --transposeInPlace :: Array a -> Bool -> IO () -- | Arithmetic functions over Array -- --
-- module Main where -- -- import qualified ArrayFire as A -- -- main :: IO () -- main = print $ A.scalar @Int 1 `A.add` A.scalar @Int 1 -- -- -- ArrayFire Array -- -- [1 1 1 1] -- -- 2 --module ArrayFire.Arith -- | Adds two Array objects -- --
-- >>> A.scalar @Int 1 `A.add` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 2 --add :: AFType a => Array a -> Array a -> Array a -- | Adds two Array objects -- --
-- >>> (A.scalar @Int 1 `A.addBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 2 --addBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Subtracts two Array objects -- --
-- >>> A.scalar @Int 1 `A.sub` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 0 --sub :: AFType a => Array a -> Array a -> Array a -- | Subtracts two Array objects -- --
-- >>> (A.scalar @Int 1 `subBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 0 --subBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Multiply two Array objects -- --
-- >>> A.scalar @Int 2 `mul` A.scalar @Int 2 -- ArrayFire Array -- [1 1 1 1] -- 4 --mul :: AFType a => Array a -> Array a -> Array a -- | Multiply two Array objects -- --
-- >>> (A.scalar @Int 2 `mulBatched` A.scalar @Int 2) True -- ArrayFire Array -- [1 1 1 1] -- 4 --mulBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Divide two Array objects -- --
-- >>> A.scalar @Int 6 `A.div` A.scalar @Int 3 -- ArrayFire Array -- [1 1 1 1] -- 2 --div :: AFType a => Array a -> Array a -> Array a -- | Divide two Array objects -- --
-- >>> (A.scalar @Int 6 `A.divBatched` A.scalar @Int 3) True -- ArrayFire Array -- [1 1 1 1] -- 2 --divBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Test if on Array is less than another Array -- --
-- >>> A.scalar @Int 1 `A.lt` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 0 --lt :: AFType a => Array a -> Array a -> Array CBool -- | Test if on Array is less than another Array -- --
-- >>> (A.scalar @Int 1 `A.ltBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 0 --ltBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Test if an Array is greater than another Array -- --
-- >>> A.scalar @Int 1 `A.gt` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 0 --gt :: AFType a => Array a -> Array a -> Array CBool -- | Test if an Array is greater than another Array -- --
-- >>> (A.scalar @Int 1 `gtBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 0 --gtBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Test if one Array is less than or equal to another Array -- --
-- >>> A.scalar @Int 1 `A.le` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 1 --le :: AFType a => Array a -> Array a -> Array CBool -- | Test if one Array is less than or equal to another Array -- --
-- >>> (A.scalar @Int 1 `A.leBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 1 --leBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Test if one Array is greater than or equal to another -- Array -- --
-- >>> A.scalar @Int 1 `A.ge` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 1 --ge :: AFType a => Array a -> Array a -> Array CBool -- | Test if one Array is greater than or equal to another -- Array -- --
-- >>> (A.scalar @Int 1 `A.geBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 1 --geBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Test if one Array is equal to another Array -- --
-- >>> A.scalar @Int 1 `A.eq` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 1 --eq :: AFType a => Array a -> Array a -> Array CBool -- | Test if one Array is equal to another Array -- --
-- >>> (A.scalar @Int 1 `A.eqBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 1 --eqBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Test if one Array is not equal to another Array -- --
-- >>> A.scalar @Int 1 `A.neq` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 0 --neq :: AFType a => Array a -> Array a -> Array CBool -- | Test if one Array is not equal to another Array -- --
-- >>> (A.scalar @Int 1 `A.neqBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 0 --neqBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Logical and one Array with another -- --
-- >>> A.scalar @Int 1 `A.and` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 1 --and :: AFType a => Array a -> Array a -> Array CBool -- | Logical and one Array with another -- --
-- >>> (A.scalar @Int 1 `andBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 1 --andBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Logical or one Array with another -- --
-- >>> A.scalar @Int 1 `A.or` A.scalar @Int 1 -- ArrayFire Array -- [1 1 1 1] -- 1 --or :: AFType a => Array a -> Array a -> Array CBool -- | Logical or one Array with another -- --
-- >>> (A.scalar @Int 1 `A.orBatched` A.scalar @Int 1) True -- ArrayFire Array -- [1 1 1 1] -- 1 --orBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Not the values of an Array -- --
-- >>> A.not (A.scalar @Int 1) -- ArrayFire Array -- [1 1 1 1] -- 0 --not :: AFType a => Array a -> Array CBool -- | Bitwise and the values in one Array against another -- Array -- --
-- >>> A.bitAnd (A.scalar @Int 1) (A.scalar @Int 1) -- ArrayFire Array -- [1 1 1 1] -- 1 --bitAnd :: AFType a => Array a -> Array a -> Array CBool -- | Bitwise and the values in one Array against another -- Array bitAndBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Bitwise or the values in one Array against another Array -- --
-- >>> A.bitOr (A.scalar @Int 1) (A.scalar @Int 1) -- ArrayFire Array -- [1 1 1 1] -- 1 --bitOr :: AFType a => Array a -> Array a -> Array CBool -- | Bitwise or the values in one Array against another Array -- --
-- >>> A.bitOrBatched (A.scalar @Int 1) (A.scalar @Int 1) False -- ArrayFire Array -- [1 1 1 1] -- 1 --bitOrBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Bitwise xor the values in one Array against another -- Array -- --
-- >>> A.bitXor (A.scalar @Int 1) (A.scalar @Int 1) -- ArrayFire Array -- [1 1 1 1] -- 0 --bitXor :: AFType a => Array a -> Array a -> Array CBool -- | Bitwise xor the values in one Array against another -- Array -- --
-- >>> A.bitXorBatched (A.scalar @Int 1) (A.scalar @Int 1) False -- ArrayFire Array -- [1 1 1 1] -- 0 --bitXorBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Left bit shift the values in one Array against another -- Array -- --
-- >>> A.bitShiftL (A.scalar @Int 1) (A.scalar @Int 1) -- ArrayFire Array -- [1 1 1 1] -- 2 --bitShiftL :: AFType a => Array a -> Array a -> Array CBool -- | Left bit shift the values in one Array against another -- Array -- --
-- >>> A.bitShiftLBatched (A.scalar @Int 1) (A.scalar @Int 1) False -- ArrayFire Array -- [1 1 1 1] -- 2 --bitShiftLBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Right bit shift the values in one Array against another -- Array -- --
-- >>> A.bitShiftR (A.scalar @Int 1) (A.scalar @Int 1) -- ArrayFire Array -- [1 1 1 1] -- 0 --bitShiftR :: AFType a => Array a -> Array a -> Array CBool -- | Right bit shift the values in one Array against another -- Array -- --
-- >>> A.bitShiftRBatched (A.scalar @Int 1) (A.scalar @Int 1) False -- ArrayFire Array -- [1 1 1 1] -- 0 --bitShiftRBatched :: AFType a => Array a -> Array a -> Bool -> Array CBool -- | Cast one Array into another -- --
-- >>> A.cast (A.scalar @Int 1) :: Array Double -- ArrayFire Array -- [1 1 1 1] -- 1.0000 --cast :: forall a b. (AFType a, AFType b) => Array a -> Array b -- | Find the minimum of two Arrays -- --
-- >>> A.minOf (A.scalar @Int 1) (A.scalar @Int 0) -- ArrayFire Array -- [1 1 1 1] -- 0 --minOf :: AFType a => Array a -> Array a -> Array a -- | Find the minimum of two Arrays -- --
-- >>> A.minOfBatched (A.scalar @Int 1) (A.scalar @Int 0) False -- ArrayFire Array -- [1 1 1 1] -- 0 --minOfBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Find the maximum of two Arrays -- --
-- >>> A.maxOf (A.scalar @Int 1) (A.scalar @Int 0) -- ArrayFire Array -- [1 1 1 1] -- 1 --maxOf :: AFType a => Array a -> Array a -> Array a -- | Find the maximum of two Arrays -- --
-- >>> A.maxOfBatched (A.scalar @Int 1) (A.scalar @Int 0) False -- ArrayFire Array -- [1 1 1 1] -- 1 --maxOfBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Should take the clamp -- --
-- >>> clamp (A.scalar @Int 2) (A.scalar @Int 1) (A.scalar @Int 3) -- ArrayFire Array -- [1 1 1 1] -- 2 --clamp :: Array a -> Array a -> Array a -> Array a -- | Should take the clamp -- --
-- >>> (clampBatched (A.scalar @Int 2) (A.scalar @Int 1) (A.scalar @Int 3)) True -- ArrayFire Array -- [1 1 1 1] -- 2 --clampBatched :: Array a -> Array a -> Array a -> Bool -> Array a -- | Find the remainder of two Arrays -- --
-- >>> A.rem (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 --rem :: AFType a => Array a -> Array a -> Array a -- | Find the remainder of two Arrays -- --
-- >>> A.remBatched (A.vector @Int 10 [1..]) (vector @Int 10 [2..]) True -- ArrayFire Array -- [10 1 1 1] -- 1 -- 2 -- 3 -- 4 -- 5 -- 6 -- 7 -- 8 -- 9 -- 10 --remBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Take the mod of two Arrays -- --
-- >>> A.mod (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 --mod :: AFType a => Array a -> Array a -> Array a -- | Take the mod of two Arrays -- --
-- >>> A.modBatched (vector @Int 10 [1..]) (vector @Int 10 [1..]) True -- ArrayFire Array -- [10 1 1 1] -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 --modBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Take the absolute value of an array -- --
-- >>> A.abs (A.scalar @Int (-1)) -- ArrayFire Array -- [1 1 1 1] -- 1.0000 --abs :: AFType a => Array a -> Array a -- | Find the arg of an array -- --
-- >>> A.arg (vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 --arg :: AFType a => Array a -> Array a -- | Find the sign of two Arrays -- --
-- >>> A.sign (vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 --sign :: AFType a => Array a -> Array a -- | Round the values in an Array -- --
-- >>> A.round (A.vector @Double 10 [1.4,1.5..]) -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 --round :: AFType a => Array a -> Array a -- | Truncate the values of an Array -- --
-- >>> A.trunc (A.vector @Double 10 [0.9,1.0..]) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 --trunc :: AFType a => Array a -> Array a -- | Take the floor of all values in an Array -- --
-- >>> A.floor (A.vector @Double 10 [11.0,10.9..]) -- ArrayFire Array -- [10 1 1 1] -- 11.0000 -- 10.0000 -- 10.0000 -- 10.0000 -- 10.0000 -- 10.0000 -- 10.0000 -- 10.0000 -- 10.0000 -- 10.0000 --floor :: AFType a => Array a -> Array a -- | Take the ceil of all values in an Array -- --
-- >>> A.ceil (A.vector @Double 10 [0.9,1.0..]) -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 1.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 -- 2.0000 --ceil :: AFType a => Array a -> Array a -- | Take the sin of all values in an Array -- --
-- >>> A.sin (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.8415 -- 0.9093 -- 0.1411 -- -0.7568 -- -0.9589 -- -0.2794 -- 0.6570 -- 0.9894 -- 0.4121 -- -0.5440 --sin :: AFType a => Array a -> Array a -- | Take the cos of all values in an Array -- --
-- >>> A.cos (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.5403 -- -0.4161 -- -0.9900 -- -0.6536 -- 0.2837 -- 0.9602 -- 0.7539 -- -0.1455 -- -0.9111 -- -0.8391 --cos :: AFType a => Array a -> Array a -- | Take the tan of all values in an Array -- --
-- >>> A.tan (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.5574 -- -2.1850 -- -0.1425 -- 1.1578 -- -3.3805 -- -0.2910 -- 0.8714 -- -6.7997 -- -0.4523 -- 0.6484 --tan :: AFType a => Array a -> Array a -- | Take the asin of all values in an Array -- --
-- >>> A.asin (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.5708 -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan --asin :: AFType a => Array a -> Array a -- | Take the acos of all values in an Array -- --
-- >>> A.acos (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan --acos :: AFType a => Array a -> Array a -- | Take the atan of all values in an Array -- --
-- >>> A.atan (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.7854 -- 1.1071 -- 1.2490 -- 1.3258 -- 1.3734 -- 1.4056 -- 1.4289 -- 1.4464 -- 1.4601 -- 1.4711 --atan :: AFType a => Array a -> Array a -- | Take the atan2 of all values in an Array -- --
-- >>> A.atan2 (A.vector @Double 10 [1..]) (A.vector @Double 10 [2..]) -- ArrayFire Array -- [10 1 1 1] -- 0.4636 -- 0.5880 -- 0.6435 -- 0.6747 -- 0.6947 -- 0.7086 -- 0.7188 -- 0.7266 -- 0.7328 -- 0.7378 --atan2 :: AFType a => Array a -> Array a -> Array a -- | Take the atan2 of all values in an Array -- --
-- >>> A.atan2Batched (A.vector @Double 10 [1..]) (A.vector @Double 10 [2..]) True -- ArrayFire Array -- [10 1 1 1] -- 0.4636 -- 0.5880 -- 0.6435 -- 0.6747 -- 0.6947 -- 0.7086 -- 0.7188 -- 0.7266 -- 0.7328 -- 0.7378 --atan2Batched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Take the cplx2 of all values in an Array -- --
-- >>> A.cplx2 (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- (1.0000,1.0000) -- (2.0000,2.0000) -- (3.0000,3.0000) -- (4.0000,4.0000) -- (5.0000,5.0000) -- (6.0000,6.0000) -- (7.0000,7.0000) -- (8.0000,8.0000) -- (9.0000,9.0000) -- (10.0000,10.0000) --cplx2 :: AFType a => Array a -> Array a -> Array a -- | Take the cplx2Batched of all values in an Array -- --
-- >>> A.cplx2Batched (A.vector @Int 10 [1..]) (A.vector @Int 10 [1..]) True -- ArrayFire Array -- [10 1 1 1] -- (1.0000,1.0000) -- (2.0000,2.0000) -- (3.0000,3.0000) -- (4.0000,4.0000) -- (5.0000,5.0000) -- (6.0000,6.0000) -- (7.0000,7.0000) -- (8.0000,8.0000) -- (9.0000,9.0000) -- (10.0000,10.0000) --cplx2Batched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Execute cplx -- --
-- >>> A.cplx (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- (1.0000,0.0000) -- (2.0000,0.0000) -- (3.0000,0.0000) -- (4.0000,0.0000) -- (5.0000,0.0000) -- (6.0000,0.0000) -- (7.0000,0.0000) -- (8.0000,0.0000) -- (9.0000,0.0000) -- (10.0000,0.0000) --cplx :: AFType a => Array a -> Array a -- | Execute real -- --
-- >>> A.real (A.scalar @(Complex Double) (10 :+ 11)) :: Array Double -- ArrayFire Array -- [1 1 1 1] -- 10.0000 --real :: (AFType a, AFType (Complex b), RealFrac a, RealFrac b) => Array (Complex b) -> Array a -- | Execute imag -- --
-- >>> A.imag (A.scalar @(Complex Double) (10 :+ 11)) :: Array Double -- ArrayFire Array -- [1 1 1 1] -- 11.0000 --imag :: (AFType a, AFType (Complex b), RealFrac a, RealFrac b) => Array (Complex b) -> Array a -- | Execute conjg -- --
-- >>> A.conjg (A.vector @Double 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 2.0000 -- 3.0000 -- 4.0000 -- 5.0000 -- 6.0000 -- 7.0000 -- 8.0000 -- 9.0000 -- 10.0000 --conjg :: AFType a => Array a -> Array a -- | Execute sinh -- --
-- >>> A.sinh (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.1752 -- 3.6269 -- 10.0179 -- 27.2899 -- 74.2032 -- 201.7132 -- 548.3161 -- 1490.4789 -- 4051.5420 -- 11013.2324 --sinh :: AFType a => Array a -> Array a -- | Execute cosh -- --
-- >>> A.cosh (A.vector @Double 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.5431 -- 3.7622 -- 10.0677 -- 27.3082 -- 74.2099 -- 201.7156 -- 548.3170 -- 1490.4792 -- 4051.5420 -- 11013.2329 --cosh :: AFType a => Array a -> Array a -- | Execute tanh -- --
-- >>> A.tanh (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.7616 -- 0.9640 -- 0.9951 -- 0.9993 -- 0.9999 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 --tanh :: AFType a => Array a -> Array a -- | Execute asinh -- --
-- >>> A.asinh (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.8814 -- 1.4436 -- 1.8184 -- 2.0947 -- 2.3124 -- 2.4918 -- 2.6441 -- 2.7765 -- 2.8934 -- 2.9982 --asinh :: AFType a => Array a -> Array a -- | Execute acosh -- --
-- >>> A.acosh (A.vector @Double 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 1.3170 -- 1.7627 -- 2.0634 -- 2.2924 -- 2.4779 -- 2.6339 -- 2.7687 -- 2.8873 -- 2.9932 --acosh :: AFType a => Array a -> Array a -- | Execute atanh -- --
-- >>> A.atanh (A.vector @Double 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- inf -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan -- nan --atanh :: AFType a => Array a -> Array a -- | Execute root -- --
-- >>> A.root (A.vector @Double 10 [1..]) (A.vector @Double 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 1.4142 -- 1.4422 -- 1.4142 -- 1.3797 -- 1.3480 -- 1.3205 -- 1.2968 -- 1.2765 -- 1.2589 --root :: AFType a => Array a -> Array a -> Array a -- | Execute rootBatched -- --
-- >>> A.rootBatched (vector @Double 10 [1..]) (vector @Double 10 [1..]) True -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 1.4142 -- 1.4422 -- 1.4142 -- 1.3797 -- 1.3480 -- 1.3205 -- 1.2968 -- 1.2765 -- 1.2589 --rootBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Execute pow -- --
-- >>> A.pow (A.vector @Int 10 [1..]) 2 -- ArrayFire Array -- [10 1 1 1] -- 1 -- 4 -- 9 -- 16 -- 25 -- 36 -- 49 -- 64 -- 81 -- 100 --pow :: AFType a => Array a -> Array a -> Array a -- | Execute powBatched -- --
-- >>> A.powBatched (A.vector @Int 10 [1..]) (A.constant @Int [1] 2) True -- ArrayFire Array -- [10 1 1 1] -- 1 -- 4 -- 9 -- 16 -- 25 -- 36 -- 49 -- 64 -- 81 -- 100 --powBatched :: AFType a => Array a -> Array a -> Bool -> Array a -- | Raise an Array to the second power -- --
-- >>> A.pow2 (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 2 -- 4 -- 8 -- 16 -- 32 -- 64 -- 128 -- 256 -- 512 -- 1024 --pow2 :: AFType a => Array a -> Array a -- | Execute exp on Array -- --
-- >>> A.exp (A.vector @Double 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 2.7183 -- 7.3891 -- 20.0855 -- 54.5982 -- 148.4132 -- 403.4288 -- 1096.6332 -- 2980.9580 -- 8103.0839 -- 22026.4658 --exp :: AFType a => Array a -> Array a -- | Execute sigmoid on Array -- --
-- >>> A.sigmoid (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.7311 -- 0.8808 -- 0.9526 -- 0.9820 -- 0.9933 -- 0.9975 -- 0.9991 -- 0.9997 -- 0.9999 -- 1.0000 --sigmoid :: AFType a => Array a -> Array a -- | Execute expm1 -- --
-- >>> A.expm1 (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.7183 -- 6.3891 -- 19.0855 -- 53.5981 -- 147.4132 -- 402.4288 -- 1095.6332 -- 2979.9580 -- 8102.0840 -- 22025.4648 --expm1 :: AFType a => Array a -> Array a -- | Execute erf -- --
-- >>> A.erf (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.8427 -- 0.9953 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 -- 1.0000 --erf :: AFType a => Array a -> Array a -- | Execute erfc -- --
-- >>> A.erfc (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.1573 -- 0.0047 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 -- 0.0000 --erfc :: AFType a => Array a -> Array a -- | Execute log -- --
-- >>> A.log (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 0.6931 -- 1.0986 -- 1.3863 -- 1.6094 -- 1.7918 -- 1.9459 -- 2.0794 -- 2.1972 -- 2.3026 --log :: AFType a => Array a -> Array a -- | Execute log1p -- --
-- >>> A.log1p (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.6931 -- 1.0986 -- 1.3863 -- 1.6094 -- 1.7918 -- 1.9459 -- 2.0794 -- 2.1972 -- 2.3026 -- 2.3979 --log1p :: AFType a => Array a -> Array a -- | Execute log10 -- --
-- >>> A.log10 (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 0.3010 -- 0.4771 -- 0.6021 -- 0.6990 -- 0.7782 -- 0.8451 -- 0.9031 -- 0.9542 -- 1.0000 --log10 :: AFType a => Array a -> Array a -- | Execute log2 -- --
-- >>> A.log2 (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 1.0000 -- 1.5850 -- 2.0000 -- 2.3219 -- 2.5850 -- 2.8074 -- 3.0000 -- 3.1699 -- 3.3219 --log2 :: AFType a => Array a -> Array a -- | Execute sqrt -- --
-- >>> A.sqrt (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 1.4142 -- 1.7321 -- 2.0000 -- 2.2361 -- 2.4495 -- 2.6458 -- 2.8284 -- 3.0000 -- 3.1623 --sqrt :: AFType a => Array a -> Array a -- | Execute cbrt -- --
-- >>> A.cbrt (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 1.2599 -- 1.4422 -- 1.5874 -- 1.7100 -- 1.8171 -- 1.9129 -- 2.0000 -- 2.0801 -- 2.1544 --cbrt :: AFType a => Array a -> Array a -- | Execute factorial -- --
-- >>> A.factorial (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 2.0000 -- 6.0000 -- 24.0000 -- 120.0000 -- 720.0001 -- 5040.0020 -- 40319.9961 -- 362880.0000 -- 3628801.7500 --factorial :: AFType a => Array a -> Array a -- | Execute tgamma -- --
-- >>> tgamma (vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 1.0000 -- 2.0000 -- 6.0000 -- 24.0000 -- 120.0000 -- 720.0001 -- 5040.0020 -- 40319.9961 -- 362880.0000 --tgamma :: AFType a => Array a -> Array a -- | Execute lgamma -- --
-- >>> A.lgamma (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 0.0000 -- 0.6931 -- 1.7918 -- 3.1781 -- 4.7875 -- 6.5793 -- 8.5252 -- 10.6046 -- 12.8018 --lgamma :: AFType a => Array a -> Array a -- | Execute isZero -- --
-- >>> A.isZero (A.vector @CBool 10 (repeat 0)) -- ArrayFire Array -- [10 1 1 1] -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 --isZero :: AFType a => Array a -> Array a -- | Execute isInf -- --
-- >>> A.isInf (A.vector @Double 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 -- 0 --isInf :: (Real a, AFType a) => Array a -> Array a -- | Execute isNaN -- --
-- >>> A.isNaN $ A.acos (A.vector @Int 10 [1..]) -- ArrayFire Array -- [10 1 1 1] -- 0 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 --isNaN :: forall a. (AFType a, Real a) => Array a -> Array a -- | Functions for loading and manipulating images with Array -- --
-- >>> image <- loadImage "image.png" True --module ArrayFire.Image -- | Calculates the gradient of an image -- --
-- >>> print (gradient image) --gradient :: Array a -> (Array a, Array a) -- | Loads an image from disk -- --
-- >>> image <- loadImage "image.png" True --loadImage :: String -> Bool -> IO (Array a) -- | Saves an image to disk -- --
-- >>> saveImage image "image.png" --saveImage :: Array a -> String -> IO () -- | Loads an image natively -- --
-- >>> image <- loadImageNative "image.png" --loadImageNative :: String -> IO (Array a) -- | Saves an image natively -- --
-- >>> saveImageNative image "image.png" --saveImageNative :: Array a -> String -> IO () -- | Returns true if ArrayFire was compiled with ImageIO (FreeImage) -- support -- --
-- >>> print =<< isImageIOAvailable --isImageIOAvailable :: IO Bool -- | Resize an input image. -- -- ArrayFire Docs -- -- Resizing an input image can be done using either AF_INTERP_NEAREST, -- AF_INTERP_BILINEAR or AF_INTERP_LOWER, interpolations. Nearest -- interpolation will pick the nearest value to the location, bilinear -- interpolation will do a weighted interpolation for calculate the new -- size and lower interpolation is similar to the nearest, except it will -- use the floor function to get the lower neighbor. resize :: Array a -> Int -> Int -> InterpType -> Array a -- | Transform an input image. -- -- ArrayFire Docs -- -- The transform function uses an affine or perspective transform matrix -- to tranform an input image into a new one. transform :: Array a -> Array a -> Int -> Int -> InterpType -> Bool -> Array a -- | Transform input coordinates. -- -- ArrayFire Docs -- -- C Interface for transforming an image C++ Interface for transforming -- coordinates. transformCoordinates :: Array a -> Float -> Float -> Array a -- | Rotate an input image. -- -- ArrayFire Docs -- -- Rotating an input image can be done using AF_INTERP_NEAREST, -- AF_INTERP_BILINEAR or AF_INTERP_LOWER interpolations. Nearest -- interpolation will pick the nearest value to the location, whereas -- bilinear interpolation will do a weighted interpolation for calculate -- the new size. rotate :: Array a -> Float -> Bool -> InterpType -> Array a -- | Translate an input image. -- -- ArrayFire Docs -- -- Translating an image is moving it along 1st and 2nd dimensions by -- trans0 and trans1. Positive values of these will move the data towards -- negative x and negative y whereas negative values of these will move -- the positive right and positive down. See the example below for more. translate :: Array a -> Float -> Float -> Int -> Int -> InterpType -> Array a -- | Scale an input image. -- -- ArrayFire Docs -- -- Scale is the same functionality as af::resize except that the scale -- function uses the transform kernels. The other difference is that -- scale does not set boundary values to be the boundary of the input -- array. Instead these are set to 0. scale :: Array a -> Float -> Float -> Int -> Int -> InterpType -> Array a -- | Skew an input image. -- -- ArrayFire Docs -- -- Skew function skews the input array along dim0 by skew0 and along dim1 -- by skew1. The skew areguments are in radians. Skewing the data means -- the data remains parallel along 1 dimensions but the other dimensions -- gets moved along based on the angle. If both skew0 and skew1 are -- specified, then the data will be skewed along both directions. skew :: Array a -> Float -> Float -> Int -> Int -> InterpType -> Bool -> Array a -- | Histogram of input data. -- -- ArrayFire Docs -- -- A histogram is a representation of the distribution of given data. -- This representation is essentially a graph consisting of the data -- range or domain on one axis and frequency of occurence on the other -- axis. All the data in the domain is counted in the appropriate bin. -- The total number of elements belonging to each bin is known as the -- bin's frequency. histogram :: AFType a => Array a -> Int -> Double -> Double -> Array Word32 -- | Dilation(morphological operator) for images. -- -- ArrayFire Docs -- -- The dilation function takes two pieces of data as inputs. The first is -- the input image to be morphed, and the second is the mask indicating -- the neighborhood around each pixel to match. -- --
-- >>> constant @Double [2,2] 2.0 -- ArrayFire Array -- [2 2 1 1] -- 2.0000 2.0000 -- 2.0000 2.0000 --module ArrayFire.Data -- | Creates an Array from a scalar value from given dimensions -- --
-- >>> constant @Double [2,2] 2.0 -- ArrayFire Array -- [2 2 1 1] -- 2.0000 2.0000 -- 2.0000 2.0000 --constant :: forall a. AFType a => [Int] -> a -> Array a -- | Creates a range of values in an Array -- --
-- >>> range @Double [10] (-1) -- ArrayFire Array -- [10 1 1 1] -- 0.0000 -- 1.0000 -- 2.0000 -- 3.0000 -- 4.0000 -- 5.0000 -- 6.0000 -- 7.0000 -- 8.0000 -- 9.0000 --range :: forall a. AFType a => [Int] -> Int -> Array a -- | Create an sequence [0, dims.elements() - 1] and modify to specified -- dimensions dims and then tile it according to tile_dims. -- -- http://arrayfire.org/docs/group__data__func__iota.htm -- --
-- >>> iota @Double [5,3] [] -- ArrayFire Array -- [5 3 1 1] -- 0.0000 5.0000 10.0000 -- 1.0000 6.0000 11.0000 -- 2.0000 7.0000 12.0000 -- 3.0000 8.0000 13.0000 -- 4.0000 9.0000 14.0000 ---- --
-- >>> iota @Double [5,3] [1,2] -- ArrayFire Array -- [5 6 1 1] -- 0.0000 5.0000 10.0000 0.0000 5.0000 10.0000 -- 1.0000 6.0000 11.0000 1.0000 6.0000 11.0000 -- 2.0000 7.0000 12.0000 2.0000 7.0000 12.0000 -- 3.0000 8.0000 13.0000 3.0000 8.0000 13.0000 -- 4.0000 9.0000 14.0000 4.0000 9.0000 14.0000 --iota :: forall a. AFType a => [Int] -> [Int] -> Array a -- | Creates the identity Array from given dimensions -- --
-- >>> identity [2,2] -- ArrayFire Array -- [2 2 1 1] -- 1.0000 0.0000 -- 0.0000 1.0000 --identity :: forall a. AFType a => [Int] -> Array a -- | Create a diagonal matrix from input array when extract is set to false -- --
-- >>> diagCreate (vector @Double 2 [1..]) 0 -- ArrayFire Array -- [2 2 1 1] -- 1.0000 0.0000 -- 0.0000 2.0000 --diagCreate :: AFType (a :: *) => Array a -> Int -> Array a -- | Create a diagonal matrix from input array when extract is set to false -- --
-- >>> diagExtract (matrix @Double (2,2) [[1,2],[3,4]]) 0 -- ArrayFire Array -- [2 1 1 1] -- 1.0000 -- 4.0000 --diagExtract :: AFType (a :: *) => Array a -> Int -> Array a -- | Join two Arrays together along a specified dimension -- --
-- >>> join 0 (matrix @Double (2,2) [[1,2],[3,4]]) (matrix @Double (2,2) [[5,6],[7,8]]) -- ArrayFire Array -- [4 2 1 1] -- 1.0000 3.0000 -- 2.0000 4.0000 -- 5.0000 7.0000 -- 6.0000 8.0000 --join :: Int -> Array (a :: *) -> Array a -> Array a -- | Join many Arrays together along a specified dimension -- --
-- >>> joinMany 0 [1,2,3] -- ArrayFire Array -- [3 1 1 1] -- 1.0000 2.0000 3.0000 --joinMany :: Int -> [Array a] -> Array a -- | Tiles an Array according to specified dimensions -- --
-- >>> tile @Double (scalar 22.0) [5,5] -- ArrayFire Array -- [5 5 1 1] -- 22.0000 22.0000 22.0000 22.0000 22.0000 -- 22.0000 22.0000 22.0000 22.0000 22.0000 -- 22.0000 22.0000 22.0000 22.0000 22.0000 -- 22.0000 22.0000 22.0000 22.0000 22.0000 -- 22.0000 22.0000 22.0000 22.0000 22.0000 --tile :: Array (a :: *) -> [Int] -> Array a -- | Reorders an Array according to newly specified dimensions -- --
-- >>> reorder @Double (scalar 22.0) [5,5] -- ArrayFire Array -- [5 5 1 1] -- 22.0000 22.0000 22.0000 22.0000 22.0000 -- 22.0000 22.0000 22.0000 22.0000 22.0000 -- 22.0000 22.0000 22.0000 22.0000 22.0000 -- 22.0000 22.0000 22.0000 22.0000 22.0000 -- 22.0000 22.0000 22.0000 22.0000 22.0000 --reorder :: Array (a :: *) -> [Int] -> Array a -- | Shift elements in an Array along a specified dimension (elements will -- wrap). -- --
-- >>> shift (vector @Double 4 [1..]) 2 0 0 0 -- ArrayFire Array -- [4 1 1 1] -- 3.0000 -- 4.0000 -- 1.0000 -- 2.0000 --shift :: Array (a :: *) -> Int -> Int -> Int -> Int -> Array a -- | Modify dimensions of array -- --
-- >>> moddims (vector @Double 3 [1..]) [1,3] -- ArrayFire Array -- [1 3 1 1] -- 1.0000 2.0000 3.0000 --moddims :: forall a. Array (a :: *) -> [Int] -> Array a -- | Flatten an Array into a single dimension -- --
-- >>> flat (matrix @Double (2,2) [[1..],[1..]]) -- ArrayFire Array -- [4 1 1 1] -- 1.0000 -- 2.0000 -- 1.0000 -- 2.0000 ---- --
-- >>> flat $ cube @Int (2,2,2) [[[1,1],[1,1]],[[1,1],[1,1]]] -- ArrayFire Array -- [8 1 1 1] -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 -- 1 --flat :: Array a -> Array a -- | Flip the values of an Array along a specified dimension -- --
-- >>> matrix @Double (2,2) [[2,2],[3,3]] -- ArrayFire Array -- [2 2 1 1] -- 2.0000 3.0000 -- 2.0000 3.0000 ---- --
-- >>> A.flip (matrix @Double (2,2) [[2,2],[3,3]]) 1 -- ArrayFire Array -- [2 2 1 1] -- 3.0000 2.0000 -- 3.0000 2.0000 --flip :: Array a -> Int -> Array a -- | Create a lower triangular matrix from input array. -- --
-- >>> lower (constant [2,2] 10 :: Array Double) True -- ArrayFire Array -- [2 2 1 1] -- 1.0000 0.0000 -- 10.0000 1.0000 --lower :: Array a -> Bool -> Array a -- | Create an upper triangular matrix from input array. -- --
-- >>> upper (constant [2,2] 10 :: Array Double) True -- ArrayFire Array -- [2 2 1 1] -- 1.0000 10.0000 -- 0.0000 1.0000 --upper :: Array a -> Bool -> Array a -- | Selects elements from two arrays based on the values of a binary -- conditional array. -- --
-- >>> cond = vector @CBool 5 [1,0,1,0,1] -- -- >>> arr1 = vector @Double 5 (repeat 1) -- -- >>> arr2 = vector @Double 5 (repeat 2) -- -- >>> select cond arr1 arr2 -- ArrayFire Array -- [5 1 1 1] -- 1.0000 -- 2.0000 -- 1.0000 -- 2.0000 -- 1.0000 --select :: Array CBool -> Array a -> Array a -> Array a -- | Selects elements from two arrays based on the values of a binary -- conditional array. -- -- -- http://arrayfire.org/docs/group__data__func__select.htm#gab6886120d0bac4717276910e468bbe88 -- --
-- >>> cond = vector @CBool 5 [1,0,1,0,1] -- -- >>> arr1 = vector @Double 5 (repeat 1) -- -- >>> x = 99 -- -- >>> selectScalarR cond arr1 x -- ArrayFire Array -- [5 1 1 1] -- 1.0000 -- 99.0000 -- 1.0000 -- 99.0000 -- 1.0000 --selectScalarR :: Array CBool -> Array a -> Double -> Array a -- | Selects elements from two arrays based on the values of a binary -- conditional array. -- -- ArrayFire Docs -- --
-- >>> cond = vector @CBool 5 [1,0,1,0,1] -- -- >>> arr1 = vector @Double 5 (repeat 1) -- -- >>> x = 99 -- -- >>> selectScalarL cond x arr1 -- ArrayFire Array -- [5 1 1 1] -- 99.0000 -- 1.0000 -- 99.0000 -- 1.0000 -- 99.0000 --selectScalarL :: Array CBool -> Double -> Array a -> Array a -- | Functions for aggregation, manipulation of Array -- --
-- module Main where -- -- import qualified ArrayFire as A -- -- main :: IO () -- main = print $ A.sum (A.vector @Double 10 [1..]) 0 -- -- ArrayFire Array -- -- [1 1 1 1] -- -- 55.0000 --module ArrayFire.Algorithm -- | Sum all of the elements in Array along the specified dimension -- --
-- >>> A.sum (A.vector @Double 10 [1..]) 0 -- ArrayFire Array -- [1 1 1 1] -- 55.0000 ---- --
-- >>> A.sum (A.matrix @Double (10,10) $ replicate 10 [1..]) 1 -- ArrayFire Array -- [10 1 1 1] -- 10.0000 -- 20.0000 -- 30.0000 -- 40.0000 -- 50.0000 -- 60.0000 -- 70.0000 -- 80.0000 -- 90.0000 -- 100.0000 --sum :: AFType a => Array a -> Int -> Array a -- | Sum all of the elements in Array along the specified dimension, -- using a default value for NaN -- --
-- >>> A.sumNaN (A.vector @Double 10 [1..]) 0 0.0 -- ArrayFire Array -- [1 1 1 1] -- 55.0000 --sumNaN :: (Fractional a, AFType a) => Array a -> Int -> Double -> Array a -- | Product all of the elements in Array along the specified -- dimension -- --
-- >>> A.product (A.vector @Double 10 [1..]) 0 -- ArrayFire Array -- [1 1 1 1] -- 3628800.0000 --product :: AFType a => Array a -> Int -> Array a -- | Product all of the elements in Array along the specified -- dimension, using a default value for NaN -- --
-- >>> A.productNaN (A.vector @Double 10 [1..]) 0 0.0 -- ArrayFire Array -- [1 1 1 1] -- 3628800.0000 --productNaN :: (AFType a, Fractional a) => Array a -> Int -> Double -> Array a -- | Take the minimum of an Array along a specific dimension -- --
-- >>> A.min (A.vector @Double 10 [1..]) 0 -- ArrayFire Array -- [1 1 1 1] -- 1.0000 --min :: AFType a => Array a -> Int -> Array a -- | Take the maximum of an Array along a specific dimension -- --
-- >>> A.max (A.vector @Double 10 [1..]) 0 -- ArrayFire Array -- [1 1 1 1] -- 10.0000 --max :: AFType a => Array a -> Int -> Array a -- | Find if all elements in an Array are True along a -- dimension -- --
-- >>> A.allTrue (A.vector @CBool 10 (repeat 0)) 0 -- ArrayFire Array -- [1 1 1 1] -- 0 --allTrue :: forall a. AFType a => Array a -> Int -> Array a -- | Find if any elements in an Array are True along a -- dimension -- --
-- >>> A.anyTrue (A.vector @CBool 10 (repeat 0)) 0 -- ArrayFire Array -- [1 1 1 1] -- 0 --anyTrue :: forall a. AFType a => Array a -> Int -> Array a -- | Count elements in an Array along a dimension -- --
-- >>> A.count (A.vector @Double 10 [1..]) 0 -- ArrayFire Array -- [1 1 1 1] -- 10 --count :: forall a. AFType a => Array a -> Int -> Array Int -- | Sum all elements in an Array along all dimensions -- --
-- >>> A.sumAll (A.vector @Double 10 [1..]) -- (55.0,0.0) --sumAll :: AFType a => Array a -> (Double, Double) -- | Sum all elements in an Array along all dimensions, using a -- default value for NaN -- --
-- >>> A.sumNaNAll (A.vector @Double 10 [1..]) 0.0 -- (55.0,0.0) --sumNaNAll :: (AFType a, Fractional a) => Array a -> Double -> (Double, Double) -- | Product all elements in an Array along all dimensions, using a -- default value for NaN -- --
-- >>> A.productAll (A.vector @Double 10 [1..]) -- (3628800.0,0.0) --productAll :: AFType a => Array a -> (Double, Double) -- | Product all elements in an Array along all dimensions, using a -- default value for NaN -- --
-- >>> A.productNaNAll (A.vector @Double 10 [1..]) 1.0 -- (3628800.0,0.0) --productNaNAll :: (AFType a, Fractional a) => Array a -> Double -> (Double, Double) -- | Take the minimum across all elements along all dimensions in -- Array -- --
-- >>> A.minAll (A.vector @Double 10 [1..]) -- (1.0,0.0) --minAll :: AFType a => Array a -> (Double, Double) -- | Take the maximum across all elements along all dimensions in -- Array -- --
-- >>> A.maxAll (A.vector @Double 10 [1..]) -- (10.0,0.0) --maxAll :: AFType a => Array a -> (Double, Double) -- | Decide if all elements along all dimensions in Array are True -- --
-- >>> A.allTrueAll (A.vector @CBool 10 (repeat 1)) -- (1.0, 0.0) --allTrueAll :: AFType a => Array a -> (Double, Double) -- | Decide if any elements along all dimensions in Array are True -- --
-- >>> A.anyTrueAll $ A.vector @CBool 10 (repeat 0) -- (0.0,0.0) --anyTrueAll :: AFType a => Array a -> (Double, Double) -- | Count all elements along all dimensions in Array -- --
-- >>> A.countAll (A.matrix @Double (100,100) (replicate 100 [1..])) -- (10000.0,0.0) --countAll :: AFType a => Array a -> (Double, Double) -- | Find the minimum element along a specified dimension in Array -- --
-- >>> A.imin (A.vector @Double 10 [1..]) 0 -- (ArrayFire Array -- [1 1 1 1] -- 1.0000 -- ,ArrayFire Array -- [1 1 1 1] -- 0 -- ) --imin :: AFType a => Array a -> Int -> (Array a, Array a) -- | Find the maximum element along a specified dimension in Array -- --
-- >>> A.imax (A.vector @Double 10 [1..]) 0 -- (ArrayFire Array -- [1 1 1 1] -- 10.0000 -- ,ArrayFire Array -- [1 1 1 1] -- 9 -- ) --imax :: AFType a => Array a -> Int -> (Array a, Array a) -- | Find the minimum element along all dimensions in Array -- --
-- >>> A.iminAll (A.vector @Double 10 [1..]) -- (1.0,0.0,0) --iminAll :: AFType a => Array a -> (Double, Double, Int) -- | Find the maximum element along all dimensions in Array -- --
-- >>> A.imaxAll (A.vector @Double 10 [1..]) -- (10.0,0.0,9) --imaxAll :: AFType a => Array a -> (Double, Double, Int) -- | Calculate sum of Array across specified dimension -- --
-- >>> A.accum (A.vector @Double 10 [1..]) 0 -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 3.0000 -- 6.0000 -- 10.0000 -- 15.0000 -- 21.0000 -- 28.0000 -- 36.0000 -- 45.0000 -- 55.0000 --accum :: AFType a => Array a -> Int -> Array a -- | Scan elements of an Array across a dimension, using a -- BinaryOp, specifying inclusivity. -- --
-- >>> A.scan (A.vector @Double 10 [1..]) 0 Add True -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 3.0000 -- 6.0000 -- 10.0000 -- 15.0000 -- 21.0000 -- 28.0000 -- 36.0000 -- 45.0000 -- 55.0000 --scan :: AFType a => Array a -> Int -> BinaryOp -> Bool -> Array a -- | Scan elements of an Array across a dimension, by key, using a -- BinaryOp, specifying inclusivity. -- --
-- >>> A.scanByKey (A.vector @Int 7 [2..]) (A.vector @Int 10 [1..]) 1 Add True -- ArrayFire Array -- [10 1 1 1] -- 1 -- 2 -- 3 -- 4 -- 5 -- 6 -- 7 -- 8 -- 9 -- 10 --scanByKey :: (AFType a, AFType k) => Array k -> Array a -> Int -> BinaryOp -> Bool -> Array a -- | Find indices where input Array is non zero -- --
-- >>> A.where' (A.vector @Double 10 (repeat 0)) -- ArrayFire Array -- [0 1 1 1] -- <empty> --where' :: AFType a => Array a -> Array a -- | First order numerical difference along specified dimension. -- --
-- >>> A.diff1 (A.vector @Double 4 [10,35,65,95]) 0 -- ArrayFire Array -- [3 1 1 1] -- 25.0000 -- 30.0000 -- 30.0000 --diff1 :: AFType a => Array a -> Int -> Array a -- | Second order numerical difference along specified dimension. -- --
-- >>> A.diff2 (A.vector @Double 5 [1.0,20,55,89,44]) 0 -- ArrayFire Array -- [3 1 1 1] -- 16.0000 -- -1.0000 -- -79.0000 --diff2 :: AFType a => Array a -> Int -> Array a -- | Sort an Array along a specified dimension, specifying ordering of -- results (ascending / descending) -- --
-- >>> A.sort (A.vector @Double 4 [ 2,4,3,1 ]) 0 True -- ArrayFire Array -- [4 1 1 1] -- 1.0000 -- 2.0000 -- 3.0000 -- 4.0000 ---- --
-- >>> A.sort (A.vector @Double 4 [ 2,4,3,1 ]) 0 False -- ArrayFire Array -- [4 1 1 1] -- 4.0000 -- 3.0000 -- 2.0000 -- 1.0000 --sort :: AFType a => Array a -> Int -> Bool -> Array a -- | Sort an Array along a specified dimension, specifying ordering -- of results (ascending / descending), returns indices of sorted results -- --
-- >>> A.sortIndex (A.vector @Double 4 [3,2,1,4]) 0 True -- (ArrayFire Array -- [4 1 1 1] -- 1.0000 -- 2.0000 -- 3.0000 -- 4.0000 -- ,ArrayFire Array -- [4 1 1 1] -- 2 -- 1 -- 0 -- 3 -- ) --sortIndex :: AFType a => Array a -> Int -> Bool -> (Array a, Array a) -- | Sort an Array along a specified dimension by keys, specifying -- ordering of results (ascending / descending) -- --
-- >>> A.sortByKey (A.vector @Double 4 [2,1,4,3]) (A.vector @Double 4 [10,9,8,7]) 0 True -- (ArrayFire Array -- [4 1 1 1] -- 1.0000 -- 2.0000 -- 3.0000 -- 4.0000 -- ,ArrayFire Array -- [4 1 1 1] -- 9.0000 -- 10.0000 -- 7.0000 -- 8.0000 -- ) --sortByKey :: AFType a => Array a -> Array a -> Int -> Bool -> (Array a, Array a) -- | Finds the unique values in an Array, specifying if sorting -- should occur. -- --
-- >>> A.setUnique (A.vector @Double 2 [1.0,1.0]) True -- ArrayFire Array -- [1 1 1 1] -- 1.0000 --setUnique :: AFType a => Array a -> Bool -> Array a -- | Takes the union of two Arrays, specifying if setUnique -- should be called first. -- --
-- >>> A.setUnion (A.vector @Double 3 [3,4,5]) (A.vector @Double 3 [1,2,3]) True -- ArrayFire Array -- [5 1 1 1] -- 1.0000 -- 2.0000 -- 3.0000 -- 4.0000 -- 5.0000 --setUnion :: AFType a => Array a -> Array a -> Bool -> Array a -- | Takes the intersection of two Arrays, specifying if -- setUnique should be called first. -- --
-- >>> A.setIntersect (A.vector @Double 3 [3,4,5]) (A.vector @Double 3 [1,2,3]) True -- ArrayFire Array -- [1 1 1 1] -- 3.0000 --setIntersect :: AFType a => Array a -> Array a -> Bool -> Array a -- | Various utilities for working with the ArrayFire C library -- --
-- import qualified ArrayFire as A -- import Control.Monad -- -- main :: IO () -- main = do -- let arr = A.constant [1,1,1,1] 10 -- idx <- A.saveArray "key" arr "file.array" False -- foundIndex <- A.readArrayKeyCheck "file.array" "key" -- when (idx == foundIndex) $ do -- array <- A.readArrayKey "file.array" "key" -- print array ---- --
-- ArrayFire Array -- [ 1 1 1 1 ] -- 10 --module ArrayFire.Util -- | Retrieve version for ArrayFire API -- --
-- >>> print =<< getVersion ---- --
-- (3.6.4) --getVersion :: IO (Int, Int, Int) -- | Prints array to stdout -- --
-- >>> printArray (constant @Double [1] 1) ---- --
-- ArrayFire Array -- [ 1 1 1 1 ] -- 1.0 --printArray :: Array a -> IO () -- | Gets git revision of ArrayFire -- --
-- >>> putStrLn =<< getRevision ---- --
-- 1b8030c5 --getRevision :: IO String -- | Prints Array with error codes -- --
-- >>> printArrayGen "test" (constant @Double [1] 1) 2 ---- --
-- ArrayFire Array -- [ 1 1 1 1 ] -- 1.00 --printArrayGen :: String -> Array a -> Int -> IO () -- | Saves Array to disk -- -- Save an array to a binary file. The saveArray and readArray -- functions are designed to provide store and read access to arrays -- using files written to disk. -- http://arrayfire.org/docs/group__stream__func__save.htm -- --
-- >>> saveArray "my array" (constant @Double [1] 1) "array.file" True ---- --
-- 0 --saveArray :: String -> Array a -> FilePath -> Bool -> IO Int -- | Reads Array by index -- -- The saveArray and readArray functions are designed to provide -- store and read access to arrays using files written to disk. -- http://arrayfire.org/docs/group__stream__func__save.htm -- --
-- >>> readArrayIndex "array.file" 0 ---- --
-- ArrayFire Array -- [ 1 1 1 1 ] -- 10.0000 --readArrayIndex :: FilePath -> Int -> IO (Array a) -- | Reads Array by key -- --
-- >>> readArrayKey "array.file" "my array" ---- --
-- ArrayFire Array -- [ 1 1 1 1 ] -- 10.0000 --readArrayKey :: FilePath -> String -> IO (Array a) -- | Reads Array, checks if a key exists in the specified file -- -- When reading by key, it may be a good idea to run this function first -- to check for the key and then call the readArray using the index. -- http://arrayfire.org/docs/group__stream__func__read.htm#ga31522b71beee2b1c06d49b5aa65a5c6f -- --
-- >>> readArrayCheck "array.file" "my array" ---- --
-- 0 --readArrayKeyCheck :: FilePath -> String -> IO Int -- | Convert ArrayFire Array to String, used for Show -- instance. -- --
-- >>> putStrLn $ arrayString (constant @Double 10 [1,1,1,1]) ---- --
-- ArrayFire Array -- [ 1 1 1 1 ] -- 10.0000 --arrayString :: Array a -> String -- | Convert ArrayFire Array to String -- --
-- >>> print (constant @Double 10 [1,1,1,1]) 4 False ---- --
-- ArrayFire Array -- [ 1 1 1 1 ] -- 10.0000 --arrayToString :: String -> Array a -> Int -> Bool -> String -- | Retrieve size of ArrayFire data type -- --
-- >>> getSizeOf (Proxy @ Double) ---- --
-- 8 --getSizeOf :: forall a. AFType a => Proxy a -> Int -- | Functions for constructing and querying metadata from Array -- --
-- module Main where -- -- import ArrayFire -- -- main :: IO () -- main = print (matrix @Double (2,2) [ [1..], [1..] ]) ---- --
-- ArrayFire Array -- [2 2 1 1] -- 1.0000 1.0000 -- 2.0000 2.0000 --module ArrayFire.Array -- | Smart constructor for creating a scalar Array -- --
-- >>> scalar @Double 2.0 -- ArrayFire Array -- [1 1 1 1] -- 2.0000 --scalar :: AFType a => a -> Array a -- | Smart constructor for creating a vector Array -- --
-- >>> vector @Double 10 [1..] -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 2.0000 -- 3.0000 -- 4.0000 -- 5.0000 -- 6.0000 -- 7.0000 -- 8.0000 -- 9.0000 -- 10.0000 --vector :: AFType a => Int -> [a] -> Array a -- | Smart constructor for creating a matrix Array -- --
-- >>> A.matrix @Double (3,2) [[1,2,3],[4,5,6]] -- ArrayFire Array -- [3 2 1 1] -- 1.0000 4.0000 -- 2.0000 5.0000 -- 3.0000 6.0000 --matrix :: AFType a => (Int, Int) -> [[a]] -> Array a -- | Smart constructor for creating a cubic Array -- --
-- >>> cube @Double (2,2,2) [[[2,2],[2,2]],[[2,2],[2,2]]] ---- --
-- ArrayFire Array -- [2 2 2 1] -- 2.0000 2.0000 -- 2.0000 2.0000 -- -- 2.0000 2.0000 -- 2.0000 2.0000 --cube :: AFType a => (Int, Int, Int) -> [[[a]]] -> Array a -- | Smart constructor for creating a tensor Array -- --
-- >>> tensor @Double (2,2,2,2) [[[[2,2],[2,2]],[[2,2],[2,2]]], [[[2,2],[2,2]],[[2,2],[2,2]]]] ---- --
-- ArrayFire Array -- [2 2 2 2] -- 2.0000 2.0000 -- 2.0000 2.0000 -- -- 2.0000 2.0000 -- 2.0000 2.0000 -- -- -- 2.0000 2.0000 -- 2.0000 2.0000 -- -- 2.0000 2.0000 -- 2.0000 2.0000 --tensor :: AFType a => (Int, Int, Int, Int) -> [[[[a]]]] -> Array a -- | Internal function for Array construction -- --
-- >>> mkArray @Double [10] [1.0 .. 10.0] -- ArrayFire Array -- [10 1 1 1] -- 1.0000 -- 2.0000 -- 3.0000 -- 4.0000 -- 5.0000 -- 6.0000 -- 7.0000 -- 8.0000 -- 9.0000 -- 10.0000 --mkArray :: forall array. AFType array => [Int] -> [array] -> Array array -- | Copies an Array to a new Array -- --
-- >>> copyArray (scalar @Double 10) -- ArrayFire Array -- [1 1 1 1] -- 10.0000 --copyArray :: AFType a => Array a -> Array a -- | Retains an Array, increases reference count -- --
-- >>> retainArray (scalar @Double 10) -- ArrayFire Array -- [1 1 1 1] -- 10.0000 --retainArray :: AFType a => Array a -> Array a -- | Retrieves Array reference count -- --
-- >>> initialArray = scalar @Double 10 -- -- >>> retainedArray = retain initialArray -- -- >>> getDataRefCount retainedArray -- 2 --getDataRefCount :: AFType a => Array a -> Int -- | Should manual evaluation occur -- --
-- >>> setManualEvalFlag True -- () --setManualEvalFlag :: Bool -> IO () -- | Retrieve manual evaluation status -- --
-- >>> setManualEvalFlag False -- -- >>> getManualEvalFlag -- False --getManualEvalFlag :: IO Bool -- | Retrieve element count -- --
-- >>> getElements (vector @Double 10 [1..]) -- 10 --getElements :: AFType a => Array a -> Int -- | Retrieve type of Array -- --
-- >>> getType (vector @Double 10 [1..]) -- F64 --getType :: AFType a => Array a -> AFDType -- | Retrieves dimensions of Array -- --
-- >>> getDims (vector @Double 10 [1..]) -- (10,1,1,1) --getDims :: AFType a => Array a -> (Int, Int, Int, Int) -- | Retrieves number of dimensions in Array -- --
-- >>> getNumDims (matrix @Double (2,2) [[1..],[1..]]) -- 2 --getNumDims :: AFType a => Array a -> Int -- | Checks if an Array is empty -- --
-- >>> isEmpty (matrix @Double (2,2) [[1..],[1..]]) -- False --isEmpty :: AFType a => Array a -> Bool -- | Checks if an Array is a scalar (contains only one element) -- --
-- >>> isScalar (matrix @Double (2,2) [[1..],[1..]]) -- False -- -- >>> isScalar (1.0 :: Array Double) -- True --isScalar :: AFType a => Array a -> Bool -- | Checks if an Array is row-oriented -- --
-- >>> isRow (matrix @Double (2,2) [[1..],[1..]]) -- False --isRow :: AFType a => Array a -> Bool -- | Checks if an Array is a column-oriented -- --
-- >>> isColumn (vector @Double 10 [1..]) -- True --isColumn :: AFType a => Array a -> Bool -- | Checks if an Array is a vector -- --
-- >>> isVector (vector @Double 10 [1..]) -- True -- -- >>> isVector (1.0 :: Array Double) -- False --isVector :: AFType a => Array a -> Bool -- | Checks if an Array is a Complex -- --
-- >>> isComplex (scalar (1.0 :+ 1.0) :: Array (Complex Double)) -- True --isComplex :: AFType a => Array a -> Bool -- | Checks if an Array is Real -- --
-- >>> isReal (scalar 1.0 :: Array Double) -- True --isReal :: AFType a => Array a -> Bool -- | Checks if an Array is Double -- --
-- >>> isDouble (scalar 1.0 :: Array Double) -- True --isDouble :: AFType a => Array a -> Bool -- | Checks if an Array is Float -- --
-- >>> isSingle (scalar 1.0 :: Array Float) -- True --isSingle :: AFType a => Array a -> Bool -- | Checks if an Array is Double, Float, Complex -- Double, or Complex Float -- --
-- >>> isRealFloating (scalar 1.0 :: Array Double) -- True --isRealFloating :: AFType a => Array a -> Bool -- | Checks if an Array is Double or Float -- --
-- >>> isFloating (scalar 1.0 :: Array Double) -- True --isFloating :: AFType a => Array a -> Bool -- | Checks if an Array is of type Int16, Int32, or Int64 -- --
-- >>> isInteger (scalar 1 :: Array Int16) -- True --isInteger :: AFType a => Array a -> Bool -- | Checks if an Array is of type CBool -- --
-- >>> isBool (scalar 1 :: Array CBool) -- True --isBool :: AFType a => Array a -> Bool -- | Checks if an Array is sparse -- --
-- >>> isSparse (scalar 1 :: Array Double) -- False --isSparse :: AFType a => Array a -> Bool -- | Converts an Array to a Storable Vector -- --
-- >>> toVector (vector @Double 10 [1..]) -- [1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] --toVector :: forall a. AFType a => Array a -> Vector a -- | Converts an Array to [a] -- --
-- >>> toList (vector @Double 10 [1..]) -- [1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] --toList :: forall a. AFType a => Array a -> [a] -- | Retrieves single scalar value from an Array -- --
-- >>> getScalar (scalar @Double 22.0) :: Double -- 22.0 --getScalar :: forall a b. (Storable a, AFType b) => Array b -> a -- | Statistics API. Example of finding the top k elements along with their -- indices from an Array -- --
-- >>> let (vals,indexes) = topk ( vector @Double 10 [1..] ) 3 TopKDefault -- >>> vals -- -- ArrayFire Array -- [3 1 1 1] -- 10.0000 -- 9.0000 -- 8.0000 -- -- >>> indexes -- -- ArrayFire Array -- [3 1 1 1] -- 9 -- 8 -- 7 --module ArrayFire.Statistics -- | Calculates mean of Array along user-specified dimension. -- --
-- >>> mean ( vector @Int 10 [1..] ) 0 -- ArrayFire Array -- [1 1 1 1] -- 5.5000 --mean :: AFType a => Array a -> Int -> Array a -- | Calculates meanWeighted of Array along user-specified -- dimension. -- --
-- >>> meanWeighted (vector @Double 10 [1..10]) (vector @Double 10 [1..10]) 0 -- ArrayFire Array -- [1 1 1 1] -- 7.0000 --meanWeighted :: AFType a => Array a -> Array a -> Int -> Array a -- | Calculates variance of Array along user-specified -- dimension. -- --
-- >>> var (vector @Double 8 [1..8]) False 0 -- ArrayFire Array -- [1 1 1 1] -- 6.0000 --var :: AFType a => Array a -> Bool -> Int -> Array a -- | Calculates varWeighted of Array along user-specified -- dimension. -- --
-- >>> varWeighted ( vector @Double 10 [1..] ) ( vector @Double 10 [1..] ) 0 -- ArrayFire Array -- [1 1 1 1] -- 6.0000 --varWeighted :: AFType a => Array a -> Array a -> Int -> Array a -- | Calculates stdev of Array along user-specified -- dimension. -- --
-- >>> stdev (vector @Double 10 (cycle [1,-1])) 0 -- ArrayFire Array -- [1 1 1 1] -- 1.0000 --stdev :: AFType a => Array a -> Int -> Array a -- | Calculates covariance of two Arrays with a bias -- specifier. -- --
-- >>> cov (vector @Double 10 (repeat 1)) (vector @Double 10 (repeat 1)) False -- ArrayFire Array -- [1 1 1 1] -- 0.0000 --cov :: AFType a => Array a -> Array a -> Bool -> Array a -- | Calculates median of Array along user-specified -- dimension. -- --
-- >>> median ( vector @Double 10 [1..] ) 0 -- ArrayFire Array -- [1 1 1 1] -- 5.5000 --median :: AFType a => Array a -> Int -> Array a -- | Calculates mean of all elements in an Array -- --
-- >>> meanAll $ matrix @Double (2,2) [[1,2],[4,5]] -- (3.0,2.232709401e-314) --meanAll :: AFType a => Array a -> (Double, Double) -- | Calculates weighted mean of all elements in an Array -- --
-- >>> meanAllWeighted (matrix @Double (2,2) [[1,2],[3,4]]) (matrix @Double (2,2) [[1,2],[3,4]]) -- (3.0,1.400743288453e-312) --meanAllWeighted :: AFType a => Array a -> Array a -> (Double, Double) -- | Calculates variance of all elements in an Array -- --
-- >>> varAll (vector @Double 10 (repeat 10)) False -- (0.0,1.4013073623e-312) --varAll :: AFType a => Array a -> Bool -> (Double, Double) -- | Calculates weighted variance of all elements in an Array -- --
-- >>> varAllWeighted ( vector @Double 10 [1..] ) ( vector @Double 10 [1..] ) -- (6.0,2.1941097984e-314) --varAllWeighted :: AFType a => Array a -> Array a -> (Double, Double) -- | Calculates standard deviation of all elements in an Array -- --
-- >>> stdevAll (vector @Double 10 (repeat 10)) -- (0.0,2.190573324e-314) --stdevAll :: AFType a => Array a -> (Double, Double) -- | Calculates median of all elements in an Array -- --
-- >>> medianAll (vector @Double 10 (repeat 10)) -- (10.0,2.1961564713e-314) --medianAll :: (AFType a, Fractional a) => Array a -> (Double, Double) -- | This algorithm returns Pearson product-moment correlation coefficient. -- https://en.wikipedia.org/wiki/Pearson_correlation_coefficient -- --
-- >>> corrCoef ( vector @Int 10 [1..] ) ( vector @Int 10 [10,9..] ) -- (-1.0,2.1904819737e-314) --corrCoef :: AFType a => Array a -> Array a -> (Double, Double) -- | This function returns the top k values along a given dimension of the -- input array. -- --
-- >>> let (vals,indexes) = topk ( vector @Double 10 [1..] ) 3 TopKDefault -- >>> indexes -- -- ArrayFire Array -- [3 1 1 1] -- 9 -- 8 -- 7 -- -- >>> vals -- ArrayFire Array -- [3 1 1 1] -- 10.0000 -- 9.0000 -- 8.0000 ---- -- The indices along with their values are returned. If the input is a -- multi-dimensional array, the indices will be the index of the value in -- that dimension. Order of duplicate values are not preserved. This -- function is optimized for small values of k. This function performs -- the operation across all dimensions of the input array. This function -- is optimized for small values of k. The order of the returned keys may -- not be in the same order as the appear in the input array topk :: AFType a => Array a -> Int -> TopK -> (Array a, Array a) -- | Functions pertaining to Computer Vision. module ArrayFire.Vision -- | FAST feature detectors -- -- ArrayFire Docs -- -- A circle of radius 3 pixels, translating into a total of 16 pixels, is -- checked for sequential segments of pixels much brighter or much darker -- than the central one. For a pixel p to be considered a feature, there -- must exist a sequential segment of arc_length pixels in the circle -- around it such that all are greather than (p + thr) or smaller than (p -- - thr). After all features in the image are detected, if nonmax is -- true, the non-maximal suppression is applied, checking all detected -- features and the features detected in its 8-neighborhood and discard -- it if its score is non maximal. fast :: Array a -> Float -> Int -> Bool -> Float -> Int -> Features -- | Harris corner detection -- -- ArrayFire Docs -- -- Harris corner detector. harris :: Array a -> Int -> Float -> Float -> Int -> Float -> Features -- | ORB Feature descriptor -- -- ArrayFire Docs -- -- Extract ORB descriptors from FAST features that hold higher Harris -- responses. FAST does not compute orientation, thus, orientation of -- features is calculated using the intensity centroid. As FAST is also -- not multi-scale enabled, a multi-scale pyramid is calculated by -- downsampling the input image multiple times followed by FAST feature -- detection on each scale. orb :: Array a -> Float -> Int -> Float -> Int -> Bool -> (Features, Array a) -- | SIFT feature detector and descriptor extractor. -- -- ArrayFire Docs -- -- C Interface for SIFT feature detector and descriptor. sift :: Array a -> Int -> Float -> Float -> Float -> Bool -> Float -> Float -> (Features, Array a) -- | SIFT feature detector and descriptor extractor. -- -- ArrayFire Docs -- -- C Interface for SIFT feature detector and descriptor. gloh :: Array a -> Int -> Float -> Float -> Float -> Bool -> Float -> Float -> (Features, Array a) -- | Hamming Matcher -- -- ArrayFire Docs -- -- Calculates Hamming distances between two 2-dimensional arrays -- containing features, one of the arrays containing the training data -- and the other the query data. One of the dimensions of the both arrays -- must be equal among them, identifying the length of each feature. The -- other dimension indicates the total number of features in each of the -- training and query arrays. Two 1-dimensional arrays are created as -- results, one containg the smallest N distances of the query array and -- another containing the indices of these distances in the training -- array. The resulting 1-dimensional arrays have length equal to the -- number of features contained in the query array. hammingMatcher :: Array a -> Array a -> Int -> Int -> (Array a, Array a) -- | Nearest Neighbor -- -- ArrayFire Docs -- -- Calculates nearest distances between two 2-dimensional arrays -- containing features based on the type of distance computation chosen. -- Currently, AF_SAD (sum of absolute differences), AF_SSD (sum of -- squared differences) and AF_SHD (hamming distance) are supported. One -- of the arrays containing the training data and the other the query -- data. One of the dimensions of the both arrays must be equal among -- them, identifying the length of each feature. The other dimension -- indicates the total number of features in each of the training and -- query arrays. Two 1-dimensional arrays are created as results, one -- containg the smallest N distances of the query array and another -- containing the indices of these distances in the training array. The -- resulting 1-dimensional arrays have length equal to the number of -- features contained in the query array. nearestNeighbor :: Array a -> Array a -> Int -> Int -> MatchType -> (Array a, Array a) -- | Nearest Neighbor -- -- ArrayFire Docs -- -- C Interface for image template matching. matchTemplate :: Array a -> Array a -> MatchType -> Array a -- | SUSAN corner detector. -- -- ArrayFire Docs -- -- SUSAN is an acronym standing for Smallest Univalue Segment -- Assimilating Nucleus. This method places a circular disc over the -- pixel to be tested (a.k.a nucleus) to compute the corner measure of -- that corresponding pixel. The region covered by the circular disc is -- M, and a pixel in this region is represented by m M where m 0 is the -- nucleus. Every pixel in the region is compared to the nucleus using -- the following comparison function: susan :: Array a -> Int -> Float -> Float -> Float -> Int -> Features -- | Difference of Gaussians. -- -- ArrayFire Docs -- -- Given an image, this function computes two different versions of -- smoothed input image using the difference smoothing parameters and -- subtracts one from the other and returns the result. dog :: Array a -> Int -> Int -> Array a -- | Homography Estimation. -- -- ArrayFire Docs -- -- Homography estimation find a perspective transform between two sets of -- 2D points. homography :: forall a. AFType a => Array a -> Array a -> Array a -> Array a -> HomographyType -> Float -> Int -> (Int, Array a) module ArrayFire