arrayfire-0.9.0.0: Haskell bindings to the ArrayFire general-purpose GPU library
CopyrightDavid Johnson (c) 2019-2026
LicenseBSD3
MaintainerDavid Johnson <code@dmj.io>
StabilityExperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

ArrayFire.Types

Description

Various Types related to the ArrayFire API

Synopsis

Documentation

data AFException Source #

Exception type for ArrayFire API

Constructors

AFException 

Fields

data Array a Source #

ArrayFire Array

Instances

Instances details
NFData (Array a) Source # 
Instance details

Defined in ArrayFire.Orphans

Methods

rnf :: Array a -> () #

(Ord a, AFType a, Fractional a) => Floating (Array a) Source # 
Instance details

Defined in ArrayFire.Orphans

Methods

pi :: Array a #

exp :: Array a -> Array a #

log :: Array a -> Array a #

sqrt :: Array a -> Array a #

(**) :: Array a -> Array a -> Array a #

logBase :: Array a -> Array a -> Array a #

sin :: Array a -> Array a #

cos :: Array a -> Array a #

tan :: Array a -> Array a #

asin :: Array a -> Array a #

acos :: Array a -> Array a #

atan :: Array a -> Array a #

sinh :: Array a -> Array a #

cosh :: Array a -> Array a #

tanh :: Array a -> Array a #

asinh :: Array a -> Array a #

acosh :: Array a -> Array a #

atanh :: Array a -> Array a #

log1p :: Array a -> Array a #

expm1 :: Array a -> Array a #

log1pexp :: Array a -> Array a #

log1mexp :: Array a -> Array a #

(Num a, AFType a) => Num (Array a) Source #

Elementwise Num instance for Array.

Note that signum implements the real-valued, three-way sign (x > 0 -> 1, x - -1, otherwise 0). This matches Haskell's signum for integral and real-floating arrays with finite values, but diverges in a few cases:

  • NaN (for Float/Double) yields 0, whereas Haskell yields NaN.
  • Negative zero -0.0 yields +0.0, losing the signed zero that Haskell preserves.
  • For complex arrays (e.g. Array (Complex Double)) it returns 1/-1/0 from an order comparison rather than the unit phasor z / abs z that Haskell's signum produces, so the law abs x * signum x == x does not hold for complex inputs.
Instance details

Defined in ArrayFire.Orphans

Methods

(+) :: Array a -> Array a -> Array a #

(-) :: Array a -> Array a -> Array a #

(*) :: Array a -> Array a -> Array a #

negate :: Array a -> Array a #

abs :: Array a -> Array a #

signum :: Array a -> Array a #

fromInteger :: Integer -> Array a #

(Fractional a, AFType a) => Fractional (Array a) Source # 
Instance details

Defined in ArrayFire.Orphans

Methods

(/) :: Array a -> Array a -> Array a #

recip :: Array a -> Array a #

fromRational :: Rational -> Array a #

Show (Array a) Source # 
Instance details

Defined in ArrayFire.Orphans

Methods

showsPrec :: Int -> Array a -> ShowS #

show :: Array a -> String #

showList :: [Array a] -> ShowS #

(AFType a, Eq a) => Eq (Array a) Source #

Structural equality on Array: equal shapes and elementwise-equal values.

Both inputs are eval-ed before comparison. On asynchronous backends (OpenCL) a freshly-created array's fill kernel is enqueued but may not have retired before the JIT for eqBatched runs, so the comparison can read stale buffer contents. eval flushes the command queue for each array, ensuring the buffer is populated. The CPU backend is synchronous and does not require this, but the call is cheap and correct on all backends.

allTrueAll returns a (real, imaginary) pair; imaginary is reliably 0 for boolean reductions, so comparing only the real part against 1.0 is safe.

Caveat: comparisons follow IEEE semantics elementwise, so an array containing NaN is not equal to itself (x == x is False), violating Eq reflexivity exactly as Double itself does. (/=) remains the exact negation of (==) in all cases, including NaN.

Instance details

Defined in ArrayFire.Orphans

Methods

(==) :: Array a -> Array a -> Bool #

(/=) :: Array a -> Array a -> Bool #

data Window Source #

ArrayFire Window

data Features Source #

ArrayFire Features

class Storable a => AFType a where Source #

Mapping of Haskell types to ArrayFire types

Methods

afType :: Proxy a -> AFDtype Source #

Instances

Instances details
AFType CBool Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Int16 Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Int32 Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Int64 Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Word16 Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Word32 Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Word64 Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Word8 Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Double Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Float Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Int Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType Word Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType (Complex Double) Source # 
Instance details

Defined in ArrayFire.Internal.Types

AFType (Complex Float) Source # 
Instance details

Defined in ArrayFire.Internal.Types

class AFType a => AFResult a where Source #

Maps an ArrayFire element type to the scalar type returned by whole-array reductions (e.g. meanAll, det). Real and integral element types yield Double; complex element types yield 'Complex Double'.

Associated Types

type Scalar a Source #

Methods

toAFResult :: (Double, Double) -> Scalar a Source #

Convert the raw (real, imag) pair returned by the C API to the appropriate Haskell scalar.

Instances

Instances details
AFResult CBool Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar CBool 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Int16 Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Int16 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Int32 Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Int32 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Int64 Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Int64 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Word16 Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Word16 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Word32 Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Word32 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Word64 Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Word64 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Word8 Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Word8 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Double Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Double 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Float Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Float 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Int Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Int 
Instance details

Defined in ArrayFire.Internal.Types

AFResult Word Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar Word 
Instance details

Defined in ArrayFire.Internal.Types

AFResult (Complex Double) Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar (Complex Double) 
Instance details

Defined in ArrayFire.Internal.Types

AFResult (Complex Float) Source # 
Instance details

Defined in ArrayFire.Internal.Types

Associated Types

type Scalar (Complex Float) 
Instance details

Defined in ArrayFire.Internal.Types

data TopK Source #

Order for topk results

Constructors

TopKDefault

Default order (same as TopKMax)

TopKMin

Return the k smallest values

TopKMax

Return the k largest values

Instances

Instances details
Enum TopK Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

succ :: TopK -> TopK #

pred :: TopK -> TopK #

toEnum :: Int -> TopK #

fromEnum :: TopK -> Int #

enumFrom :: TopK -> [TopK] #

enumFromThen :: TopK -> TopK -> [TopK] #

enumFromTo :: TopK -> TopK -> [TopK] #

enumFromThenTo :: TopK -> TopK -> TopK -> [TopK] #

Show TopK Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

showsPrec :: Int -> TopK -> ShowS #

show :: TopK -> String #

showList :: [TopK] -> ShowS #

Eq TopK Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: TopK -> TopK -> Bool #

(/=) :: TopK -> TopK -> Bool #

Ord TopK Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

compare :: TopK -> TopK -> Ordering #

(<) :: TopK -> TopK -> Bool #

(<=) :: TopK -> TopK -> Bool #

(>) :: TopK -> TopK -> Bool #

(>=) :: TopK -> TopK -> Bool #

max :: TopK -> TopK -> TopK #

min :: TopK -> TopK -> TopK #

data VarBias Source #

Variance bias correction method

Constructors

VarianceDefault

Default (same as VariancePopulation)

VarianceSample

Sample variance (divides by N-1; Bessel's correction)

VariancePopulation

Population variance (divides by N)

Instances

Instances details
Enum VarBias Source # 
Instance details

Defined in ArrayFire.Internal.Types

Show VarBias Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq VarBias Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: VarBias -> VarBias -> Bool #

(/=) :: VarBias -> VarBias -> Bool #

Ord VarBias Source # 
Instance details

Defined in ArrayFire.Internal.Types

data Backend Source #

ArrayFire backends

Constructors

Default

Use the default backend (determined by ArrayFire)

CPU

CPU backend (always available)

CUDA

NVIDIA CUDA GPU backend

OpenCL

OpenCL backend (AMD, Intel, NVIDIA)

Instances

Instances details
Show Backend Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq Backend Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: Backend -> Backend -> Bool #

(/=) :: Backend -> Backend -> Bool #

Ord Backend Source # 
Instance details

Defined in ArrayFire.Internal.Types

data MatchType Source #

Template matching metric type

Constructors

MatchTypeSAD

Sum of Absolute Differences

MatchTypeZSAD

Zero-mean Sum of Absolute Differences

MatchTypeLSAD

Locally scaled Sum of Absolute Differences

MatchTypeSSD

Sum of Squared Differences

MatchTypeZSSD

Zero-mean Sum of Squared Differences

MatchTypeLSSD

Locally scaled Sum of Squared Differences

MatchTypeNCC

Normalized Cross Correlation

MatchTypeZNCC

Zero-mean Normalized Cross Correlation

MatchTypeSHD

Sum of Hamming Distances

data BinaryOp Source #

Binary operation support (used with scan-by-key and similar operations)

Constructors

Add

Addition

Mul

Multiplication

Min

Minimum

Max

Maximum

Instances

Instances details
Show BinaryOp Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq BinaryOp Source # 
Instance details

Defined in ArrayFire.Internal.Types

Ord BinaryOp Source # 
Instance details

Defined in ArrayFire.Internal.Types

data MatProp Source #

Matrix properties

Constructors

None

No property

Trans

Data needs to be transposed

CTrans

Data needs to be conjugate transposed

Conj

Data needs to be conjugated

Upper

Matrix is upper triangular

Lower

Matrix is lower triangular

DiagUnit

Diagonal contains units; used with triangular solvers

Sym

Matrix is symmetric

PosDef

Matrix is positive definite

Orthog

Matrix is orthogonal

TriDiag

Matrix is tri-diagonal

BlockDiag

Matrix is block diagonal

Instances

Instances details
Show MatProp Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq MatProp Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: MatProp -> MatProp -> Bool #

(/=) :: MatProp -> MatProp -> Bool #

Ord MatProp Source # 
Instance details

Defined in ArrayFire.Internal.Types

data HomographyType Source #

Homography estimation method

Constructors

RANSAC

Random Sample Consensus — robust to outliers

LMEDS

Least Median of Squares — robust to up to 50% outliers

data RandomEngineType Source #

Type for different RandomEngines

Constructors

Philox 
ThreeFry 
Mersenne 

data Cell Source #

Cell type, used in Graphics module to describe a subplot position

Constructors

Cell 

Fields

Instances

Instances details
Show Cell Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

showsPrec :: Int -> Cell -> ShowS #

show :: Cell -> String #

showList :: [Cell] -> ShowS #

Eq Cell Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: Cell -> Cell -> Bool #

(/=) :: Cell -> Cell -> Bool #

data InterpType Source #

Interpolation type

Constructors

Nearest

Nearest-neighbor interpolation

Linear

Linear interpolation

Bilinear

Bilinear interpolation

Cubic

Cubic interpolation

LowerInterp

Floor interpolation (rounds down to nearest integer)

LinearCosine

Cosine-windowed linear interpolation

BilinearCosine

Cosine-windowed bilinear interpolation

Bicubic

Bicubic interpolation

CubicSpline

Cubic spline interpolation

BicubicSpline

Bicubic spline interpolation

data CSpace Source #

Color Space type

Constructors

Gray

Grayscale

RGB

Red-Green-Blue

HSV

Hue-Saturation-Value

YCBCR

Luminance + chroma (blue-difference, red-difference)

Instances

Instances details
Enum CSpace Source # 
Instance details

Defined in ArrayFire.Internal.Types

Show CSpace Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq CSpace Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: CSpace -> CSpace -> Bool #

(/=) :: CSpace -> CSpace -> Bool #

Ord CSpace Source # 
Instance details

Defined in ArrayFire.Internal.Types

data YccStd Source #

YCbCr standard

Constructors

Ycc601

ITU-R BT.601 (standard definition)

Ycc709

ITU-R BT.709 (high definition)

Ycc2020

ITU-R BT.2020 (ultra high definition)

Instances

Instances details
Show YccStd Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq YccStd Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: YccStd -> YccStd -> Bool #

(/=) :: YccStd -> YccStd -> Bool #

Ord YccStd Source # 
Instance details

Defined in ArrayFire.Internal.Types

data MomentType Source #

Image moment types

Constructors

M00

Zeroth-order moment (image area / mass)

M01

First-order moment about x-axis

M10

First-order moment about y-axis

M11

Mixed first-order moment

FirstOrder

All first-order moments (M00, M01, M10, M11)

data CannyThreshold Source #

Threshold mode for Canny edge detection

Constructors

Manual

User-supplied low and high threshold values

AutoOtsu

Thresholds computed automatically via Otsu's method

data FluxFunction Source #

Flux function for anisotropic diffusion

Constructors

FluxDefault

Default flux function (same as FluxQuadratic)

FluxQuadratic

Quadratic flux function (Perona-Malik)

FluxExponential

Exponential flux function (Perona-Malik)

data IterativeDeconvAlgo Source #

Iterative deconvolution algorithm

Constructors

DeconvDefault

Default algorithm (same as DeconvLandweber)

DeconvLandweber

Landweber iteration (gradient descent on least squares)

DeconvRichardsonLucy

Richardson-Lucy algorithm (maximum likelihood for Poisson noise)

Instances

Instances details
Enum IterativeDeconvAlgo Source # 
Instance details

Defined in ArrayFire.Internal.Types

Show IterativeDeconvAlgo Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq IterativeDeconvAlgo Source # 
Instance details

Defined in ArrayFire.Internal.Types

Ord IterativeDeconvAlgo Source # 
Instance details

Defined in ArrayFire.Internal.Types

data InverseDeconvAlgo Source #

Inverse (non-iterative) deconvolution algorithm

Constructors

InverseDeconvDefault

Default algorithm (same as InverseDeconvTikhonov)

InverseDeconvTikhonov

Tikhonov regularized Wiener filter

Instances

Instances details
Enum InverseDeconvAlgo Source # 
Instance details

Defined in ArrayFire.Internal.Types

Show InverseDeconvAlgo Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq InverseDeconvAlgo Source # 
Instance details

Defined in ArrayFire.Internal.Types

Ord InverseDeconvAlgo Source # 
Instance details

Defined in ArrayFire.Internal.Types

data Seq Source #

Sequence Type

Constructors

Seq 

Fields

Instances

Instances details
Show Seq Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

showsPrec :: Int -> Seq -> ShowS #

show :: Seq -> String #

showList :: [Seq] -> ShowS #

Eq Seq Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: Seq -> Seq -> Bool #

(/=) :: Seq -> Seq -> Bool #

Ord Seq Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

compare :: Seq -> Seq -> Ordering #

(<) :: Seq -> Seq -> Bool #

(<=) :: Seq -> Seq -> Bool #

(>) :: Seq -> Seq -> Bool #

(>=) :: Seq -> Seq -> Bool #

max :: Seq -> Seq -> Seq #

min :: Seq -> Seq -> Seq #

data Index Source #

Index Type

Instances

Instances details
ToIndexList Index Source # 
Instance details

Defined in ArrayFire.Index

Methods

toIndexList :: Index -> [Index] Source #

ToIndexList (Index, Index) Source # 
Instance details

Defined in ArrayFire.Index

Methods

toIndexList :: (Index, Index) -> [Index] Source #

ToIndexList (Index, Index, Index) Source # 
Instance details

Defined in ArrayFire.Index

ToIndexList (Index, Index, Index, Index) Source # 
Instance details

Defined in ArrayFire.Index

range :: Int -> Int -> Index Source #

Index a contiguous range [begin..end] with step 1.

rangeStep :: Int -> Int -> Int -> Index Source #

Index a range [begin..end] with an explicit step.

at :: Int -> Index Source #

Index a single element.

data NormType Source #

Norm Type

Constructors

NormVectorOne

treats the input as a vector and returns the sum of absolute values

NormVectorInf

treats the input as a vector and returns the max of absolute values

NormVector2

treats the input as a vector and returns euclidean norm

NormVectorP

treats the input as a vector and returns the p-norm

NormMatrix1

return the max of column sums

NormMatrixInf

return the max of row sums

NormMatrix2

returns the max singular value). Currently NOT SUPPORTED

NormMatrixLPQ

returns Lpq-norm

NormEuclid

The default. Same as AF_NORM_VECTOR_2

data ConvMode Source #

Convolution Mode

Constructors

ConvDefault

Output of the convolution is the same size as input

ConvExpand

Output of the convolution is signal_len + filter_len - 1

data ConvDomain Source #

Convolution Domain

Constructors

ConvDomainAuto

ArrayFire automatically picks the right convolution algorithm

ConvDomainSpatial

Perform convolution in spatial domain

ConvDomainFreq

Perform convolution in frequency domain

data Storage Source #

Storage type used for Sparse arrays

Constructors

Dense

Dense storage (not sparse)

CSR

Compressed Sparse Row format

CSC

Compressed Sparse Column format

COO

Coordinate list (COO) format

Instances

Instances details
Enum Storage Source # 
Instance details

Defined in ArrayFire.Internal.Types

Show Storage Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq Storage Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: Storage -> Storage -> Bool #

(/=) :: Storage -> Storage -> Bool #

Ord Storage Source # 
Instance details

Defined in ArrayFire.Internal.Types

data AFDType Source #

ArrayFire element types (mirrors af_dtype)

Constructors

F32

32-bit IEEE 754 float

C32

Complex number of two 32-bit floats

F64

64-bit IEEE 754 double

C64

Complex number of two 64-bit doubles

B8

8-bit boolean

S32

32-bit signed integer

U32

32-bit unsigned integer

U8

8-bit unsigned integer

S64

64-bit signed integer

U64

64-bit unsigned integer

S16

16-bit signed integer

U16

16-bit unsigned integer

Instances

Instances details
Enum AFDType Source # 
Instance details

Defined in ArrayFire.Internal.Types

Show AFDType Source # 
Instance details

Defined in ArrayFire.Internal.Types

Eq AFDType Source # 
Instance details

Defined in ArrayFire.Internal.Types

Methods

(==) :: AFDType -> AFDType -> Bool #

(/=) :: AFDType -> AFDType -> Bool #

newtype AFDtype Source #

Constructors

AFDtype 

Fields

Instances

Instances details
Storable AFDtype Source # 
Instance details

Defined in ArrayFire.Internal.Defines

Show AFDtype Source # 
Instance details

Defined in ArrayFire.Internal.Defines

Eq AFDtype Source # 
Instance details

Defined in ArrayFire.Internal.Defines

Methods

(==) :: AFDtype -> AFDtype -> Bool #

(/=) :: AFDtype -> AFDtype -> Bool #

data ColorMap Source #

Color map for rendering

Constructors

ColorMapDefault

Default grayscale color map

ColorMapSpectrum

Rainbow spectrum (violet to red)

ColorMapColors

Distinct colors

ColorMapRed

Red gradient

ColorMapMood

Mood color map (cool tones)

ColorMapHeat

Heat map (black to red to yellow to white)

ColorMapBlue

Blue gradient

ColorMapInferno

Perceptually uniform: black-purple-orange-yellow

ColorMapMagma

Perceptually uniform: black-purple-pink-white

ColorMapPlasma

Perceptually uniform: blue-purple-yellow

ColorMapViridis

Perceptually uniform: purple-teal-yellow