Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Class of types that can be used as array shapes and indices.
Documentation
class Eq sh => Shape sh where Source #
Class of types that can be used as array shapes and indices.
rank, zeroDim, unitDim, intersectDim, addDim, size, sizeIsValid, toIndex, fromIndex, inShapeRange, listOfShape, shapeOfList, deepSeq
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 -> sh Source #
Compute the intersection of two shapes.
addDim :: sh -> sh -> sh Source #
Add the coordinates of two shapes componentwise
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 :: sh -> sh -> Int Source #
Convert an index into its equivalent flat, linear, row-major version.
fromIndex :: sh -> Int -> sh Source #
Inverse of toIndex
.
inShapeRange :: sh -> sh -> sh -> Bool Source #
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.
Check whether an index is a part of a given shape.