Safe Haskell | Safe-Inferred |
---|
Class of types that can be used as array shapes and indices.
- 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 whereSource
Class of types that can be used as array shapes and indices.
Get the number of dimensions in a shape.
The shape of an array of size zero, with a particular dimensionality.
The shape of an array with size one, with a particular dimensionality.
intersectDim :: sh -> sh -> shSource
Compute the intersection of two shapes.
addDim :: sh -> sh -> shSource
Add the coordinates of two shapes componentwise
Get the total number of elements in an array with this shape.
sizeIsValid :: sh -> BoolSource
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.
:: sh | Shape of the array. |
-> sh | Index into the array. |
-> Int |
Convert an index into its equivalent flat, linear, row-major version.
:: sh | Shape of the array. |
-> Int | Index into linear representation. |
-> sh |
Inverse of toIndex
.
:: 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] -> shSource
Convert a list of dimensions to a shape
Ensure that a shape is completely evaluated.
Check whether an index is a part of a given shape.