yarr-1.4.0.2: Yet another array library

Safe HaskellNone
LanguageHaskell98

Data.Yarr

Contents

Description

Type system intro:

Regular is main type class in the library. Like Source class in repa, it defines indexed type family: UArray. Classes USource, for arrays which could be indexed, and UTarget, for mutable arrays, inherit from Regular.

As in repa, arrays in Yarr are type-indexed. UArray type family has 2 type indexes:

  • representation index - the first type argument.
  • load type index - the second argument of the type family. Pair of load indexes, from source and target array determines how arrays will be loaded one to another. Load index is mostly internal thing. See Load class for details.

Rest 2 UArray parameters generalize Shape and element type.

VecRegular, UVecSource, UVecTarget are counterparts for arrays of fixed-sized vectors. These classes have 6 arguments: repr type index, slice repr type index, load type index, shape, vector type, vector element.

Note: in the docs "vector" always stands for fixed-size vector. Don't confuse with vector from vector library.

As in repa, there are several kinds of representations:

  • Manifest representations: Foreign and Boxed with MB (Mutable Boxed). The difference between Manifest and UTarget arrays is that Manifest arrays could be created (see new function). For example, FS (Foreign Slice) is a slice representation for F. FS-arrays are mutable, but you can't create a slice, you should firstly allocate entire F array.
  • Delayed, or fused representations: Delayed and CV (ConVoluted). Arrays of these types aren't really exist in memory. Finally they should be loaded to manifest arrays.
  • View representations: DT (Delayed Target) and FS. Useful for advanced hand-controlled flow operations.
  • Meta representations: SEparate and CHK (CHecKed). Thery are parameterized with another representation index. Arrays of meta types play almost like their prototypes. SE glues several arrays into one array of vectors (array types with SE index are always instances of VecRegular class). CHK is useful for debugging, it raises error on illegal indexing attempt. By default indexing is unchecked.

Representation choice:

Foreign is the main manifest representation. "Unboxed" arrays of tuples from repa and vector libraries may be emulated by (SE F) type index, but keep in mind that they are usually slower than vanilla foreign arrays, because the latter are memory-local.

How to load array into memory:

Currently there is only one option "out of the box" - to load image :) See Data.Yarr.IO.Image module in yarr-image-io package.

Consider also Data.Yarr.IO.List module, although it is very slow way to obtain manifest array in memory.

How to map and zip arrays:

See DefaultFusion class and functions in Data.Yarr.Flow module.

Example:

let delayedVecLengths = zipElems (x y -> sqrt (x * x + y * y)) vecs

How to compute an array:

See Load class and its counterpart VecLoad, and compute function.

Typical use:

vecLengths <- compute (loadP fill caps) delayedVecLengths
Working examples
https://github.com/leventov/yarr/tree/master/tests

How to write fast program:

  1. Read corresponding section in repa guide: http://hackage.haskell.org/packages/archive/repa/3.2.3.1/doc/html/Data-Array-Repa.html
  2. Write INLINE pragmas to all functions, including curried shortcuts. For example in such case: let {myIndex = index arr} in ... you should write: let {{-# INLINE myIndex #-}; myIndex = index arr} in ...
  3. Although the library is highly generalized, target programs should be as as precise in types as possible. Don't neglect writing signatures for functions.
  4. Compilation flags: -Odph -rtsopts -threaded -fno-liberate-case -funbox-strict-fields -fexpose-all-unfoldings -funfolding-keeness-factor1000 -fsimpl-tick-factor=500 -fllvm -optlo-O3.

Abbreviations across the library:

In names:

  • U-, u-, unsafe- prefixes mean that: a) function parameters must conform special statically unchecked conditions, or b) it isn't OK just to call the function, you must do something else, call another function. All functions in type classes with U- prefix (USource, UTarget) are unsafe.
  • d- prefix stands for "default". Typically function with d- prefix is carried version of the one without prefix.
  • I-, i- prefixes for "indexed". Functions with this prefix accept array index before element itself.
  • f- prefix means "fused". Used for functions from Fusion class.
  • -M, as usual, is for monadic versions of functions. However, if there isn't non-monadic version (the most part of core functions), the suffix is omitted.
  • -S and -P are suffixes from repa, they indicate sequential and parallel versions of flow operation, respectively.

In signatures:

  • r, tr, mr - representation, target repr, manifest repr. For the first type index of UArray family.
  • slr, tslr, mslr - slice representation, respectively
  • l, tl - load index, for the second argument of UArray
  • sh - array shape: Dim1, Dim2, or Dim3
  • v, v1, v2 - Vector type
  • e, e2 - vector element
  • n, m - Arity of vector

Synopsis

Core type system

Shapes

type Dim1 = Int Source #

type Dim2 = (Int, Int) Source #

type Dim3 = (Int, Int, Int) Source #

Fixed Vector

newtype Fun n a b :: * -> * -> * -> * #

Newtype wrapper which is used to make Fn injective. It's also a reader monad.

Constructors

Fun 

Fields

Instances

Arity n => Monad (Fun n a) 

Methods

(>>=) :: Fun n a a -> (a -> Fun n a b) -> Fun n a b #

(>>) :: Fun n a a -> Fun n a b -> Fun n a b #

return :: a -> Fun n a a #

fail :: String -> Fun n a a #

Arity n => Functor (Fun n a) 

Methods

fmap :: (a -> b) -> Fun n a a -> Fun n a b #

(<$) :: a -> Fun n a b -> Fun n a a #

Arity n => Applicative (Fun n a) 

Methods

pure :: a -> Fun n a a #

(<*>) :: Fun n a (a -> b) -> Fun n a a -> Fun n a b #

(*>) :: Fun n a a -> Fun n a b -> Fun n a b #

(<*) :: Fun n a a -> Fun n a b -> Fun n a a #

class Arity (Dim v) => Vector v a where #

Type class for vectors with fixed length. Instance should provide two functions: one to create vector and another for vector deconstruction. They must obey following law:

inspect v construct = v

Minimal complete definition

construct, inspect

Instances

RealFloat a => Vector Complex a 

Methods

construct :: Fun (Dim Complex) a (Complex a) #

inspect :: Complex a -> Fun (Dim Complex) a b -> b #

basicIndex :: Complex a -> Int -> a #

Vector Only a 

Methods

construct :: Fun (Dim Only) a (Only a) #

inspect :: Only a -> Fun (Dim Only) a b -> b #

basicIndex :: Only a -> Int -> a #

Vector Empty a 

Methods

construct :: Fun (Dim Empty) a (Empty a) #

inspect :: Empty a -> Fun (Dim Empty) a b -> b #

basicIndex :: Empty a -> Int -> a #

(~) * b a => Vector ((,) b) a

Note this instance (and other instances for tuples) is essentially monomorphic in element type. Vector type v of 2 element tuple (Int,Int) is (,) Int so it will only work with elements of type Int.

Methods

construct :: Fun (Dim ((,) b)) a (b, a) #

inspect :: (b, a) -> Fun (Dim ((,) b)) a b -> b #

basicIndex :: (b, a) -> Int -> a #

Vector (Proxy *) a 

Methods

construct :: Fun (Dim (Proxy *)) a (Proxy * a) #

inspect :: Proxy * a -> Fun (Dim (Proxy *)) a b -> b #

basicIndex :: Proxy * a -> Int -> a #

Arity n => Vector (VecList n) a 

Methods

construct :: Fun (Dim (VecList n)) a (VecList n a) #

inspect :: VecList n a -> Fun (Dim (VecList n)) a b -> b #

basicIndex :: VecList n a -> Int -> a #

Arity n => Vector (ContVec n) a 

Methods

construct :: Fun (Dim (ContVec n)) a (ContVec n a) #

inspect :: ContVec n a -> Fun (Dim (ContVec n)) a b -> b #

basicIndex :: ContVec n a -> Int -> a #

((~) * b a, (~) * c a) => Vector ((,,) b c) a 

Methods

construct :: Fun (Dim ((,,) b c)) a (b, c, a) #

inspect :: (b, c, a) -> Fun (Dim ((,,) b c)) a b -> b #

basicIndex :: (b, c, a) -> Int -> a #

((~) * b a, (~) * c a, (~) * d a) => Vector ((,,,) b c d) a 

Methods

construct :: Fun (Dim ((,,,) b c d)) a (b, c, d, a) #

inspect :: (b, c, d, a) -> Fun (Dim ((,,,) b c d)) a b -> b #

basicIndex :: (b, c, d, a) -> Int -> a #

((~) * b a, (~) * c a, (~) * d a, (~) * e a) => Vector ((,,,,) b c d e) a 

Methods

construct :: Fun (Dim ((,,,,) b c d e)) a (b, c, d, e, a) #

inspect :: (b, c, d, e, a) -> Fun (Dim ((,,,,) b c d e)) a b -> b #

basicIndex :: (b, c, d, e, a) -> Int -> a #

((~) * b a, (~) * c a, (~) * d a, (~) * e a, (~) * f a) => Vector ((,,,,,) b c d e f) a 

Methods

construct :: Fun (Dim ((,,,,,) b c d e f)) a (b, c, d, e, f, a) #

inspect :: (b, c, d, e, f, a) -> Fun (Dim ((,,,,,) b c d e f)) a b -> b #

basicIndex :: (b, c, d, e, f, a) -> Int -> a #

((~) * b a, (~) * c a, (~) * d a, (~) * e a, (~) * f a, (~) * g a) => Vector ((,,,,,,) b c d e f g) a 

Methods

construct :: Fun (Dim ((,,,,,,) b c d e f g)) a (b, c, d, e, f, g, a) #

inspect :: (b, c, d, e, f, g, a) -> Fun (Dim ((,,,,,,) b c d e f g)) a b -> b #

basicIndex :: (b, c, d, e, f, g, a) -> Int -> a #

type N1 = S Z #

type N2 = S N1 #

type N3 = S N2 #

type N4 = S N3 #

Dataflow (fusion operations)

Loading and computing arrays

Common representations

Foreign

data F Source #

Foreign representation is the heart of Yarr framework.

Internally it holds raw pointer (Ptr), which makes indexing foreign arrays not slower than GHC's built-in primitive arrays, but without freeze/thaw boilerplate.

Foreign arrays are very permissible, for example you can easily use them as source and target of Loading operation simultaneously, achieving old good in-place C-style array modifying:

loadS fill (dmap sqrt arr) arr

Foreign arrays are intented to hold all Storable types and vectors of them (because there is a conditional instance of Storalbe class for Vectors of Storables too).

Instances

(Shape sh, Storable a) => UTarget F L sh a Source # 

Methods

write :: UArray F L sh a -> sh -> a -> IO () Source #

linearWrite :: UArray F L sh a -> Int -> a -> IO () Source #

(Shape sh, Storable a) => USource F L sh a Source # 

Methods

index :: UArray F L sh a -> sh -> IO a Source #

linearIndex :: UArray F L sh a -> Int -> IO a Source #

Shape sh => Regular F L sh a Source # 

Associated Types

data UArray F L sh a :: * Source #

Methods

extent :: UArray F L sh a -> sh Source #

touchArray :: UArray F L sh a -> IO () Source #

force :: UArray F L sh a -> IO () Source #

DefaultFusion F D L sh Source # 

Methods

dmap :: (USource F L sh a, USource D L sh b) => (a -> b) -> UArray F L sh a -> UArray D L sh b Source #

dmapM :: (USource F L sh a, USource D L sh b) => (a -> IO b) -> UArray F L sh a -> UArray D L sh b Source #

dzip2 :: (USource F L sh a, USource F L sh b, USource D L sh c) => (a -> b -> c) -> UArray F L sh a -> UArray F L sh b -> UArray D L sh c Source #

dzip2M :: (USource F L sh a, USource F L sh b, USource D L sh c) => (a -> b -> IO c) -> UArray F L sh a -> UArray F L sh b -> UArray D L sh c Source #

dzip3 :: (USource F L sh a, USource F L sh b, USource F L sh c, USource D L sh d) => (a -> b -> c -> d) -> UArray F L sh a -> UArray F L sh b -> UArray F L sh c -> UArray D L sh d Source #

dzip3M :: (USource F L sh a, USource F L sh b, USource F L sh c, USource D L sh d) => (a -> b -> c -> IO d) -> UArray F L sh a -> UArray F L sh b -> UArray F L sh c -> UArray D L sh d Source #

dzip :: (USource F L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray F L sh a) -> UArray D L sh b Source #

dzipM :: (USource F L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray F L sh a) -> UArray D L sh b Source #

(Shape sh, Storable a) => Manifest F F L sh a Source # 

Methods

new :: sh -> IO (UArray F L sh a) Source #

freeze :: UArray F L sh a -> IO (UArray F L sh a) Source #

thaw :: UArray F L sh a -> IO (UArray F L sh a) Source #

Shape sh => DefaultIFusion F L D SH sh Source # 

Methods

imap :: (USource F L sh a, USource D SH sh b) => (sh -> a -> b) -> UArray F L sh a -> UArray D SH sh b Source #

imapM :: (USource F L sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray F L sh a -> UArray D SH sh b Source #

izip2 :: (USource F L sh a, USource F L sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray F L sh a -> UArray F L sh b -> UArray D SH sh c Source #

izip2M :: (USource F L sh a, USource F L sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray F L sh a -> UArray F L sh b -> UArray D SH sh c Source #

izip3 :: (USource F L sh a, USource F L sh b, USource F L sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray F L sh a -> UArray F L sh b -> UArray F L sh c -> UArray D SH sh d Source #

izip3M :: (USource F L sh a, USource F L sh b, USource F L sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray F L sh a -> UArray F L sh b -> UArray F L sh c -> UArray D SH sh d Source #

izip :: (USource F L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray F L sh a) -> UArray D SH sh b Source #

izipM :: (USource F L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray F L sh a) -> UArray D SH sh b Source #

(Shape sh, Vector v e, Storable e, Storable (v e)) => UVecTarget F FS L sh v e Source # 
(Shape sh, Vector v e, Storable e, Storable (v e)) => UVecSource F FS L sh v e Source # 
(Shape sh, Vector v e, Storable e, Storable (v e)) => VecRegular F FS L sh v e Source # 

Methods

slices :: UArray F L sh (v e) -> VecList (Dim v) (UArray FS L sh e) Source #

(Shape sh, Vector v e, Storable e) => UVecSource (SE F) F L sh v e Source # 
Shape sh => NFData (UArray F L sh a) Source # 

Methods

rnf :: UArray F L sh a -> () #

data UArray F L Source # 
data UArray F L = ForeignArray !sh !(ForeignPtr a) !(Ptr a)

unsafeFromForeignPtr :: Shape sh => sh -> ForeignPtr a -> IO (UArray F L sh a) Source #

O(1) Wraps foreign ptr into foreign array.

The function is unsafe because it simply don't (and can't) check anything about correctness of produced array.

toForeignPtr :: Shape sh => UArray F L sh a -> ForeignPtr a Source #

O(1) Returns pointer to memory block used by the given foreign array.

May be useful to reuse memory if you don't longer need the given array in the program:

brandNewData <-
   unsafeFromForeignPtr ext (castForeignPtr (toForeignPtr arr))

Delayed

data D Source #

Delayed representation is a wrapper for arbitrary indexing function.

UArray D L sh a instance holds linear getter ((Int -> IO a)), and UArray D SH sh a - shaped, "true" (sh -> IO a) index, respectively.

Delayed arrays are most common recipients for fusion operations.

Instances

Shape sh => USource D SH sh a Source # 

Methods

index :: UArray D SH sh a -> sh -> IO a Source #

linearIndex :: UArray D SH sh a -> Int -> IO a Source #

Shape sh => USource D L sh a Source # 

Methods

index :: UArray D L sh a -> sh -> IO a Source #

linearIndex :: UArray D L sh a -> Int -> IO a Source #

Shape sh => Regular D SH sh a Source # 

Associated Types

data UArray D SH sh a :: * Source #

Methods

extent :: UArray D SH sh a -> sh Source #

touchArray :: UArray D SH sh a -> IO () Source #

force :: UArray D SH sh a -> IO () Source #

Shape sh => Regular D L sh a Source # 

Associated Types

data UArray D L sh a :: * Source #

Methods

extent :: UArray D L sh a -> sh Source #

touchArray :: UArray D L sh a -> IO () Source #

force :: UArray D L sh a -> IO () Source #

Shape sh => DefaultFusion D D SH sh Source # 

Methods

dmap :: (USource D SH sh a, USource D SH sh b) => (a -> b) -> UArray D SH sh a -> UArray D SH sh b Source #

dmapM :: (USource D SH sh a, USource D SH sh b) => (a -> IO b) -> UArray D SH sh a -> UArray D SH sh b Source #

dzip2 :: (USource D SH sh a, USource D SH sh b, USource D SH sh c) => (a -> b -> c) -> UArray D SH sh a -> UArray D SH sh b -> UArray D SH sh c Source #

dzip2M :: (USource D SH sh a, USource D SH sh b, USource D SH sh c) => (a -> b -> IO c) -> UArray D SH sh a -> UArray D SH sh b -> UArray D SH sh c Source #

dzip3 :: (USource D SH sh a, USource D SH sh b, USource D SH sh c, USource D SH sh d) => (a -> b -> c -> d) -> UArray D SH sh a -> UArray D SH sh b -> UArray D SH sh c -> UArray D SH sh d Source #

dzip3M :: (USource D SH sh a, USource D SH sh b, USource D SH sh c, USource D SH sh d) => (a -> b -> c -> IO d) -> UArray D SH sh a -> UArray D SH sh b -> UArray D SH sh c -> UArray D SH sh d Source #

dzip :: (USource D SH sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray D SH sh a) -> UArray D SH sh b Source #

dzipM :: (USource D SH sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray D SH sh a) -> UArray D SH sh b Source #

DefaultFusion D D L sh Source # 

Methods

dmap :: (USource D L sh a, USource D L sh b) => (a -> b) -> UArray D L sh a -> UArray D L sh b Source #

dmapM :: (USource D L sh a, USource D L sh b) => (a -> IO b) -> UArray D L sh a -> UArray D L sh b Source #

dzip2 :: (USource D L sh a, USource D L sh b, USource D L sh c) => (a -> b -> c) -> UArray D L sh a -> UArray D L sh b -> UArray D L sh c Source #

dzip2M :: (USource D L sh a, USource D L sh b, USource D L sh c) => (a -> b -> IO c) -> UArray D L sh a -> UArray D L sh b -> UArray D L sh c Source #

dzip3 :: (USource D L sh a, USource D L sh b, USource D L sh c, USource D L sh d) => (a -> b -> c -> d) -> UArray D L sh a -> UArray D L sh b -> UArray D L sh c -> UArray D L sh d Source #

dzip3M :: (USource D L sh a, USource D L sh b, USource D L sh c, USource D L sh d) => (a -> b -> c -> IO d) -> UArray D L sh a -> UArray D L sh b -> UArray D L sh c -> UArray D L sh d Source #

dzip :: (USource D L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray D L sh a) -> UArray D L sh b Source #

dzipM :: (USource D L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray D L sh a) -> UArray D L sh b Source #

DefaultFusion FS D L sh Source # 

Methods

dmap :: (USource FS L sh a, USource D L sh b) => (a -> b) -> UArray FS L sh a -> UArray D L sh b Source #

dmapM :: (USource FS L sh a, USource D L sh b) => (a -> IO b) -> UArray FS L sh a -> UArray D L sh b Source #

dzip2 :: (USource FS L sh a, USource FS L sh b, USource D L sh c) => (a -> b -> c) -> UArray FS L sh a -> UArray FS L sh b -> UArray D L sh c Source #

dzip2M :: (USource FS L sh a, USource FS L sh b, USource D L sh c) => (a -> b -> IO c) -> UArray FS L sh a -> UArray FS L sh b -> UArray D L sh c Source #

dzip3 :: (USource FS L sh a, USource FS L sh b, USource FS L sh c, USource D L sh d) => (a -> b -> c -> d) -> UArray FS L sh a -> UArray FS L sh b -> UArray FS L sh c -> UArray D L sh d Source #

dzip3M :: (USource FS L sh a, USource FS L sh b, USource FS L sh c, USource D L sh d) => (a -> b -> c -> IO d) -> UArray FS L sh a -> UArray FS L sh b -> UArray FS L sh c -> UArray D L sh d Source #

dzip :: (USource FS L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray FS L sh a) -> UArray D L sh b Source #

dzipM :: (USource FS L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray FS L sh a) -> UArray D L sh b Source #

DefaultFusion F D L sh Source # 

Methods

dmap :: (USource F L sh a, USource D L sh b) => (a -> b) -> UArray F L sh a -> UArray D L sh b Source #

dmapM :: (USource F L sh a, USource D L sh b) => (a -> IO b) -> UArray F L sh a -> UArray D L sh b Source #

dzip2 :: (USource F L sh a, USource F L sh b, USource D L sh c) => (a -> b -> c) -> UArray F L sh a -> UArray F L sh b -> UArray D L sh c Source #

dzip2M :: (USource F L sh a, USource F L sh b, USource D L sh c) => (a -> b -> IO c) -> UArray F L sh a -> UArray F L sh b -> UArray D L sh c Source #

dzip3 :: (USource F L sh a, USource F L sh b, USource F L sh c, USource D L sh d) => (a -> b -> c -> d) -> UArray F L sh a -> UArray F L sh b -> UArray F L sh c -> UArray D L sh d Source #

dzip3M :: (USource F L sh a, USource F L sh b, USource F L sh c, USource D L sh d) => (a -> b -> c -> IO d) -> UArray F L sh a -> UArray F L sh b -> UArray F L sh c -> UArray D L sh d Source #

dzip :: (USource F L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray F L sh a) -> UArray D L sh b Source #

dzipM :: (USource F L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray F L sh a) -> UArray D L sh b Source #

DefaultFusion MB D L sh Source # 

Methods

dmap :: (USource MB L sh a, USource D L sh b) => (a -> b) -> UArray MB L sh a -> UArray D L sh b Source #

dmapM :: (USource MB L sh a, USource D L sh b) => (a -> IO b) -> UArray MB L sh a -> UArray D L sh b Source #

dzip2 :: (USource MB L sh a, USource MB L sh b, USource D L sh c) => (a -> b -> c) -> UArray MB L sh a -> UArray MB L sh b -> UArray D L sh c Source #

dzip2M :: (USource MB L sh a, USource MB L sh b, USource D L sh c) => (a -> b -> IO c) -> UArray MB L sh a -> UArray MB L sh b -> UArray D L sh c Source #

dzip3 :: (USource MB L sh a, USource MB L sh b, USource MB L sh c, USource D L sh d) => (a -> b -> c -> d) -> UArray MB L sh a -> UArray MB L sh b -> UArray MB L sh c -> UArray D L sh d Source #

dzip3M :: (USource MB L sh a, USource MB L sh b, USource MB L sh c, USource D L sh d) => (a -> b -> c -> IO d) -> UArray MB L sh a -> UArray MB L sh b -> UArray MB L sh c -> UArray D L sh d Source #

dzip :: (USource MB L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray MB L sh a) -> UArray D L sh b Source #

dzipM :: (USource MB L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray MB L sh a) -> UArray D L sh b Source #

DefaultFusion B D L sh Source # 

Methods

dmap :: (USource B L sh a, USource D L sh b) => (a -> b) -> UArray B L sh a -> UArray D L sh b Source #

dmapM :: (USource B L sh a, USource D L sh b) => (a -> IO b) -> UArray B L sh a -> UArray D L sh b Source #

dzip2 :: (USource B L sh a, USource B L sh b, USource D L sh c) => (a -> b -> c) -> UArray B L sh a -> UArray B L sh b -> UArray D L sh c Source #

dzip2M :: (USource B L sh a, USource B L sh b, USource D L sh c) => (a -> b -> IO c) -> UArray B L sh a -> UArray B L sh b -> UArray D L sh c Source #

dzip3 :: (USource B L sh a, USource B L sh b, USource B L sh c, USource D L sh d) => (a -> b -> c -> d) -> UArray B L sh a -> UArray B L sh b -> UArray B L sh c -> UArray D L sh d Source #

dzip3M :: (USource B L sh a, USource B L sh b, USource B L sh c, USource D L sh d) => (a -> b -> c -> IO d) -> UArray B L sh a -> UArray B L sh b -> UArray B L sh c -> UArray D L sh d Source #

dzip :: (USource B L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray B L sh a) -> UArray D L sh b Source #

dzipM :: (USource B L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray B L sh a) -> UArray D L sh b Source #

Fusion r D L sh Source # 

Methods

fmap :: (USource r L sh a, USource D L sh b) => (a -> b) -> UArray r L sh a -> UArray D L sh b Source #

fmapM :: (USource r L sh a, USource D L sh b) => (a -> IO b) -> UArray r L sh a -> UArray D L sh b Source #

fzip2 :: (USource r L sh a, USource r L sh b, USource D L sh c) => (a -> b -> c) -> UArray r L sh a -> UArray r L sh b -> UArray D L sh c Source #

fzip2M :: (USource r L sh a, USource r L sh b, USource D L sh c) => (a -> b -> IO c) -> UArray r L sh a -> UArray r L sh b -> UArray D L sh c Source #

fzip3 :: (USource r L sh a, USource r L sh b, USource r L sh c, USource D L sh d) => (a -> b -> c -> d) -> UArray r L sh a -> UArray r L sh b -> UArray r L sh c -> UArray D L sh d Source #

fzip3M :: (USource r L sh a, USource r L sh b, USource r L sh c, USource D L sh d) => (a -> b -> c -> IO d) -> UArray r L sh a -> UArray r L sh b -> UArray r L sh c -> UArray D L sh d Source #

fzip :: (USource r L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray r L sh a) -> UArray D L sh b Source #

fzipM :: (USource r L sh a, USource D L sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray r L sh a) -> UArray D L sh b Source #

Shape sh => DefaultIFusion D SH D SH sh Source # 

Methods

imap :: (USource D SH sh a, USource D SH sh b) => (sh -> a -> b) -> UArray D SH sh a -> UArray D SH sh b Source #

imapM :: (USource D SH sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray D SH sh a -> UArray D SH sh b Source #

izip2 :: (USource D SH sh a, USource D SH sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray D SH sh a -> UArray D SH sh b -> UArray D SH sh c Source #

izip2M :: (USource D SH sh a, USource D SH sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray D SH sh a -> UArray D SH sh b -> UArray D SH sh c Source #

izip3 :: (USource D SH sh a, USource D SH sh b, USource D SH sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray D SH sh a -> UArray D SH sh b -> UArray D SH sh c -> UArray D SH sh d Source #

izip3M :: (USource D SH sh a, USource D SH sh b, USource D SH sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray D SH sh a -> UArray D SH sh b -> UArray D SH sh c -> UArray D SH sh d Source #

izip :: (USource D SH sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray D SH sh a) -> UArray D SH sh b Source #

izipM :: (USource D SH sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray D SH sh a) -> UArray D SH sh b Source #

Shape sh => DefaultIFusion D L D SH sh Source # 

Methods

imap :: (USource D L sh a, USource D SH sh b) => (sh -> a -> b) -> UArray D L sh a -> UArray D SH sh b Source #

imapM :: (USource D L sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray D L sh a -> UArray D SH sh b Source #

izip2 :: (USource D L sh a, USource D L sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray D L sh a -> UArray D L sh b -> UArray D SH sh c Source #

izip2M :: (USource D L sh a, USource D L sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray D L sh a -> UArray D L sh b -> UArray D SH sh c Source #

izip3 :: (USource D L sh a, USource D L sh b, USource D L sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray D L sh a -> UArray D L sh b -> UArray D L sh c -> UArray D SH sh d Source #

izip3M :: (USource D L sh a, USource D L sh b, USource D L sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray D L sh a -> UArray D L sh b -> UArray D L sh c -> UArray D SH sh d Source #

izip :: (USource D L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray D L sh a) -> UArray D SH sh b Source #

izipM :: (USource D L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray D L sh a) -> UArray D SH sh b Source #

Shape sh => DefaultIFusion FS L D SH sh Source # 

Methods

imap :: (USource FS L sh a, USource D SH sh b) => (sh -> a -> b) -> UArray FS L sh a -> UArray D SH sh b Source #

imapM :: (USource FS L sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray FS L sh a -> UArray D SH sh b Source #

izip2 :: (USource FS L sh a, USource FS L sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray FS L sh a -> UArray FS L sh b -> UArray D SH sh c Source #

izip2M :: (USource FS L sh a, USource FS L sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray FS L sh a -> UArray FS L sh b -> UArray D SH sh c Source #

izip3 :: (USource FS L sh a, USource FS L sh b, USource FS L sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray FS L sh a -> UArray FS L sh b -> UArray FS L sh c -> UArray D SH sh d Source #

izip3M :: (USource FS L sh a, USource FS L sh b, USource FS L sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray FS L sh a -> UArray FS L sh b -> UArray FS L sh c -> UArray D SH sh d Source #

izip :: (USource FS L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray FS L sh a) -> UArray D SH sh b Source #

izipM :: (USource FS L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray FS L sh a) -> UArray D SH sh b Source #

Shape sh => DefaultIFusion F L D SH sh Source # 

Methods

imap :: (USource F L sh a, USource D SH sh b) => (sh -> a -> b) -> UArray F L sh a -> UArray D SH sh b Source #

imapM :: (USource F L sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray F L sh a -> UArray D SH sh b Source #

izip2 :: (USource F L sh a, USource F L sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray F L sh a -> UArray F L sh b -> UArray D SH sh c Source #

izip2M :: (USource F L sh a, USource F L sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray F L sh a -> UArray F L sh b -> UArray D SH sh c Source #

izip3 :: (USource F L sh a, USource F L sh b, USource F L sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray F L sh a -> UArray F L sh b -> UArray F L sh c -> UArray D SH sh d Source #

izip3M :: (USource F L sh a, USource F L sh b, USource F L sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray F L sh a -> UArray F L sh b -> UArray F L sh c -> UArray D SH sh d Source #

izip :: (USource F L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray F L sh a) -> UArray D SH sh b Source #

izipM :: (USource F L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray F L sh a) -> UArray D SH sh b Source #

Shape sh => DefaultIFusion MB L D SH sh Source # 

Methods

imap :: (USource MB L sh a, USource D SH sh b) => (sh -> a -> b) -> UArray MB L sh a -> UArray D SH sh b Source #

imapM :: (USource MB L sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray MB L sh a -> UArray D SH sh b Source #

izip2 :: (USource MB L sh a, USource MB L sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray MB L sh a -> UArray MB L sh b -> UArray D SH sh c Source #

izip2M :: (USource MB L sh a, USource MB L sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray MB L sh a -> UArray MB L sh b -> UArray D SH sh c Source #

izip3 :: (USource MB L sh a, USource MB L sh b, USource MB L sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray MB L sh a -> UArray MB L sh b -> UArray MB L sh c -> UArray D SH sh d Source #

izip3M :: (USource MB L sh a, USource MB L sh b, USource MB L sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray MB L sh a -> UArray MB L sh b -> UArray MB L sh c -> UArray D SH sh d Source #

izip :: (USource MB L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray MB L sh a) -> UArray D SH sh b Source #

izipM :: (USource MB L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray MB L sh a) -> UArray D SH sh b Source #

Shape sh => DefaultIFusion B L D SH sh Source # 

Methods

imap :: (USource B L sh a, USource D SH sh b) => (sh -> a -> b) -> UArray B L sh a -> UArray D SH sh b Source #

imapM :: (USource B L sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray B L sh a -> UArray D SH sh b Source #

izip2 :: (USource B L sh a, USource B L sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray B L sh a -> UArray B L sh b -> UArray D SH sh c Source #

izip2M :: (USource B L sh a, USource B L sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray B L sh a -> UArray B L sh b -> UArray D SH sh c Source #

izip3 :: (USource B L sh a, USource B L sh b, USource B L sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray B L sh a -> UArray B L sh b -> UArray B L sh c -> UArray D SH sh d Source #

izip3M :: (USource B L sh a, USource B L sh b, USource B L sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray B L sh a -> UArray B L sh b -> UArray B L sh c -> UArray D SH sh d Source #

izip :: (USource B L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray B L sh a) -> UArray D SH sh b Source #

izipM :: (USource B L sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray B L sh a) -> UArray D SH sh b Source #

Shape sh => IFusion r l D SH sh Source # 

Methods

fimap :: (USource r l sh a, USource D SH sh b) => (sh -> a -> b) -> UArray r l sh a -> UArray D SH sh b Source #

fimapM :: (USource r l sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray r l sh a -> UArray D SH sh b Source #

fizip2 :: (USource r l sh a, USource r l sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray r l sh a -> UArray r l sh b -> UArray D SH sh c Source #

fizip2M :: (USource r l sh a, USource r l sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray r l sh a -> UArray r l sh b -> UArray D SH sh c Source #

fizip3 :: (USource r l sh a, USource r l sh b, USource r l sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray r l sh a -> UArray r l sh b -> UArray r l sh c -> UArray D SH sh d Source #

fizip3M :: (USource r l sh a, USource r l sh b, USource r l sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray r l sh a -> UArray r l sh b -> UArray r l sh c -> UArray D SH sh d Source #

fizip :: (USource r l sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray r l sh a) -> UArray D SH sh b Source #

fizipM :: (USource r l sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray r l sh a) -> UArray D SH sh b Source #

(Shape sh, Vector v e) => UVecSource D D SH sh v e Source # 
(Shape sh, Vector v e) => UVecSource D D L sh v e Source # 
(Shape sh, Vector v e) => VecRegular D D SH sh v e Source # 

Methods

slices :: UArray D SH sh (v e) -> VecList (Dim v) (UArray D SH sh e) Source #

(Shape sh, Vector v e) => VecRegular D D L sh v e Source # 

Methods

slices :: UArray D L sh (v e) -> VecList (Dim v) (UArray D L sh e) Source #

(DefaultFusion r D l sh, Fusion (SE r) D l sh) => DefaultFusion (SE r) D l sh Source # 

Methods

dmap :: (USource (SE r) l sh a, USource D l sh b) => (a -> b) -> UArray (SE r) l sh a -> UArray D l sh b Source #

dmapM :: (USource (SE r) l sh a, USource D l sh b) => (a -> IO b) -> UArray (SE r) l sh a -> UArray D l sh b Source #

dzip2 :: (USource (SE r) l sh a, USource (SE r) l sh b, USource D l sh c) => (a -> b -> c) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray D l sh c Source #

dzip2M :: (USource (SE r) l sh a, USource (SE r) l sh b, USource D l sh c) => (a -> b -> IO c) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray D l sh c Source #

dzip3 :: (USource (SE r) l sh a, USource (SE r) l sh b, USource (SE r) l sh c, USource D l sh d) => (a -> b -> c -> d) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray (SE r) l sh c -> UArray D l sh d Source #

dzip3M :: (USource (SE r) l sh a, USource (SE r) l sh b, USource (SE r) l sh c, USource D l sh d) => (a -> b -> c -> IO d) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray (SE r) l sh c -> UArray D l sh d Source #

dzip :: (USource (SE r) l sh a, USource D l sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray (SE r) l sh a) -> UArray D l sh b Source #

dzipM :: (USource (SE r) l sh a, USource D l sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray (SE r) l sh a) -> UArray D l sh b Source #

(DefaultIFusion r l D SH sh, IFusion (SE r) l D SH sh) => DefaultIFusion (SE r) l D SH sh Source # 

Methods

imap :: (USource (SE r) l sh a, USource D SH sh b) => (sh -> a -> b) -> UArray (SE r) l sh a -> UArray D SH sh b Source #

imapM :: (USource (SE r) l sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray (SE r) l sh a -> UArray D SH sh b Source #

izip2 :: (USource (SE r) l sh a, USource (SE r) l sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray D SH sh c Source #

izip2M :: (USource (SE r) l sh a, USource (SE r) l sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray D SH sh c Source #

izip3 :: (USource (SE r) l sh a, USource (SE r) l sh b, USource (SE r) l sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray (SE r) l sh c -> UArray D SH sh d Source #

izip3M :: (USource (SE r) l sh a, USource (SE r) l sh b, USource (SE r) l sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray (SE r) l sh c -> UArray D SH sh d Source #

izip :: (USource (SE r) l sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray (SE r) l sh a) -> UArray D SH sh b Source #

izipM :: (USource (SE r) l sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray (SE r) l sh a) -> UArray D SH sh b Source #

Shape sh => NFData (UArray D SH sh a) Source # 

Methods

rnf :: UArray D SH sh a -> () #

Shape sh => NFData (UArray D L sh a) Source # 

Methods

rnf :: UArray D L sh a -> () #

data UArray D SH Source # 
data UArray D SH = ShapeDelayed !sh (IO ()) (IO ()) (sh -> IO a)
data UArray D L Source # 
data UArray D L = LinearDelayed !sh (IO ()) (IO ()) (Int -> IO a)

fromFunction Source #

Arguments

:: Shape sh 
=> sh

Extent of array

-> (sh -> IO a)

Indexing function

-> UArray D SH sh a

Result array

Wrap indexing function into delayed representation.

Use this function carefully, don't implement through it something that has specialized implementation in the library (mapping, zipping, etc).

Suitable to obtain arrays of constant element, of indices (fromFunction sh return), and so on.

delay :: (USource r l sh a, USource D l sh a, Fusion r D l sh) => UArray r l sh a -> UArray D l sh a Source #

Load type preserving wrapping arbirtary array into Delayed representation.

Separate

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 Source # 

Methods

dmap :: (USource (SE r) l sh a, USource D l sh b) => (a -> b) -> UArray (SE r) l sh a -> UArray D l sh b Source #

dmapM :: (USource (SE r) l sh a, USource D l sh b) => (a -> IO b) -> UArray (SE r) l sh a -> UArray D l sh b Source #

dzip2 :: (USource (SE r) l sh a, USource (SE r) l sh b, USource D l sh c) => (a -> b -> c) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray D l sh c Source #

dzip2M :: (USource (SE r) l sh a, USource (SE r) l sh b, USource D l sh c) => (a -> b -> IO c) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray D l sh c Source #

dzip3 :: (USource (SE r) l sh a, USource (SE r) l sh b, USource (SE r) l sh c, USource D l sh d) => (a -> b -> c -> d) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray (SE r) l sh c -> UArray D l sh d Source #

dzip3M :: (USource (SE r) l sh a, USource (SE r) l sh b, USource (SE r) l sh c, USource D l sh d) => (a -> b -> c -> IO d) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray (SE r) l sh c -> UArray D l sh d Source #

dzip :: (USource (SE r) l sh a, USource D l sh b, Arity n, (* ~ n) (S n0)) => Fun n a b -> VecList n (UArray (SE r) l sh a) -> UArray D l sh b Source #

dzipM :: (USource (SE r) l sh a, USource D l sh b, Arity n, (* ~ n) (S n0)) => Fun n a (IO b) -> VecList n (UArray (SE r) l sh a) -> UArray D l sh b Source #

(DefaultIFusion r l D SH sh, IFusion (SE r) l D SH sh) => DefaultIFusion (SE r) l D SH sh Source # 

Methods

imap :: (USource (SE r) l sh a, USource D SH sh b) => (sh -> a -> b) -> UArray (SE r) l sh a -> UArray D SH sh b Source #

imapM :: (USource (SE r) l sh a, USource D SH sh b) => (sh -> a -> IO b) -> UArray (SE r) l sh a -> UArray D SH sh b Source #

izip2 :: (USource (SE r) l sh a, USource (SE r) l sh b, USource D SH sh c) => (sh -> a -> b -> c) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray D SH sh c Source #

izip2M :: (USource (SE r) l sh a, USource (SE r) l sh b, USource D SH sh c) => (sh -> a -> b -> IO c) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray D SH sh c Source #

izip3 :: (USource (SE r) l sh a, USource (SE r) l sh b, USource (SE r) l sh c, USource D SH sh d) => (sh -> a -> b -> c -> d) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray (SE r) l sh c -> UArray D SH sh d Source #

izip3M :: (USource (SE r) l sh a, USource (SE r) l sh b, USource (SE r) l sh c, USource D SH sh d) => (sh -> a -> b -> c -> IO d) -> UArray (SE r) l sh a -> UArray (SE r) l sh b -> UArray (SE r) l sh c -> UArray D SH sh d Source #

izip :: (USource (SE r) l sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a b) -> VecList n (UArray (SE r) l sh a) -> UArray D SH sh b Source #

izipM :: (USource (SE r) l sh a, USource D SH sh b, Arity n, (* ~ n) (S n0)) => (sh -> Fun n a (IO b)) -> VecList n (UArray (SE r) l sh a) -> UArray D SH sh b Source #

(UTarget tr tl sh e, Vector v e) => UVecTarget (SE tr) tr tl sh v e Source # 
(USource r l sh e, Vector v e) => UVecSource (SE r) r l sh v e Source # 
(Shape sh, Vector v e, Storable e) => UVecSource (SE F) F L sh v e Source # 
(Shape sh, Vector v e, NFData e) => UVecSource (SE MB) MB L sh v e Source # 
(Shape sh, Vector v e, NFData e) => UVecSource (SE B) B L sh v e Source # 
(Regular r l sh e, Shape sh, Vector v e) => VecRegular (SE r) r l sh v e Source # 

Methods

slices :: UArray (SE r) l sh (v e) -> VecList (Dim v) (UArray r l sh e) Source #

(UTarget tr tl sh e, Vector v e) => UTarget (SE tr) tl sh (v e) Source # 

Methods

write :: UArray (SE tr) tl sh (v e) -> sh -> v e -> IO () Source #

linearWrite :: UArray (SE tr) tl sh (v e) -> Int -> v e -> IO () Source #

(USource r l sh e, Vector v e) => USource (SE r) l sh (v e) Source # 

Methods

index :: UArray (SE r) l sh (v e) -> sh -> IO (v e) Source #

linearIndex :: UArray (SE r) l sh (v e) -> Int -> IO (v e) Source #

(Regular r l sh e, Vector v e) => Regular (SE r) l sh (v e) Source # 

Associated Types

data UArray (SE r) l sh (v e) :: * Source #

Methods

extent :: UArray (SE r) l sh (v e) -> sh Source #

touchArray :: UArray (SE r) l sh (v e) -> IO () Source #

force :: UArray (SE r) l sh (v e) -> IO () Source #

(Manifest r mr l sh e, Vector v e) => Manifest (SE r) (SE mr) l sh (v e) Source # 

Methods

new :: sh -> IO (UArray (SE mr) l sh (v e)) Source #

freeze :: UArray (SE mr) l sh (v e) -> IO (UArray (SE r) l sh (v e)) Source #

thaw :: UArray (SE r) l sh (v e) -> IO (UArray (SE mr) l sh (v e)) Source #

(NFData (UArray r l sh e), Shape sh, Vector v e) => NFData (UArray (SE r) l sh (v e)) Source # 

Methods

rnf :: UArray (SE r) l sh (v e) -> () #

data UArray (SE r) l sh (v e) Source # 
data UArray (SE r) l sh (v e) = Separate !sh (VecList (Dim v) (UArray r l sh e))

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)

unsafeMapSlices Source #

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).