yarr-1.3.2: Yet another array library

Safe HaskellNone

Data.Yarr.Repr.Separate

Contents

Synopsis

Separate representation

data SE r Source

SEparate meta array representation. Internally SEparate arrays hold vector of it's slices (so, slices is just getter for them).

Mostly useful for:

  • Separate in memory manifest Foreign arrays ("Unboxed" arrays in vector/repa libraries terms).
  • Element-wise vector array fusion (see group of dmapElems functions).

Instances

(DefaultFusion r D l sh, Fusion (SE r) D l sh) => DefaultFusion (SE r) D l sh 
(DefaultIFusion r l D SH sh, IFusion (SE r) l D SH sh) => DefaultIFusion (SE r) l D SH sh 
(UTarget tr tl sh e, Vector v e) => UVecTarget (SE tr) tr tl sh v e 
(USource r l sh e, Vector v e) => UVecSource (SE r) r l sh v e 
(Shape sh, Vector v e, Storable e) => UVecSource (SE F) F L sh v e 
(Shape sh, Vector v e, NFData e) => UVecSource (SE MB) MB L sh v e 
(Shape sh, Vector v e, NFData e) => UVecSource (SE B) B L sh v e 
(Regular r l sh e, Shape sh, Vector v e) => VecRegular (SE r) r l sh v e 
(BlockShape sh, Vector v e, UVecTarget tr tslr tl sh v2 e, ~ * (Dim v) (Dim v2), InlinableArity (Dim v)) => RangeVecLoad (SE CV) CV CVL tr tslr tl sh v v2 e 
(BlockShape sh, Vector v e, UVecTarget tr tslr tl sh v2 e, ~ * (Dim v) (Dim v2), InlinableArity (Dim v)) => VecLoad (SE CV) CV CVL tr tslr tl sh v v2 e 
(UTarget tr tl sh e, Vector v e) => UTarget (SE tr) tl sh (v e) 
(USource r l sh e, Vector v e) => USource (SE r) l sh (v e) 
(Regular r l sh e, Vector v e) => Regular (SE r) l sh (v e) 
(Manifest r mr l sh e, Vector v e) => Manifest (SE r) (SE mr) l sh (v e) 
(NFData (UArray r l sh e), Shape sh, Vector v e) => NFData (UArray (SE r) l sh (v e)) 

There is also Separate UArray family constructor, which isn't presented in the docs because Haddock doesn't support associated family constructors.

See source of Data.Yarr.Repr.Separate module.

fromSlices :: (Regular r l sh e, Vector v e, Dim v ~ S n0) => VecList (Dim v) (UArray r l sh e) -> UArray (SE r) l sh (v e)Source

O(1) Glues several arrays of the same type into one separate array of vectors. All source arrays must be of the same extent.

Example:

let separateCoords = fromSlices (vl_3 xs ys zs)

unsafeMapSlicesSource

Arguments

:: (USource r l sh a, Vector v a, USource r2 l2 sh2 b, Vector v b, Dim v ~ S n0) 
=> (UArray r l sh a -> UArray r2 l2 sh2 b)

Slice mapper without restrictions

-> UArray (SE r) l sh (v a)

Source separate array

-> UArray (SE r2) l2 sh2 (v b)

Result separate array

O(depends on mapper function) Maps slices of separate array "entirely".

This function is useful when operation over slices is not element-wise (in that case you should use mapElems):

let blurredImage = unsafeMapSlices blur image

The function is unsafe because it doesn't check that slice mapper translates extents uniformly (though it is pure).

convert :: (Regular r l sh e, Vector v e, Vector v2 e, Dim v ~ Dim v2) => UArray (SE r) l sh (v e) -> UArray (SE r) l sh (v2 e)Source

O(0) Converts separate vector between vector types of the same arity.

Example:

 -- floatPairs :: UArray (SE F) Dim1 (VecList N2 Float)
 let cs :: UArray (SE F) Dim1 (Complex Float)
     cs = convert floatPairs

Element-wise fusion for arrays of vectors

dmapElemsSource

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, USource fslr l sh b, DefaultFusion slr fslr l sh, Vector v2 b, Dim v ~ Dim v2) 
=> VecList (Dim v) (a -> b)

Vector of mapper functions

-> UArray r l sh (v a)

Source array of vectors

-> UArray (SE fslr) l sh (v2 b)

Fused array

O(1) Injective element-wise fusion (mapping).

Example:

 let domainHSVImage =
         dmapElems (vl_3 (* 360) (* 100) (* 100))
                   normedHSVImage

Also, used internally to define mapElems function.

dmapElemsMSource

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, USource fslr l sh b, DefaultFusion slr fslr l sh, Vector v2 b, Dim v ~ Dim v2) 
=> VecList (Dim v) (a -> IO b)

Elemen-wise vector of monadic mappers

-> UArray r l sh (v a)

Source array of vectors

-> UArray (SE fslr) l sh (v2 b)

Result array

O(1) Monadic vesion of dmapElems function.

dzipElems2Source

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, VecRegular r slr l sh v b, USource slr l sh b, USource fslr l sh c, DefaultFusion slr fslr l sh, Vector v c) 
=> VecList (Dim v) (a -> b -> c)

.

-> UArray r l sh (v a) 
-> UArray r l sh (v b) 
-> UArray (SE fslr) l sh (v c) 

dzipElems2MSource

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, VecRegular r slr l sh v b, USource slr l sh b, USource fslr l sh c, DefaultFusion slr fslr l sh, Vector v c) 
=> VecList (Dim v) (a -> b -> IO c)

.

-> UArray r l sh (v a) 
-> UArray r l sh (v b) 
-> UArray (SE fslr) l sh (v c) 

dzipElems3Source

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, VecRegular r slr l sh v b, USource slr l sh b, VecRegular r slr l sh v c, USource slr l sh c, USource fslr l sh d, DefaultFusion slr fslr l sh, Vector v d) 
=> VecList (Dim v) (a -> b -> c -> d)

.

-> UArray r l sh (v a) 
-> UArray r l sh (v b) 
-> UArray r l sh (v c) 
-> UArray (SE fslr) l sh (v d) 

dzipElems3MSource

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, VecRegular r slr l sh v b, USource slr l sh b, VecRegular r slr l sh v c, USource slr l sh c, USource fslr l sh d, DefaultFusion slr fslr l sh, Vector v d) 
=> VecList (Dim v) (a -> b -> c -> IO d)

.

-> UArray r l sh (v a) 
-> UArray r l sh (v b) 
-> UArray r l sh (v c) 
-> UArray (SE fslr) l sh (v d) 

dzipElemsSource

Arguments

:: (Vector v2 b, Arity m, m ~ S m0, VecRegular r slr l sh v a, USource slr l sh a, USource fslr l sh b, DefaultFusion slr fslr l sh) 
=> VecList (Dim v2) (Fun m a b)

Vector of wrapped m-ary element-wise zippers

-> VecList m (UArray r l sh (v a))

Vector of source arrays of vectors

-> UArray (SE fslr) l sh (v2 b)

Fused result array

O(1) Generalized element-wise zipping of several arrays of vectors.

dzipElemsMSource

Arguments

:: (Vector v2 b, Arity m, m ~ S m0, VecRegular r slr l sh v a, USource slr l sh a, USource fslr l sh b, DefaultFusion slr fslr l sh) 
=> VecList (Dim v2) (Fun m a (IO b))

Vector of wrapped m-ary element-wise monadic zippers

-> VecList m (UArray r l sh (v a))

Vector of source arrays of vectors

-> UArray (SE fslr) l sh (v2 b)

Result array

O(1) Generalized monadic element-wise zipping of several arrays of vectors

Non-injective element-wise fusion

fmapElemsSource

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, USource fslr l sh b, Fusion slr fslr l sh, Vector v2 b, Dim v ~ Dim v2) 
=> VecList (Dim v) (a -> b)

.

-> UArray r l sh (v a) 
-> UArray (SE fslr) l sh (v2 b) 

Group of f-...-Elems- functions is used internally to define d-...-Elems- functions.

fmapElemsMSource

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, USource fslr l sh b, Fusion slr fslr l sh, Vector v2 b, Dim v ~ Dim v2) 
=> VecList (Dim v) (a -> IO b)

.

-> UArray r l sh (v a) 
-> UArray (SE fslr) l sh (v2 b) 

fzipElems2Source

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, VecRegular r slr l sh v b, USource slr l sh b, USource fslr l sh c, Fusion slr fslr l sh, Vector v c) 
=> VecList (Dim v) (a -> b -> c)

.

-> UArray r l sh (v a) 
-> UArray r l sh (v b) 
-> UArray (SE fslr) l sh (v c) 

fzipElems2MSource

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, VecRegular r slr l sh v b, USource slr l sh b, USource fslr l sh c, Fusion slr fslr l sh, Vector v c) 
=> VecList (Dim v) (a -> b -> IO c)

.

-> UArray r l sh (v a) 
-> UArray r l sh (v b) 
-> UArray (SE fslr) l sh (v c) 

fzipElems3Source

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, VecRegular r slr l sh v b, USource slr l sh b, VecRegular r slr l sh v c, USource slr l sh c, USource fslr l sh d, Fusion slr fslr l sh, Vector v d) 
=> VecList (Dim v) (a -> b -> c -> d)

.

-> UArray r l sh (v a) 
-> UArray r l sh (v b) 
-> UArray r l sh (v c) 
-> UArray (SE fslr) l sh (v d) 

fzipElems3MSource

Arguments

:: (VecRegular r slr l sh v a, USource slr l sh a, VecRegular r slr l sh v b, USource slr l sh b, VecRegular r slr l sh v c, USource slr l sh c, USource fslr l sh d, Fusion slr fslr l sh, Vector v d) 
=> VecList (Dim v) (a -> b -> c -> IO d)

.

-> UArray r l sh (v a) 
-> UArray r l sh (v b) 
-> UArray r l sh (v c) 
-> UArray (SE fslr) l sh (v d) 

fzipElemsSource

Arguments

:: (Vector v2 b, Arity m, m ~ S m0, VecRegular r slr l sh v a, USource slr l sh a, USource fslr l sh b, Fusion slr fslr l sh) 
=> VecList (Dim v2) (Fun m a b)

.

-> VecList m (UArray r l sh (v a)) 
-> UArray (SE fslr) l sh (v2 b) 

fzipElemsMSource

Arguments

:: (Vector v2 b, Arity m, m ~ S m0, VecRegular r slr l sh v a, USource slr l sh a, USource fslr l sh b, Fusion slr fslr l sh) 
=> VecList (Dim v2) (Fun m a (IO b))

.

-> VecList m (UArray r l sh (v a)) 
-> UArray (SE fslr) l sh (v2 b)