repa-3.4.1.4: High performance, regular, shape polymorphic parallel arrays.

Safe Haskell | Safe
Language | Haskell98

Data.Array.Repa.Shape

Description

Class of types that can be used as array shapes and indices.

Synopsis

- class Eq sh => Shape sh where
  - rank :: sh -> Int
  - zeroDim :: sh
  - unitDim :: sh
  - intersectDim :: sh -> sh -> sh
  - addDim :: sh -> sh -> sh
  - size :: sh -> Int
  - sizeIsValid :: sh -> Bool
  - toIndex :: sh -> sh -> Int
  - fromIndex :: sh -> Int -> sh
  - inShapeRange :: sh -> sh -> sh -> Bool
  - listOfShape :: sh -> [Int]
  - shapeOfList :: [Int] -> sh
  - deepSeq :: sh -> a -> a
- inShape :: forall sh. Shape sh => sh -> sh -> Bool
- showShape :: Shape sh => sh -> String

# Documentation

class Eq sh => Shape sh where Source #

Class of types that can be used as array shapes and indices.

Methods

rank :: sh -> Int Source #

Get the number of dimensions in a shape.

zeroDim :: sh Source #

The shape of an array of size zero, with a particular dimensionality.

unitDim :: sh Source #

The shape of an array with size one, with a particular dimensionality.

intersectDim :: sh -> sh -> sh Source #

Compute the intersection of two shapes.

addDim :: sh -> sh -> sh Source #

Add the coordinates of two shapes componentwise

size :: sh -> Int Source #

Get the total number of elements in an array with this shape.

sizeIsValid :: sh -> Bool Source #

Check whether this shape is small enough so that its flat indices an be represented as `Int`. If this returns `False` then your array is too big. Mostly used for writing QuickCheck tests.

toIndex Source #

Arguments

:: sh | Shape of the array.
-> sh | Index into the array.
-> Int |

Convert an index into its equivalent flat, linear, row-major version.

fromIndex Source #

Arguments

:: sh | Shape of the array.
-> Int | Index into linear representation.
-> sh |

Inverse of `toIndex`.

inShapeRange Source #

Arguments

:: sh | Start index for range.
-> sh | Final index for range.
-> sh | Index to check for.
-> Bool |

Check whether an index is within a given shape.

listOfShape :: sh -> [Int] Source #

Convert a shape into its list of dimensions.

shapeOfList :: [Int] -> sh Source #

Convert a list of dimensions to a shape

deepSeq :: sh -> a -> a infixr 0 Source #

Ensure that a shape is completely evaluated.

#### Instances

Instances details

Shape Z Source # |

Instance details

Defined in Data.Array.Repa.Index

Methods

rank :: Z -> Int Source #

zeroDim :: Z Source #

unitDim :: Z Source #

intersectDim :: Z -> Z -> Z Source #

addDim :: Z -> Z -> Z Source #

size :: Z -> Int Source #

sizeIsValid :: Z -> Bool Source #

toIndex :: Z -> Z -> Int Source #

fromIndex :: Z -> Int -> Z Source #

inShapeRange :: Z -> Z -> Z -> Bool Source #

listOfShape :: Z -> [Int] Source #

shapeOfList :: [Int] -> Z Source #

deepSeq :: Z -> a -> a Source #

Shape sh => Shape (sh :. Int) Source # |

Instance details

Defined in Data.Array.Repa.Index

Methods

rank :: (sh :. Int) -> Int Source #

zeroDim :: sh :. Int Source #

unitDim :: sh :. Int Source #

intersectDim :: (sh :. Int) -> (sh :. Int) -> sh :. Int Source #

addDim :: (sh :. Int) -> (sh :. Int) -> sh :. Int Source #

size :: (sh :. Int) -> Int Source #

sizeIsValid :: (sh :. Int) -> Bool Source #

toIndex :: (sh :. Int) -> (sh :. Int) -> Int Source #

fromIndex :: (sh :. Int) -> Int -> sh :. Int Source #

inShapeRange :: (sh :. Int) -> (sh :. Int) -> (sh :. Int) -> Bool Source #

listOfShape :: (sh :. Int) -> [Int] Source #

shapeOfList :: [Int] -> sh :. Int Source #

deepSeq :: (sh :. Int) -> a -> a Source #

inShape Source #

Arguments

:: forall sh. Shape sh |
=> sh | Shape of the array.
-> sh | Index.
-> Bool |

Check whether an index is a part of a given shape.

showShape :: Shape sh => sh -> String Source #

Nicely format a shape as a string