yarr-1.4.0.2: Yet another array library

Safe HaskellNone
LanguageHaskell98

Data.Yarr.Base

Contents

Description

Core type system

Synopsis

General Regular classes

class (NFData (UArray r l sh a), Shape sh) => Regular r l sh a where Source #

This class generalizes USource and UTarget.

Paramenters:

  • r - representation,
  • l - load type,
  • sh - shape,
  • a - element type.

Counterpart for arrays of vectors: VecRegular.

Minimal complete definition

extent, touchArray

Associated Types

data UArray r l sh a Source #

Methods

extent :: UArray r l sh a -> sh Source #

Returns the extent an the array.

touchArray :: UArray r l sh a -> IO () Source #

Calling this function on foreign array (F) ensures it is still alive (GC haven't picked it). In other manifest representations, the function defined as return (). touchArray is lifted to top level in class hierarchy because in fact foreign representation is the heart of the library.

force :: UArray r l sh a -> IO () Source #

O(1) Ensures that array and all it's real manifest sources are fully evaluated. This function is not for people, it is for GHC compiler.

Default implementation: force arr = arr `deepseq` return ()

Instances

Shape sh => Regular DT SH sh a Source # 

Associated Types

data UArray DT SH sh a :: * Source #

Methods

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

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

force :: UArray DT SH sh a -> IO () 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 => Regular FS L sh e Source # 

Associated Types

data UArray FS L sh e :: * Source #

Methods

extent :: UArray FS L sh e -> sh Source #

touchArray :: UArray FS L sh e -> IO () Source #

force :: UArray FS L sh e -> IO () 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 #

(Shape sh, NFData a) => Regular MB L sh a Source # 

Associated Types

data UArray MB L sh a :: * Source #

Methods

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

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

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

(Shape sh, NFData a) => Regular B L sh a Source # 

Associated Types

data UArray B L sh a :: * Source #

Methods

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

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

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

Shape sh => Regular CV CVL sh a Source # 

Associated Types

data UArray CV CVL sh a :: * Source #

Methods

extent :: UArray CV CVL sh a -> sh Source #

touchArray :: UArray CV CVL sh a -> IO () Source #

force :: UArray CV CVL sh a -> IO () Source #

Regular r l sh a => Regular (CHK r) l sh a Source # 

Associated Types

data UArray (CHK r) l sh a :: * Source #

Methods

extent :: UArray (CHK r) l sh a -> sh Source #

touchArray :: UArray (CHK r) l sh a -> IO () Source #

force :: UArray (CHK r) l sh a -> IO () 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 #

class (Regular r l sh (v e), Regular slr l sh e, Vector v e) => VecRegular r slr l sh v e | r -> slr where Source #

Class for arrays of vectors.

Paramenters:

  • r - (entire) representation. Associated array type for this class is UArray r sh (v e).
  • slr - slice representation
  • l - load type
  • sh - shape
  • v - vector type
  • e - vector (not array) element type. Array element type is entire vector: (v e).

Counterpart for "simple" arrays: Regular.

Minimal complete definition

slices

Methods

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

O(1) Array of vectors -> vector of arrays. Think about this function as shallow unzip from Prelude. Slices are views of an underlying array.

Example:

let css = slices coords
    xs = css ! 0
    ys = css ! 1

Instances

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

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

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

VecRegular r slr l sh v e => VecRegular (CHK r) (CHK slr) l sh v e Source # 

Methods

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

class NFData a where #

A class of types that can be fully evaluated.

Since: 1.1.0.0

Minimal complete definition

Nothing

Instances

NFData Bool 

Methods

rnf :: Bool -> () #

NFData Char 

Methods

rnf :: Char -> () #

NFData Double 

Methods

rnf :: Double -> () #

NFData Float 

Methods

rnf :: Float -> () #

NFData Int 

Methods

rnf :: Int -> () #

NFData Int8 

Methods

rnf :: Int8 -> () #

NFData Int16 

Methods

rnf :: Int16 -> () #

NFData Int32 

Methods

rnf :: Int32 -> () #

NFData Int64 

Methods

rnf :: Int64 -> () #

NFData Integer 

Methods

rnf :: Integer -> () #

NFData Word 

Methods

rnf :: Word -> () #

NFData Word8 

Methods

rnf :: Word8 -> () #

NFData Word16 

Methods

rnf :: Word16 -> () #

NFData Word32 

Methods

rnf :: Word32 -> () #

NFData Word64 

Methods

rnf :: Word64 -> () #

NFData CallStack

Since: 1.4.2.0

Methods

rnf :: CallStack -> () #

NFData TypeRep

NOTE: Only defined for base-4.8.0.0 and later

Since: 1.4.0.0

Methods

rnf :: TypeRep -> () #

NFData () 

Methods

rnf :: () -> () #

NFData TyCon

NOTE: Only defined for base-4.8.0.0 and later

Since: 1.4.0.0

Methods

rnf :: TyCon -> () #

NFData Natural

Since: 1.4.0.0

Methods

rnf :: Natural -> () #

NFData Void

Defined as rnf = absurd.

Since: 1.4.0.0

Methods

rnf :: Void -> () #

NFData Version

Since: 1.3.0.0

Methods

rnf :: Version -> () #

NFData Unique

Since: 1.4.0.0

Methods

rnf :: Unique -> () #

NFData ThreadId

Since: 1.4.0.0

Methods

rnf :: ThreadId -> () #

NFData ExitCode

Since: 1.4.2.0

Methods

rnf :: ExitCode -> () #

NFData CChar

Since: 1.4.0.0

Methods

rnf :: CChar -> () #

NFData CSChar

Since: 1.4.0.0

Methods

rnf :: CSChar -> () #

NFData CUChar

Since: 1.4.0.0

Methods

rnf :: CUChar -> () #

NFData CShort

Since: 1.4.0.0

Methods

rnf :: CShort -> () #

NFData CUShort

Since: 1.4.0.0

Methods

rnf :: CUShort -> () #

NFData CInt

Since: 1.4.0.0

Methods

rnf :: CInt -> () #

NFData CUInt

Since: 1.4.0.0

Methods

rnf :: CUInt -> () #

NFData CLong

Since: 1.4.0.0

Methods

rnf :: CLong -> () #

NFData CULong

Since: 1.4.0.0

Methods

rnf :: CULong -> () #

NFData CLLong

Since: 1.4.0.0

Methods

rnf :: CLLong -> () #

NFData CULLong

Since: 1.4.0.0

Methods

rnf :: CULLong -> () #

NFData CFloat

Since: 1.4.0.0

Methods

rnf :: CFloat -> () #

NFData CDouble

Since: 1.4.0.0

Methods

rnf :: CDouble -> () #

NFData CPtrdiff

Since: 1.4.0.0

Methods

rnf :: CPtrdiff -> () #

NFData CSize

Since: 1.4.0.0

Methods

rnf :: CSize -> () #

NFData CWchar

Since: 1.4.0.0

Methods

rnf :: CWchar -> () #

NFData CSigAtomic

Since: 1.4.0.0

Methods

rnf :: CSigAtomic -> () #

NFData CClock

Since: 1.4.0.0

Methods

rnf :: CClock -> () #

NFData CTime

Since: 1.4.0.0

Methods

rnf :: CTime -> () #

NFData CUSeconds

Since: 1.4.0.0

Methods

rnf :: CUSeconds -> () #

NFData CSUSeconds

Since: 1.4.0.0

Methods

rnf :: CSUSeconds -> () #

NFData CFile

Since: 1.4.0.0

Methods

rnf :: CFile -> () #

NFData CFpos

Since: 1.4.0.0

Methods

rnf :: CFpos -> () #

NFData CJmpBuf

Since: 1.4.0.0

Methods

rnf :: CJmpBuf -> () #

NFData CIntPtr

Since: 1.4.0.0

Methods

rnf :: CIntPtr -> () #

NFData CUIntPtr

Since: 1.4.0.0

Methods

rnf :: CUIntPtr -> () #

NFData CIntMax

Since: 1.4.0.0

Methods

rnf :: CIntMax -> () #

NFData CUIntMax

Since: 1.4.0.0

Methods

rnf :: CUIntMax -> () #

NFData All

Since: 1.4.0.0

Methods

rnf :: All -> () #

NFData Any

Since: 1.4.0.0

Methods

rnf :: Any -> () #

NFData Fingerprint

Since: 1.4.0.0

Methods

rnf :: Fingerprint -> () #

NFData SrcLoc

Since: 1.4.2.0

Methods

rnf :: SrcLoc -> () #

NFData Doc 

Methods

rnf :: Doc -> () #

NFData TextDetails 

Methods

rnf :: TextDetails -> () #

NFData a => NFData [a] 

Methods

rnf :: [a] -> () #

NFData a => NFData (Maybe a) 

Methods

rnf :: Maybe a -> () #

NFData a => NFData (Ratio a) 

Methods

rnf :: Ratio a -> () #

NFData (Ptr a)

Since: 1.4.2.0

Methods

rnf :: Ptr a -> () #

NFData (FunPtr a)

Since: 1.4.2.0

Methods

rnf :: FunPtr a -> () #

NFData a => NFData (Identity a)

Since: 1.4.0.0

Methods

rnf :: Identity a -> () #

NFData a => NFData (Min a)

Since: 1.4.2.0

Methods

rnf :: Min a -> () #

NFData a => NFData (Max a)

Since: 1.4.2.0

Methods

rnf :: Max a -> () #

NFData a => NFData (First a)

Since: 1.4.2.0

Methods

rnf :: First a -> () #

NFData a => NFData (Last a)

Since: 1.4.2.0

Methods

rnf :: Last a -> () #

NFData m => NFData (WrappedMonoid m)

Since: 1.4.2.0

Methods

rnf :: WrappedMonoid m -> () #

NFData a => NFData (Option a)

Since: 1.4.2.0

Methods

rnf :: Option a -> () #

NFData a => NFData (NonEmpty a)

Since: 1.4.2.0

Methods

rnf :: NonEmpty a -> () #

NFData (Fixed a)

Since: 1.3.0.0

Methods

rnf :: Fixed a -> () #

NFData a => NFData (Complex a) 

Methods

rnf :: Complex a -> () #

NFData (StableName a)

Since: 1.4.0.0

Methods

rnf :: StableName a -> () #

NFData a => NFData (ZipList a)

Since: 1.4.0.0

Methods

rnf :: ZipList a -> () #

NFData a => NFData (Dual a)

Since: 1.4.0.0

Methods

rnf :: Dual a -> () #

NFData a => NFData (Sum a)

Since: 1.4.0.0

Methods

rnf :: Sum a -> () #

NFData a => NFData (Product a)

Since: 1.4.0.0

Methods

rnf :: Product a -> () #

NFData a => NFData (First a)

Since: 1.4.0.0

Methods

rnf :: First a -> () #

NFData a => NFData (Last a)

Since: 1.4.0.0

Methods

rnf :: Last a -> () #

NFData (IORef a)

NOTE: Only strict in the reference and not the referenced value.

Since: 1.4.2.0

Methods

rnf :: IORef a -> () #

NFData a => NFData (Down a)

Since: 1.4.0.0

Methods

rnf :: Down a -> () #

NFData (MVar a)

NOTE: Only strict in the reference and not the referenced value.

Since: 1.4.2.0

Methods

rnf :: MVar a -> () #

NFData a => NFData (Only a) 

Methods

rnf :: Only a -> () #

NFData (Empty a) 

Methods

rnf :: Empty a -> () #

NFData a => NFData (Doc a) 

Methods

rnf :: Doc a -> () #

NFData a => NFData (AnnotDetails a) 

Methods

rnf :: AnnotDetails a -> () #

NFData (a -> b)

This instance is for convenience and consistency with seq. This assumes that WHNF is equivalent to NF for functions.

Since: 1.3.0.0

Methods

rnf :: (a -> b) -> () #

(NFData a, NFData b) => NFData (Either a b) 

Methods

rnf :: Either a b -> () #

(NFData a, NFData b) => NFData (a, b) 

Methods

rnf :: (a, b) -> () #

(NFData a, NFData b) => NFData (Array a b) 

Methods

rnf :: Array a b -> () #

(NFData a, NFData b) => NFData (Arg a b)

Since: 1.4.2.0

Methods

rnf :: Arg a b -> () #

NFData (Proxy k a)

Since: 1.4.0.0

Methods

rnf :: Proxy k a -> () #

NFData (STRef s a)

NOTE: Only strict in the reference and not the referenced value.

Since: 1.4.2.0

Methods

rnf :: STRef s a -> () #

(Arity n, NFData a) => NFData (VecList n a) 

Methods

rnf :: VecList n a -> () #

(NFData a, NFData b, NFData c) => NFData (a, b, c) 

Methods

rnf :: (a, b, c) -> () #

NFData a => NFData (Const k a b)

Since: 1.4.0.0

Methods

rnf :: Const k a b -> () #

(NFData a, NFData b, NFData c, NFData d) => NFData (a, b, c, d) 

Methods

rnf :: (a, b, c, d) -> () #

Shape sh => NFData (UArray DT SH sh a) # 

Methods

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

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

Methods

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

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

Methods

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

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

Methods

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

Shape sh => NFData (UArray FS L sh e) # 

Methods

rnf :: UArray FS L sh e -> () #

Shape sh => NFData (UArray F L sh a) # 

Methods

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

NFData (UArray r l sh a) => NFData (UArray (CHK r) l sh a) # 

Methods

rnf :: UArray (CHK r) l sh a -> () #

(Shape sh, NFData a) => NFData (UArray MB L sh a) # 

Methods

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

(Shape sh, NFData a) => NFData (UArray B L sh a) # 

Methods

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

Shape sh => NFData (UArray CV CVL sh a) # 

Methods

rnf :: UArray CV CVL sh a -> () #

(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5) 

Methods

rnf :: (a1, a2, a3, a4, a5) -> () #

(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6) 

Methods

rnf :: (a1, a2, a3, a4, a5, a6) -> () #

(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7) 

Methods

rnf :: (a1, a2, a3, a4, a5, a6, a7) -> () #

(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData (a1, a2, a3, a4, a5, a6, a7, a8) 

Methods

rnf :: (a1, a2, a3, a4, a5, a6, a7, a8) -> () #

(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8, NFData a9) => NFData (a1, a2, a3, a4, a5, a6, a7, a8, a9) 

Methods

rnf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> () #

deepseq :: NFData a => a -> b -> b #

deepseq: fully evaluates the first argument, before returning the second.

The name deepseq is used to illustrate the relationship to seq: where seq is shallow in the sense that it only evaluates the top level of its argument, deepseq traverses the entire data structure evaluating it completely.

deepseq can be useful for forcing pending exceptions, eradicating space leaks, or forcing lazy I/O to happen. It is also useful in conjunction with parallel Strategies (see the parallel package).

There is no guarantee about the ordering of evaluation. The implementation may evaluate the components of the structure in any order or in parallel. To impose an actual order on evaluation, use pseq from Control.Parallel in the parallel package.

Since: 1.1.0.0

Shape class

class (Eq sh, Bounded sh, Show sh, NFData sh) => Shape sh Source #

Class for column-major, regular composite array indices.

Instances

Shape Dim3 Source # 

Methods

zero :: Dim3 Source #

size :: Dim3 -> Int Source #

inc :: Dim3 -> Dim3 Source #

plus :: Dim3 -> Dim3 -> Dim3 Source #

minus :: Dim3 -> Dim3 -> Dim3 Source #

offset :: Dim3 -> Dim3 -> Dim3 Source #

fromLinear :: Dim3 -> Int -> Dim3 Source #

toLinear :: Dim3 -> Dim3 -> Int Source #

intersect :: (Arity n, (* ~ n) (S n0)) => VecList n Dim3 -> Dim3 Source #

complement :: (Arity n, (* ~ n) (S n0)) => VecList n Dim3 -> Dim3 Source #

intersectBlocks :: (Arity n, (* ~ n) (S n0)) => VecList n (Block Dim3) -> Block Dim3 Source #

blockSize :: Block Dim3 -> Int Source #

insideBlock :: Block Dim3 -> Dim3 -> Bool Source #

makeChunkRange :: Int -> Dim3 -> Dim3 -> Int -> Block Dim3 Source #

foldl :: Foldl Dim3 a b Source #

unrolledFoldl :: Arity uf => uf -> (a -> IO ()) -> Foldl Dim3 a b Source #

foldr :: Foldr Dim3 a b Source #

unrolledFoldr :: Arity uf => uf -> (a -> IO ()) -> Foldr Dim3 a b Source #

fill :: Fill Dim3 a Source #

unrolledFill :: Arity uf => uf -> (a -> IO ()) -> Fill Dim3 a Source #

Shape Dim2 Source # 

Methods

zero :: Dim2 Source #

size :: Dim2 -> Int Source #

inc :: Dim2 -> Dim2 Source #

plus :: Dim2 -> Dim2 -> Dim2 Source #

minus :: Dim2 -> Dim2 -> Dim2 Source #

offset :: Dim2 -> Dim2 -> Dim2 Source #

fromLinear :: Dim2 -> Int -> Dim2 Source #

toLinear :: Dim2 -> Dim2 -> Int Source #

intersect :: (Arity n, (* ~ n) (S n0)) => VecList n Dim2 -> Dim2 Source #

complement :: (Arity n, (* ~ n) (S n0)) => VecList n Dim2 -> Dim2 Source #

intersectBlocks :: (Arity n, (* ~ n) (S n0)) => VecList n (Block Dim2) -> Block Dim2 Source #

blockSize :: Block Dim2 -> Int Source #

insideBlock :: Block Dim2 -> Dim2 -> Bool Source #

makeChunkRange :: Int -> Dim2 -> Dim2 -> Int -> Block Dim2 Source #

foldl :: Foldl Dim2 a b Source #

unrolledFoldl :: Arity uf => uf -> (a -> IO ()) -> Foldl Dim2 a b Source #

foldr :: Foldr Dim2 a b Source #

unrolledFoldr :: Arity uf => uf -> (a -> IO ()) -> Foldr Dim2 a b Source #

fill :: Fill Dim2 a Source #

unrolledFill :: Arity uf => uf -> (a -> IO ()) -> Fill Dim2 a Source #

Shape Dim1 Source # 

Methods

zero :: Dim1 Source #

size :: Dim1 -> Int Source #

inc :: Dim1 -> Dim1 Source #

plus :: Dim1 -> Dim1 -> Dim1 Source #

minus :: Dim1 -> Dim1 -> Dim1 Source #

offset :: Dim1 -> Dim1 -> Dim1 Source #

fromLinear :: Dim1 -> Int -> Dim1 Source #

toLinear :: Dim1 -> Dim1 -> Int Source #

intersect :: (Arity n, (* ~ n) (S n0)) => VecList n Dim1 -> Dim1 Source #

complement :: (Arity n, (* ~ n) (S n0)) => VecList n Dim1 -> Dim1 Source #

intersectBlocks :: (Arity n, (* ~ n) (S n0)) => VecList n (Block Dim1) -> Block Dim1 Source #

blockSize :: Block Dim1 -> Int Source #

insideBlock :: Block Dim1 -> Dim1 -> Bool Source #

makeChunkRange :: Int -> Dim1 -> Dim1 -> Int -> Block Dim1 Source #

foldl :: Foldl Dim1 a b Source #

unrolledFoldl :: Arity uf => uf -> (a -> IO ()) -> Foldl Dim1 a b Source #

foldr :: Foldr Dim1 a b Source #

unrolledFoldr :: Arity uf => uf -> (a -> IO ()) -> Foldr Dim1 a b Source #

fill :: Fill Dim1 a Source #

unrolledFill :: Arity uf => uf -> (a -> IO ()) -> Fill Dim1 a Source #

Fixed vector

type family Dim (v :: * -> *) :: * #

Size of vector expressed as type-level natural.

Instances

type Dim Complex 
type Dim Complex = N2
type Dim Only 
type Dim Only = S Z
type Dim Empty 
type Dim Empty = Z
type Dim ((,) a) 
type Dim ((,) a) = N2
type Dim (Proxy *) 
type Dim (Proxy *) = Z
type Dim (VecList n) 
type Dim (VecList n) = n
type Dim (ContVec n) 
type Dim (ContVec n) = n
type Dim (VecTuple N2) # 
type Dim (VecTuple N2) = N2
type Dim (VecTuple N3) # 
type Dim (VecTuple N3) = N3
type Dim (VecTuple N4) # 
type Dim (VecTuple N4) = N4
type Dim (VecTuple N5) # 
type Dim (VecTuple N5) = N5
type Dim (VecTuple N6) # 
type Dim (VecTuple N6) = N6
type Dim (VecTuple N8) # 
type Dim (VecTuple N8) = N8
type Dim (VecTuple N7) # 
type Dim (VecTuple N7) = N7
type Dim ((,,) a b) 
type Dim ((,,) a b) = N3
type Dim ((,,,) a b c) 
type Dim ((,,,) a b c) = N4
type Dim ((,,,,) a b c d) 
type Dim ((,,,,) a b c d) = N5
type Dim ((,,,,,) a b c d e) 
type Dim ((,,,,,) a b c d e) = N6
type Dim ((,,,,,,) a b c d e f) 
type Dim ((,,,,,,) a b c d e f) = S N6

class Arity n #

Type class for handling n-ary functions.

Minimal complete definition

accum, applyFun, applyFunM, arity, reverseF, gunfoldF, witSum

Instances

Arity Z 

Methods

accum :: (forall k. t (S k) -> a -> t k) -> (t Z -> b) -> t Z -> Fn Z a b #

applyFun :: (forall k. t (S k) -> (a, t k)) -> t Z -> Fn Z a b -> (b, t Z) #

applyFunM :: Monad m => (forall k. t (S k) -> m (a, t k)) -> t Z -> m (ContVec Z a, t Z) #

arity :: Z -> Int #

reverseF :: Fun Z a b -> Fun Z a b #

gunfoldF :: Data a => (forall b x. Data b => c (b -> x) -> c x) -> T_gunfold c r a Z -> c r #

witSum :: WitSum Z k a b #

Arity n => Arity (S n) 

Methods

accum :: (forall k. t (S k) -> a -> t k) -> (t Z -> b) -> t (S n) -> Fn (S n) a b #

applyFun :: (forall k. t (S k) -> (a, t k)) -> t (S n) -> Fn (S n) a b -> (b, t Z) #

applyFunM :: Monad m => (forall k. t (S k) -> m (a, t k)) -> t (S n) -> m (ContVec (S n) a, t Z) #

arity :: S n -> Int #

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

gunfoldF :: Data a => (forall b x. Data b => c (b -> x) -> c x) -> T_gunfold c r a (S n) -> c r #

witSum :: WitSum (S n) k a b #

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

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

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 #

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 #

data VecList n a :: * -> * -> * #

Vector based on the lists. Not very useful by itself but is necessary for implementation.

Instances

Arity n => VectorN VecList n a 
Arity n => Functor (VecList n) 

Methods

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

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

Arity n => Applicative (VecList n) 

Methods

pure :: a -> VecList n a #

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

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

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

Arity n => Foldable (VecList n) 

Methods

fold :: Monoid m => VecList n m -> m #

foldMap :: Monoid m => (a -> m) -> VecList n a -> m #

foldr :: (a -> b -> b) -> b -> VecList n a -> b #

foldr' :: (a -> b -> b) -> b -> VecList n a -> b #

foldl :: (b -> a -> b) -> b -> VecList n a -> b #

foldl' :: (b -> a -> b) -> b -> VecList n a -> b #

foldr1 :: (a -> a -> a) -> VecList n a -> a #

foldl1 :: (a -> a -> a) -> VecList n a -> a #

toList :: VecList n a -> [a] #

null :: VecList n a -> Bool #

length :: VecList n a -> Int #

elem :: Eq a => a -> VecList n a -> Bool #

maximum :: Ord a => VecList n a -> a #

minimum :: Ord a => VecList n a -> a #

sum :: Num a => VecList n a -> a #

product :: Num a => VecList n a -> a #

Arity n => Traversable (VecList n) 

Methods

traverse :: Applicative f => (a -> f b) -> VecList n a -> f (VecList n b) #

sequenceA :: Applicative f => VecList n (f a) -> f (VecList n a) #

mapM :: Monad m => (a -> m b) -> VecList n a -> m (VecList n b) #

sequence :: Monad m => VecList n (m a) -> m (VecList n 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 #

(Eq a, Arity n) => Eq (VecList n a) 

Methods

(==) :: VecList n a -> VecList n a -> Bool #

(/=) :: VecList n a -> VecList n a -> Bool #

(Ord a, Arity n) => Ord (VecList n a) 

Methods

compare :: VecList n a -> VecList n a -> Ordering #

(<) :: VecList n a -> VecList n a -> Bool #

(<=) :: VecList n a -> VecList n a -> Bool #

(>) :: VecList n a -> VecList n a -> Bool #

(>=) :: VecList n a -> VecList n a -> Bool #

max :: VecList n a -> VecList n a -> VecList n a #

min :: VecList n a -> VecList n a -> VecList n a #

(Show a, Arity n) => Show (VecList n a) 

Methods

showsPrec :: Int -> VecList n a -> ShowS #

show :: VecList n a -> String #

showList :: [VecList n a] -> ShowS #

(Arity n, Monoid a) => Monoid (VecList n a) 

Methods

mempty :: VecList n a #

mappend :: VecList n a -> VecList n a -> VecList n a #

mconcat :: [VecList n a] -> VecList n a #

(Storable a, Arity n) => Storable (VecList n a) 

Methods

sizeOf :: VecList n a -> Int #

alignment :: VecList n a -> Int #

peekElemOff :: Ptr (VecList n a) -> Int -> IO (VecList n a) #

pokeElemOff :: Ptr (VecList n a) -> Int -> VecList n a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (VecList n a) #

pokeByteOff :: Ptr b -> Int -> VecList n a -> IO () #

peek :: Ptr (VecList n a) -> IO (VecList n a) #

poke :: Ptr (VecList n a) -> VecList n a -> IO () #

(Arity n, NFData a) => NFData (VecList n a) 

Methods

rnf :: VecList n a -> () #

type Dim (VecList n) 
type Dim (VecList n) = n

Source classes

class Regular r l sh a => USource r l sh a where Source #

Class for arrays which could be indexed.

It's functions are unsafe: you must call touchArray after the last call. Fortunately, you will hardly ever need to call them manually.

Minimum complete defenition: index or linearIndex.

Counterpart for arrays of vectors: UVecSource

Methods

index :: UArray r l sh a -> sh -> IO a Source #

Shape, genuine monadic indexing.

In Yarr arrays are always zero-indexed and multidimensionally square. Maximum index is (extent arr).

Default implementation: index arr sh = linearIndex arr $ toLinear (extent arr) sh

linearIndex :: UArray r l sh a -> Int -> IO a Source #

"Surrogate" linear index. For Dim1 arrays index == linearIndex.

Default implementation: linearIndex arr i = index arr $ fromLinear (extent arr) i

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, Storable e) => USource FS L sh e Source # 

Methods

index :: UArray FS L sh e -> sh -> IO e Source #

linearIndex :: UArray FS L sh e -> Int -> IO e 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, NFData a) => USource MB L sh a Source # 

Methods

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

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

(Shape sh, NFData a) => USource B L sh a Source # 

Methods

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

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

Shape sh => USource CV CVL sh a Source # 

Methods

index :: UArray CV CVL sh a -> sh -> IO a Source #

linearIndex :: UArray CV CVL sh a -> Int -> IO a Source #

USource r l sh a => USource (CHK r) l sh a Source # 

Methods

index :: UArray (CHK r) l sh a -> sh -> IO a Source #

linearIndex :: UArray (CHK r) l sh a -> Int -> IO a 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 #

class (VecRegular r slr l sh v e, USource r l sh (v e), USource slr l sh e) => UVecSource r slr l sh v e Source #

Class for arrays of vectors which could be indexed. The class doesn't need to define functions, it just gathers it's dependencies.

Counterpart for "simple" arrays: USource.

Instances

(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, Storable e, Storable (v e)) => UVecSource F FS L 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 # 
UVecSource r slr l sh v e => UVecSource (CHK r) (CHK slr) l sh v e Source # 

Manifest and Target classes

class Regular tr tl sh a => UTarget tr tl sh a where Source #

Class for mutable arrays.

Just like for USource, it's function are unsafe and require calling touchArray after the last call.

Minimum complete defenition: write or linearWrite.

Counterpart for arrays of vectors: UVecTarget

Methods

write :: UArray tr tl sh a -> sh -> a -> IO () Source #

Shape, genuine monadic writing.

Default implementation: write tarr sh = linearWrite tarr $ toLinear (extent tarr) sh

linearWrite :: UArray tr tl sh a -> Int -> a -> IO () Source #

Fast (usually), linear indexing. Intented to be used internally.

Default implementation: linearWrite tarr i = write tarr $ fromLinear (extent tarr) i

Instances

Shape sh => UTarget DT SH sh a Source # 

Methods

write :: UArray DT SH sh a -> sh -> a -> IO () Source #

linearWrite :: UArray DT SH sh a -> Int -> a -> IO () Source #

(Shape sh, Storable e) => UTarget FS L sh e Source # 

Methods

write :: UArray FS L sh e -> sh -> e -> IO () Source #

linearWrite :: UArray FS L sh e -> Int -> e -> IO () Source #

(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, NFData a) => UTarget MB L sh a Source # 

Methods

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

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

UTarget tr tl sh a => UTarget (CHK tr) tl sh a Source # 

Methods

write :: UArray (CHK tr) tl sh a -> sh -> a -> IO () Source #

linearWrite :: UArray (CHK tr) tl sh a -> Int -> a -> IO () 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 #

class (USource r l sh a, UTarget mr l sh a) => Manifest r mr l sh a | r -> mr, mr -> r where Source #

Class for arrays which could be created. It combines a pair of representations: freezed and mutable (raw). This segregation is lifted from Boxed representation and, in the final, from GHC system of primitive arrays.

Parameters:

  • r - freezed array representation.
  • mr - mutable, raw array representation
  • l - load type index, common for both representations
  • sh - shape of arrays
  • a - element type

Minimal complete definition

new, freeze, thaw

Methods

new :: sh -> IO (UArray mr l sh a) Source #

O(1) Creates and returns mutable array of the given shape.

freeze :: UArray mr l sh a -> IO (UArray r l sh a) Source #

O(1) Freezes mutable array and returns array which could be indexed.

thaw :: UArray r l sh a -> IO (UArray mr l sh a) Source #

O(1) Thaws freezed array and returns mutable version.

Instances

(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, NFData a) => Manifest B MB L sh a Source # 

Methods

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

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

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

Manifest r mr l sh a => Manifest (CHK r) (CHK mr) l sh a Source # 

Methods

new :: sh -> IO (UArray (CHK mr) l sh a) Source #

freeze :: UArray (CHK mr) l sh a -> IO (UArray (CHK r) l sh a) Source #

thaw :: UArray (CHK r) l sh a -> IO (UArray (CHK mr) l sh a) 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 #

class (VecRegular tr tslr tl sh v e, UTarget tr tl sh (v e), UTarget tslr tl sh e) => UVecTarget tr tslr tl sh v e Source #

Class for mutable arrays of vectors. The class doesn't need to define functions, it just gathers it's dependencies.

Counterpart for "simple" arrays: UTarget.

Instances

(Shape sh, Vector v e, Storable e, Storable (v e)) => UVecTarget F FS L sh v e Source # 
(UTarget tr tl sh e, Vector v e) => UVecTarget (SE tr) tr tl sh v e Source # 
UVecTarget tr tslr l sh v e => UVecTarget (CHK tr) (CHK tslr) l sh v e Source # 

Work index

class WorkIndex sh i => PreferredWorkIndex l sh i | l sh -> i Source #

Type level fixation of preferred work (load, fold, etc.) index type of the array load type.

Parameters:

  • l - load type index
  • sh - shape of arrays
  • i - preferred work index, Int or sh itself

class (Shape sh, Shape i) => WorkIndex sh i where Source #

Internal implementation class. Generalizes linear- and simple indexing and writing function in USource and UTarget classes.

Minimal complete definition

toWork, gindex, gwrite

Methods

toWork :: sh -> i Source #

gindex :: USource r l sh a => UArray r l sh a -> i -> IO a Source #

gwrite :: UTarget tr tl sh a => UArray tr tl sh a -> i -> a -> IO () Source #

gsize :: USource r l sh a => UArray r l sh a -> i Source #

Instances

Shape sh => WorkIndex sh sh Source # 

Methods

toWork :: sh -> sh Source #

gindex :: USource r l sh a => UArray r l sh a -> sh -> IO a Source #

gwrite :: UTarget tr tl sh a => UArray tr tl sh a -> sh -> a -> IO () Source #

gsize :: USource r l sh a => UArray r l sh a -> sh Source #

WorkIndex Dim3 Int Source # 

Methods

toWork :: Dim3 -> Int Source #

gindex :: USource r l Dim3 a => UArray r l Dim3 a -> Int -> IO a Source #

gwrite :: UTarget tr tl Dim3 a => UArray tr tl Dim3 a -> Int -> a -> IO () Source #

gsize :: USource r l Dim3 a => UArray r l Dim3 a -> Int Source #

WorkIndex Dim2 Int Source # 

Methods

toWork :: Dim2 -> Int Source #

gindex :: USource r l Dim2 a => UArray r l Dim2 a -> Int -> IO a Source #

gwrite :: UTarget tr tl Dim2 a => UArray tr tl Dim2 a -> Int -> a -> IO () Source #

gsize :: USource r l Dim2 a => UArray r l Dim2 a -> Int Source #