Copyright | David Johnson (c) 2019-2020 |
---|---|
License | BSD 3 |
Maintainer | David Johnson <djohnson.m@gmail.com> |
Stability | Experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- scalar :: AFType a => a -> Array a
- vector :: AFType a => Int -> [a] -> Array a
- matrix :: AFType a => (Int, Int) -> [[a]] -> Array a
- cube :: AFType a => (Int, Int, Int) -> [[[a]]] -> Array a
- tensor :: AFType a => (Int, Int, Int, Int) -> [[[[a]]]] -> Array a
- mkArray :: forall array. AFType array => [Int] -> [array] -> Array array
- copyArray :: AFType a => Array a -> Array a
- retainArray :: AFType a => Array a -> Array a
- getDataRefCount :: AFType a => Array a -> Int
- setManualEvalFlag :: Bool -> IO ()
- getManualEvalFlag :: IO Bool
- getElements :: AFType a => Array a -> Int
- getType :: AFType a => Array a -> AFDType
- getDims :: AFType a => Array a -> (Int, Int, Int, Int)
- getNumDims :: AFType a => Array a -> Int
- isEmpty :: AFType a => Array a -> Bool
- isScalar :: AFType a => Array a -> Bool
- isRow :: AFType a => Array a -> Bool
- isColumn :: AFType a => Array a -> Bool
- isVector :: AFType a => Array a -> Bool
- isComplex :: AFType a => Array a -> Bool
- isReal :: AFType a => Array a -> Bool
- isDouble :: AFType a => Array a -> Bool
- isSingle :: AFType a => Array a -> Bool
- isRealFloating :: AFType a => Array a -> Bool
- isFloating :: AFType a => Array a -> Bool
- isInteger :: AFType a => Array a -> Bool
- isBool :: AFType a => Array a -> Bool
- isSparse :: AFType a => Array a -> Bool
- toVector :: forall a. AFType a => Array a -> Vector a
- toList :: forall a. AFType a => Array a -> [a]
- getScalar :: forall a b. (Storable a, AFType b) => Array b -> a
Documentation
scalar :: AFType a => a -> Array a Source #
Smart constructor for creating a scalar Array
>>>
scalar @Double 2.0
ArrayFire Array [1 1 1 1] 2.0000
vector :: AFType a => Int -> [a] -> Array a Source #
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
matrix :: AFType a => (Int, Int) -> [[a]] -> Array a Source #
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
cube :: AFType a => (Int, Int, Int) -> [[[a]]] -> Array a Source #
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
tensor :: AFType a => (Int, Int, Int, Int) -> [[[[a]]]] -> Array a Source #
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
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
Retains an Array
, increases reference count
>>>
retainArray (scalar @Double 10)
ArrayFire Array [1 1 1 1] 10.0000
Retrieves Array
reference count
>>>
initialArray = scalar @Double 10
>>>
retainedArray = retain initialArray
>>>
getDataRefCount retainedArray
2
Should manual evaluation occur
>>>
setManualEvalFlag True
()
getManualEvalFlag :: IO Bool Source #
Retrieve manual evaluation status
>>>
setManualEvalFlag False
>>>
getManualEvalFlag
False
Retrieve element count
>>>
getElements (vector @Double 10 [1..])
10
getType :: AFType a => Array a -> AFDType Source #
Retrieve type of Array
>>>
getType (vector @Double 10 [1..])
F64
getDims :: AFType a => Array a -> (Int, Int, Int, Int) Source #
Retrieves dimensions of Array
>>>
getDims (vector @Double 10 [1..])
(10,1,1,1)
getNumDims :: AFType a => Array a -> Int Source #
Retrieves number of dimensions in Array
>>>
getNumDims (matrix @Double (2,2) [[1..],[1..]])
2
isEmpty :: AFType a => Array a -> Bool Source #
Checks if an Array
is empty
>>>
isEmpty (matrix @Double (2,2) [[1..],[1..]])
False
isScalar :: AFType a => Array a -> Bool Source #
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
isRow :: AFType a => Array a -> Bool Source #
Checks if an Array
is row-oriented
>>>
isRow (matrix @Double (2,2) [[1..],[1..]])
False
isColumn :: AFType a => Array a -> Bool Source #
Checks if an Array
is a column-oriented
>>>
isColumn (vector @Double 10 [1..])
True
isVector :: AFType a => Array a -> Bool Source #
Checks if an Array
is a vector
>>>
isVector (vector @Double 10 [1..])
True>>>
isVector (1.0 :: Array Double)
False
isComplex :: AFType a => Array a -> Bool Source #
Checks if an Array
is a Complex
>>>
isComplex (scalar (1.0 :+ 1.0) :: Array (Complex Double))
True
isReal :: AFType a => Array a -> Bool Source #
Checks if an Array
is Real
>>>
isReal (scalar 1.0 :: Array Double)
True
isInteger :: AFType a => Array a -> Bool Source #
Checks if an Array
is of type Int16, Int32, or Int64
>>>
isInteger (scalar 1 :: Array Int16)
True
isBool :: AFType a => Array a -> Bool Source #
Checks if an Array
is of type CBool
>>>
isBool (scalar 1 :: Array CBool)
True
isSparse :: AFType a => Array a -> Bool Source #
Checks if an Array
is sparse
>>>
isSparse (scalar 1 :: Array Double)
False