knead-1.0.1.1: Repa-like array processing using LLVM JIT
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Array.Knead.Shape

Synopsis

Documentation

class (C sh, C (Index sh), Indexed sh) => C sh where Source #

Minimal complete definition

intersectCode, size, sizeOffset, iterator

Methods

intersectCode :: T sh -> T sh -> CodeGenFunction r (T sh) Source #

size :: T sh -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index sh ~ ix => T sh -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

Result is (size, offset). size must equal the result of size. We use this for sharing intermediate results.

iterator :: Index sh ~ ix => T sh -> T r (T ix) Source #

loop :: (Index sh ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T sh -> state -> CodeGenFunction r state Source #

Instances

Instances details
C () Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T () -> T () -> CodeGenFunction r (T ()) Source #

size :: T () -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index () ~ ix => T () -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index () ~ ix => T () -> T r (T ix) Source #

loop :: (Index () ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T () -> state -> CodeGenFunction r state Source #

(Integral n, ToSize n, Comparison n) => C (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Cyclic n) -> T (Cyclic n) -> CodeGenFunction r (T (Cyclic n)) Source #

size :: T (Cyclic n) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Cyclic n) ~ ix => T (Cyclic n) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Cyclic n) ~ ix => T (Cyclic n) -> T r (T ix) Source #

loop :: (Index (Cyclic n) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Cyclic n) -> state -> CodeGenFunction r state Source #

(Enum enum, Bounded enum, EnumBounded enum) => C (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Enumeration enum) -> T (Enumeration enum) -> CodeGenFunction r (T (Enumeration enum)) Source #

size :: T (Enumeration enum) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Enumeration enum) ~ ix => T (Enumeration enum) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Enumeration enum) ~ ix => T (Enumeration enum) -> T r (T ix) Source #

loop :: (Index (Enumeration enum) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Enumeration enum) -> state -> CodeGenFunction r state Source #

(Ix n, ToSize n, Comparison n) => C (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Range n) -> T (Range n) -> CodeGenFunction r (T (Range n)) Source #

size :: T (Range n) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Range n) ~ ix => T (Range n) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Range n) ~ ix => T (Range n) -> T r (T ix) Source #

loop :: (Index (Range n) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Range n) -> state -> CodeGenFunction r state Source #

(Integral n, ToSize n, Comparison n) => C (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Shifted n) -> T (Shifted n) -> CodeGenFunction r (T (Shifted n)) Source #

size :: T (Shifted n) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Shifted n) ~ ix => T (Shifted n) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Shifted n) ~ ix => T (Shifted n) -> T r (T ix) Source #

loop :: (Index (Shifted n) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Shifted n) -> state -> CodeGenFunction r state Source #

(Integral n, ToSize n, Comparison n) => C (ZeroBased n) Source #

Array dimensions and indexes cannot be negative, but computations in indices may temporarily yield negative values or we want to add negative values to indices.

So maybe, we would better have type Index (ZeroBased Word64) = Int64. This is not possible. Maybe we need an additional ZeroBased type for unsigned array sizes.

Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (ZeroBased n) -> T (ZeroBased n) -> CodeGenFunction r (T (ZeroBased n)) Source #

size :: T (ZeroBased n) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (ZeroBased n) ~ ix => T (ZeroBased n) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (ZeroBased n) ~ ix => T (ZeroBased n) -> T r (T ix) Source #

loop :: (Index (ZeroBased n) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (ZeroBased n) -> state -> CodeGenFunction r state Source #

(tag ~ ShapeTag, Natural rank) => C (T tag rank) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Cubic

Methods

intersectCode :: T0 (T tag rank) -> T0 (T tag rank) -> CodeGenFunction r (T0 (T tag rank)) Source #

size :: T0 (T tag rank) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (T tag rank) ~ ix => T0 (T tag rank) -> CodeGenFunction r (Value Size, T0 ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (T tag rank) ~ ix => T0 (T tag rank) -> T1 r (T0 ix) Source #

loop :: (Index (T tag rank) ~ ix, Phi state) => (T0 ix -> state -> CodeGenFunction r state) -> T0 (T tag rank) -> state -> CodeGenFunction r state Source #

(C n, C m) => C (n, m) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (n, m) -> T (n, m) -> CodeGenFunction r (T (n, m)) Source #

size :: T (n, m) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (n, m) ~ ix => T (n, m) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (n, m) ~ ix => T (n, m) -> T r (T ix) Source #

loop :: (Index (n, m) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (n, m) -> state -> CodeGenFunction r state Source #

C sh => C (Tagged tag sh) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Tagged tag sh) -> T (Tagged tag sh) -> CodeGenFunction r (T (Tagged tag sh)) Source #

size :: T (Tagged tag sh) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Tagged tag sh) ~ ix => T (Tagged tag sh) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Tagged tag sh) ~ ix => T (Tagged tag sh) -> T r (T ix) Source #

loop :: (Index (Tagged tag sh) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Tagged tag sh) -> state -> CodeGenFunction r state Source #

(C n, C m, C l) => C (n, m, l) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (n, m, l) -> T (n, m, l) -> CodeGenFunction r (T (n, m, l)) Source #

size :: T (n, m, l) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (n, m, l) ~ ix => T (n, m, l) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (n, m, l) ~ ix => T (n, m, l) -> T r (T ix) Source #

loop :: (Index (n, m, l) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (n, m, l) -> state -> CodeGenFunction r state Source #

type family Index sh #

Instances

Instances details
type Index IntSet 
Instance details

Defined in Data.Array.Comfort.Shape

type Index () 
Instance details

Defined in Data.Array.Comfort.Shape

type Index () = ()
type Index (Constructed tag) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Constructed tag) = ConsIndex tag
type Index (Cube sh) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Cube sh) = (Index sh, Index sh, Index sh)
type Index (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Cyclic n) = n
type Index (Deferred sh) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Enumeration n) = n
type Index (OneBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (OneBased n) = n
type Index (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Range n) = n
type Index (Record f) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Record f) = FieldIndex f
type Index (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Shifted n) = n
type Index (Square sh) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Square sh) = (Index sh, Index sh)
type Index (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (ZeroBased n) = n
type Index (IntMap shape) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (IntMap shape) = (Int, Index shape)
type Index (Set n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Set n) = n
type Index (sh0 ::+ sh1) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (sh0 ::+ sh1) = Either (Index sh0) (Index sh1)
type Index (NestedTuple TupleAccessor tuple) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (NestedTuple TupleAccessor tuple) = tuple -> Element
type Index (NestedTuple TupleIndex tuple) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Triangular part size) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Triangular part size) = (Index size, Index size)
type Index (Map k shape) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Map k shape) = (k, Index shape)
type Index (T tag rank) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Cubic

type Index (T tag rank) = Index rank
type Index (sh0, sh1) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (sh0, sh1) = (Index sh0, Index sh1)
type Index (Tagged s sh) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Tagged s sh) = Tagged s (Index sh)
type Index (sh0, sh1, sh2) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (sh0, sh1, sh2) = (Index sh0, Index sh1, Index sh2)
type Index (Simplex order coll f size) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Simplex order coll f size) = f (Index size)

type Size = Word Source #

value :: (C sh, Value val) => sh -> val sh Source #

paramWith :: C b => T p b -> (forall parameters. C parameters => (p -> parameters) -> (forall val. Value val => T parameters -> val b) -> a) -> a Source #

load :: C sh => f sh -> Value (Ptr (Struct sh)) -> CodeGenFunction r (T sh) Source #

intersect :: C sh => Exp sh -> Exp sh -> Exp sh Source #

offset :: C sh => T sh -> T (Index sh) -> CodeGenFunction r (Value Size) Source #

newtype ZeroBased n #

ZeroBased denotes a range starting at zero and has a certain length.

>>> Shape.indices (Shape.ZeroBased (7::Int))
[0,1,2,3,4,5,6]

Constructors

ZeroBased n 

Instances

Instances details
Applicative ZeroBased 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

pure :: a -> ZeroBased a #

(<*>) :: ZeroBased (a -> b) -> ZeroBased a -> ZeroBased b #

liftA2 :: (a -> b -> c) -> ZeroBased a -> ZeroBased b -> ZeroBased c #

(*>) :: ZeroBased a -> ZeroBased b -> ZeroBased b #

(<*) :: ZeroBased a -> ZeroBased b -> ZeroBased a #

Functor ZeroBased 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

fmap :: (a -> b) -> ZeroBased a -> ZeroBased b #

(<$) :: a -> ZeroBased b -> ZeroBased a #

Storable n => Storable (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

sizeOf :: ZeroBased n -> Int #

alignment :: ZeroBased n -> Int #

peekElemOff :: Ptr (ZeroBased n) -> Int -> IO (ZeroBased n) #

pokeElemOff :: Ptr (ZeroBased n) -> Int -> ZeroBased n -> IO () #

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

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

peek :: Ptr (ZeroBased n) -> IO (ZeroBased n) #

poke :: Ptr (ZeroBased n) -> ZeroBased n -> IO () #

Show n => Show (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Integral n => AppendMonoid (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

empty :: ZeroBased n #

Integral n => AppendSemigroup (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

append :: ZeroBased n -> ZeroBased n -> ZeroBased n #

Integral n => C (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

size :: ZeroBased n -> Int #

Integral n => Indexed (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Associated Types

type Index (ZeroBased n) #

Integral n => InvIndexed (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Integral n => Pattern (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Associated Types

type DataPattern (ZeroBased n) x #

Methods

indexPattern :: (Index (ZeroBased n) -> x) -> ZeroBased n -> DataPattern (ZeroBased n) x #

NFData n => NFData (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

rnf :: ZeroBased n -> () #

Eq n => Eq (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

(==) :: ZeroBased n -> ZeroBased n -> Bool #

(/=) :: ZeroBased n -> ZeroBased n -> Bool #

(Integral n, ToSize n, Comparison n) => C (ZeroBased n) Source #

Array dimensions and indexes cannot be negative, but computations in indices may temporarily yield negative values or we want to add negative values to indices.

So maybe, we would better have type Index (ZeroBased Word64) = Int64. This is not possible. Maybe we need an additional ZeroBased type for unsigned array sizes.

Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (ZeroBased n) -> T (ZeroBased n) -> CodeGenFunction r (T (ZeroBased n)) Source #

size :: T (ZeroBased n) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (ZeroBased n) ~ ix => T (ZeroBased n) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (ZeroBased n) ~ ix => T (ZeroBased n) -> T r (T ix) Source #

loop :: (Index (ZeroBased n) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (ZeroBased n) -> state -> CodeGenFunction r state Source #

(Integral n, ToSize n, Comparison n) => Sequence (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Compose n => Compose (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Composed (ZeroBased n) #

Methods

compose :: ZeroBased n -> Exp (Composed (ZeroBased n)) #

Decompose pn => Decompose (ZeroBased pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

C n => C (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Struct (ZeroBased n) #

C n => C (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

C n => C (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Repr (ZeroBased n) #

Compose n => Compose (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Composed (ZeroBased n) #

Methods

compose :: ZeroBased n -> T (Composed (ZeroBased n)) #

Decompose pn => Decompose (ZeroBased pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Value n => Value (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type ValueOf (ZeroBased n) #

Methods

valueOf :: ZeroBased n -> ValueOf (ZeroBased n) #

Phi n => Phi (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Undefined n => Undefined (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

undef :: ZeroBased n #

type Decomposed f (ZeroBased pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Index (ZeroBased n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (ZeroBased n) = n
type Composed (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Struct (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Struct (ZeroBased n) = Struct n
type Composed (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type PatternTuple (ZeroBased pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (ZeroBased n) = ZeroBased (Repr n)
type ValueOf (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type DataPattern (ZeroBased n) x 
Instance details

Defined in Data.Array.Comfort.Shape

type DataPattern (ZeroBased n) x = n -> x

zeroBased :: Value val => val n -> val (ZeroBased n) Source #

zeroBasedSize :: Value val => val (ZeroBased n) -> val n Source #

data Range n #

Range denotes an inclusive range like those of the Haskell 98 standard Array type from the array package. E.g. the shape type (Range Int32, Range Int64) is equivalent to the ix type (Int32, Int64) for Arrays.

>>> Shape.indices (Shape.Range (-5) (5::Int))
[-5,-4,-3,-2,-1,0,1,2,3,4,5]
>>> Shape.indices (Shape.Range (-1,-1) (1::Int,1::Int))
[(-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)]

Constructors

Range n n 

Instances

Instances details
Functor Range 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

fmap :: (a -> b) -> Range a -> Range b #

(<$) :: a -> Range b -> Range a #

Storable n => Storable (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

sizeOf :: Range n -> Int #

alignment :: Range n -> Int #

peekElemOff :: Ptr (Range n) -> Int -> IO (Range n) #

pokeElemOff :: Ptr (Range n) -> Int -> Range n -> IO () #

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

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

peek :: Ptr (Range n) -> IO (Range n) #

poke :: Ptr (Range n) -> Range n -> IO () #

Show n => Show (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

showsPrec :: Int -> Range n -> ShowS #

show :: Range n -> String #

showList :: [Range n] -> ShowS #

Ix n => C (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

size :: Range n -> Int #

Ix n => Indexed (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

Associated Types

type Index (Range n) #

Methods

indices :: Range n -> [Index (Range n)] #

offset :: Range n -> Index (Range n) -> Int #

uncheckedOffset :: Range n -> Index (Range n) -> Int #

unifiedOffset :: Checking check => Range n -> Index (Range n) -> Result check Int #

inBounds :: Range n -> Index (Range n) -> Bool #

sizeOffset :: Range n -> (Int, Index (Range n) -> Int) #

uncheckedSizeOffset :: Range n -> (Int, Index (Range n) -> Int) #

unifiedSizeOffset :: Checking check => Range n -> (Int, Index (Range n) -> Result check Int) #

Ix n => InvIndexed (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

NFData n => NFData (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

rnf :: Range n -> () #

Eq n => Eq (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

(==) :: Range n -> Range n -> Bool #

(/=) :: Range n -> Range n -> Bool #

(Ix n, ToSize n, Comparison n) => C (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Range n) -> T (Range n) -> CodeGenFunction r (T (Range n)) Source #

size :: T (Range n) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Range n) ~ ix => T (Range n) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Range n) ~ ix => T (Range n) -> T r (T ix) Source #

loop :: (Index (Range n) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Range n) -> state -> CodeGenFunction r state Source #

C n => C (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Repr (Range n) #

Methods

cons :: Range n -> T (Range n) #

undef :: T (Range n) #

zero :: T (Range n) #

phi :: BasicBlock -> T (Range n) -> CodeGenFunction r (T (Range n)) #

addPhi :: BasicBlock -> T (Range n) -> T (Range n) -> CodeGenFunction r () #

Compose n => Compose (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Composed (Range n) #

Methods

compose :: Range n -> T (Composed (Range n)) #

Decompose pn => Decompose (Range pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

decompose :: Range pn -> T (PatternTuple (Range pn)) -> Decomposed T (Range pn) #

Value n => Value (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type ValueOf (Range n) #

Methods

valueOf :: Range n -> ValueOf (Range n) #

Undefined n => Undefined (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

undef :: Range n #

type Decomposed f (Range pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Decomposed f (Range pn) = Range (Decomposed f pn)
type Index (Range n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Range n) = n
type Composed (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Composed (Range n) = Range (Composed n)
type PatternTuple (Range pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (Range n) = Range (Repr n)
type ValueOf (Range n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type ValueOf (Range n) = Range (ValueOf n)

range :: Value val => val n -> val n -> val (Range n) Source #

rangeFrom :: Value val => val (Range n) -> val n Source #

rangeTo :: Value val => val (Range n) -> val n Source #

data Shifted n #

Shifted denotes a range defined by the start index and the length.

>>> Shape.indices (Shape.Shifted (-4) (8::Int))
[-4,-3,-2,-1,0,1,2,3]

Constructors

Shifted n n 

Instances

Instances details
Functor Shifted 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

fmap :: (a -> b) -> Shifted a -> Shifted b #

(<$) :: a -> Shifted b -> Shifted a #

Storable n => Storable (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

sizeOf :: Shifted n -> Int #

alignment :: Shifted n -> Int #

peekElemOff :: Ptr (Shifted n) -> Int -> IO (Shifted n) #

pokeElemOff :: Ptr (Shifted n) -> Int -> Shifted n -> IO () #

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

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

peek :: Ptr (Shifted n) -> IO (Shifted n) #

poke :: Ptr (Shifted n) -> Shifted n -> IO () #

Show n => Show (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

showsPrec :: Int -> Shifted n -> ShowS #

show :: Shifted n -> String #

showList :: [Shifted n] -> ShowS #

Integral n => C (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

size :: Shifted n -> Int #

Integral n => Indexed (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

Associated Types

type Index (Shifted n) #

Methods

indices :: Shifted n -> [Index (Shifted n)] #

offset :: Shifted n -> Index (Shifted n) -> Int #

uncheckedOffset :: Shifted n -> Index (Shifted n) -> Int #

unifiedOffset :: Checking check => Shifted n -> Index (Shifted n) -> Result check Int #

inBounds :: Shifted n -> Index (Shifted n) -> Bool #

sizeOffset :: Shifted n -> (Int, Index (Shifted n) -> Int) #

uncheckedSizeOffset :: Shifted n -> (Int, Index (Shifted n) -> Int) #

unifiedSizeOffset :: Checking check => Shifted n -> (Int, Index (Shifted n) -> Result check Int) #

Integral n => InvIndexed (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

NFData n => NFData (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

rnf :: Shifted n -> () #

Eq n => Eq (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

(==) :: Shifted n -> Shifted n -> Bool #

(/=) :: Shifted n -> Shifted n -> Bool #

(Integral n, ToSize n, Comparison n) => C (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Shifted n) -> T (Shifted n) -> CodeGenFunction r (T (Shifted n)) Source #

size :: T (Shifted n) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Shifted n) ~ ix => T (Shifted n) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Shifted n) ~ ix => T (Shifted n) -> T r (T ix) Source #

loop :: (Index (Shifted n) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Shifted n) -> state -> CodeGenFunction r state Source #

C n => C (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Repr (Shifted n) #

Methods

cons :: Shifted n -> T (Shifted n) #

undef :: T (Shifted n) #

zero :: T (Shifted n) #

phi :: BasicBlock -> T (Shifted n) -> CodeGenFunction r (T (Shifted n)) #

addPhi :: BasicBlock -> T (Shifted n) -> T (Shifted n) -> CodeGenFunction r () #

Compose n => Compose (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Composed (Shifted n) #

Methods

compose :: Shifted n -> T (Composed (Shifted n)) #

Decompose pn => Decompose (Shifted pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

decompose :: Shifted pn -> T (PatternTuple (Shifted pn)) -> Decomposed T (Shifted pn) #

Value n => Value (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type ValueOf (Shifted n) #

Methods

valueOf :: Shifted n -> ValueOf (Shifted n) #

Undefined n => Undefined (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

undef :: Shifted n #

type Decomposed f (Shifted pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Decomposed f (Shifted pn) = Shifted (Decomposed f pn)
type Index (Shifted n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Shifted n) = n
type Composed (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type PatternTuple (Shifted pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (Shifted n) = Shifted (Repr n)
type ValueOf (Shifted n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

shifted :: Value val => val n -> val n -> val (Shifted n) Source #

shiftedOffset :: Value val => val (Shifted n) -> val n Source #

shiftedSize :: Value val => val (Shifted n) -> val n Source #

newtype Cyclic n #

Cyclic is a shape, where the indices wrap around at the array boundaries. E.g.

let shape = Shape.Cyclic (10::Int) in Shape.offset shape (-1) == Shape.offset shape 9

This also means that there are multiple indices that address the same array element.

>>> Shape.indices (Shape.Cyclic (7::Int))
[0,1,2,3,4,5,6]

Constructors

Cyclic n 

Instances

Instances details
Applicative Cyclic 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

pure :: a -> Cyclic a #

(<*>) :: Cyclic (a -> b) -> Cyclic a -> Cyclic b #

liftA2 :: (a -> b -> c) -> Cyclic a -> Cyclic b -> Cyclic c #

(*>) :: Cyclic a -> Cyclic b -> Cyclic b #

(<*) :: Cyclic a -> Cyclic b -> Cyclic a #

Functor Cyclic 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

fmap :: (a -> b) -> Cyclic a -> Cyclic b #

(<$) :: a -> Cyclic b -> Cyclic a #

Storable n => Storable (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

sizeOf :: Cyclic n -> Int #

alignment :: Cyclic n -> Int #

peekElemOff :: Ptr (Cyclic n) -> Int -> IO (Cyclic n) #

pokeElemOff :: Ptr (Cyclic n) -> Int -> Cyclic n -> IO () #

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

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

peek :: Ptr (Cyclic n) -> IO (Cyclic n) #

poke :: Ptr (Cyclic n) -> Cyclic n -> IO () #

Show n => Show (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

showsPrec :: Int -> Cyclic n -> ShowS #

show :: Cyclic n -> String #

showList :: [Cyclic n] -> ShowS #

Integral n => C (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

size :: Cyclic n -> Int #

Integral n => Indexed (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

Associated Types

type Index (Cyclic n) #

Methods

indices :: Cyclic n -> [Index (Cyclic n)] #

offset :: Cyclic n -> Index (Cyclic n) -> Int #

uncheckedOffset :: Cyclic n -> Index (Cyclic n) -> Int #

unifiedOffset :: Checking check => Cyclic n -> Index (Cyclic n) -> Result check Int #

inBounds :: Cyclic n -> Index (Cyclic n) -> Bool #

sizeOffset :: Cyclic n -> (Int, Index (Cyclic n) -> Int) #

uncheckedSizeOffset :: Cyclic n -> (Int, Index (Cyclic n) -> Int) #

unifiedSizeOffset :: Checking check => Cyclic n -> (Int, Index (Cyclic n) -> Result check Int) #

Integral n => InvIndexed (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

NFData n => NFData (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

rnf :: Cyclic n -> () #

Eq n => Eq (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

(==) :: Cyclic n -> Cyclic n -> Bool #

(/=) :: Cyclic n -> Cyclic n -> Bool #

(Integral n, ToSize n, Comparison n) => C (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Cyclic n) -> T (Cyclic n) -> CodeGenFunction r (T (Cyclic n)) Source #

size :: T (Cyclic n) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Cyclic n) ~ ix => T (Cyclic n) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Cyclic n) ~ ix => T (Cyclic n) -> T r (T ix) Source #

loop :: (Index (Cyclic n) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Cyclic n) -> state -> CodeGenFunction r state Source #

Compose n => Compose (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Composed (Cyclic n) #

Methods

compose :: Cyclic n -> Exp (Composed (Cyclic n)) #

Decompose pn => Decompose (Cyclic pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

decompose :: Cyclic pn -> Exp (PatternTuple (Cyclic pn)) -> Decomposed Exp (Cyclic pn) #

C n => C (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Struct (Cyclic n) #

C n => C (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

pack :: Cyclic n -> Struct (Cyclic n) #

unpack :: Struct (Cyclic n) -> Cyclic n #

C n => C (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Repr (Cyclic n) #

Methods

cons :: Cyclic n -> T (Cyclic n) #

undef :: T (Cyclic n) #

zero :: T (Cyclic n) #

phi :: BasicBlock -> T (Cyclic n) -> CodeGenFunction r (T (Cyclic n)) #

addPhi :: BasicBlock -> T (Cyclic n) -> T (Cyclic n) -> CodeGenFunction r () #

Compose n => Compose (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Composed (Cyclic n) #

Methods

compose :: Cyclic n -> T (Composed (Cyclic n)) #

Decompose pn => Decompose (Cyclic pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

decompose :: Cyclic pn -> T (PatternTuple (Cyclic pn)) -> Decomposed T (Cyclic pn) #

Value n => Value (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type ValueOf (Cyclic n) #

Methods

valueOf :: Cyclic n -> ValueOf (Cyclic n) #

Phi n => Phi (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Undefined n => Undefined (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

undef :: Cyclic n #

type Decomposed f (Cyclic pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Decomposed f (Cyclic pn) = Cyclic (Decomposed f pn)
type Index (Cyclic n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Cyclic n) = n
type Composed (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Struct (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Struct (Cyclic n) = Struct n
type Composed (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type PatternTuple (Cyclic pn) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (Cyclic n) = Cyclic (Repr n)
type ValueOf (Cyclic n) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type ValueOf (Cyclic n) = Cyclic (ValueOf n)

cyclic :: Value val => val n -> val (Cyclic n) Source #

cyclicSize :: Value val => val (Cyclic n) -> val n Source #

data Enumeration n #

Enumeration denotes a shape of fixed size that is defined by Enum and Bounded methods. For correctness it is necessary that the Enum and Bounded instances are properly implemented. Automatically derived instances are fine.

>>> Shape.indices (Shape.Enumeration :: Shape.Enumeration Ordering)
[LT,EQ,GT]

Constructors

Enumeration 

Instances

Instances details
Storable (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

Show (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

(Enum n, Bounded n) => C (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

size :: Enumeration n -> Int #

(Enum n, Bounded n) => Indexed (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

Associated Types

type Index (Enumeration n) #

(Enum n, Bounded n) => InvIndexed (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

(Enum n, Bounded n) => Static (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

static :: Enumeration n #

NFData (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

Methods

rnf :: Enumeration n -> () #

Eq (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

(Enum enum, Bounded enum, EnumBounded enum) => C (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

intersectCode :: T (Enumeration enum) -> T (Enumeration enum) -> CodeGenFunction r (T (Enumeration enum)) Source #

size :: T (Enumeration enum) -> CodeGenFunction r (Value Size) Source #

sizeOffset :: Index (Enumeration enum) ~ ix => T (Enumeration enum) -> CodeGenFunction r (Value Size, T ix -> CodeGenFunction r (Value Size)) Source #

iterator :: Index (Enumeration enum) ~ ix => T (Enumeration enum) -> T r (T ix) Source #

loop :: (Index (Enumeration enum) ~ ix, Phi state) => (T ix -> state -> CodeGenFunction r state) -> T (Enumeration enum) -> state -> CodeGenFunction r state Source #

(Enum enum, Bounded enum) => Compose (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Composed (Enumeration enum) #

Methods

compose :: Enumeration enum -> Exp (Composed (Enumeration enum)) #

Decompose (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

(Enum enum, Bounded enum) => C (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Repr (Enumeration enum) #

Methods

cons :: Enumeration enum -> T (Enumeration enum) #

undef :: T (Enumeration enum) #

zero :: T (Enumeration enum) #

phi :: BasicBlock -> T (Enumeration enum) -> CodeGenFunction r (T (Enumeration enum)) #

addPhi :: BasicBlock -> T (Enumeration enum) -> T (Enumeration enum) -> CodeGenFunction r () #

(Enum enum, Bounded enum) => Compose (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Associated Types

type Composed (Enumeration enum) #

Methods

compose :: Enumeration enum -> T (Composed (Enumeration enum)) #

Decompose (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

Methods

decompose :: Enumeration enum -> T (PatternTuple (Enumeration enum)) -> Decomposed T (Enumeration enum) #

type Decomposed f (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Decomposed f (Enumeration enum) = Enumeration enum
type Index (Enumeration n) 
Instance details

Defined in Data.Array.Comfort.Shape

type Index (Enumeration n) = n
type Composed (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Composed (Enumeration enum) = Enumeration enum
type Composed (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Composed (Enumeration enum) = Enumeration enum
type PatternTuple (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (Enumeration enum) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Orphan

type Repr (Enumeration enum) = ()

class (Enum enum, Bounded enum) => EnumBounded enum where Source #

Methods

enumOffset :: T enum -> CodeGenFunction r (Value Size) Source #

Instances

Instances details
(ToSize w, Additive w, IsInteger w, IntegerConstant w, Num w, Repr w ~ Value w, CmpRet w, IsPrimitive w, Enum e, Bounded e) => EnumBounded (T w e) Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

enumOffset :: T0 (T w e) -> CodeGenFunction r (Value Size) Source #

class C sh => Scalar sh where Source #

Methods

scalar :: Value val => val sh Source #

zeroIndex :: Value val => f sh -> val (Index sh) Source #

Instances

Instances details
Scalar () Source # 
Instance details

Defined in Data.Array.Knead.Shape

Methods

scalar :: Value val => val () Source #

zeroIndex :: Value val => f () -> val (Index ()) Source #

(tag ~ ShapeTag, rank ~ Zero) => Scalar (T tag rank) Source # 
Instance details

Defined in Data.Array.Knead.Shape.Cubic

Methods

scalar :: Value val => val (T tag rank) Source #

zeroIndex :: Value val => f (T tag rank) -> val (Index (T tag rank)) Source #

class (C sh, IntegerConstant (Index sh), Additive (Index sh)) => Sequence sh where Source #

Instances

Instances details
(Integral n, ToSize n, Comparison n) => Sequence (ZeroBased n) Source # 
Instance details

Defined in Data.Array.Knead.Shape