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

Safe HaskellSafe
LanguageHaskell98

Data.Array.Repa.Shape

Description

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

Synopsis

Documentation

class Eq sh => Shape sh where #

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

Methods

rank :: sh -> Int #

Get the number of dimensions in a shape.

zeroDim :: sh #

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

unitDim :: sh #

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

intersectDim :: sh -> sh -> sh #

Compute the intersection of two shapes.

addDim :: sh -> sh -> sh #

Add the coordinates of two shapes componentwise

size :: sh -> Int #

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

sizeIsValid :: sh -> Bool #

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 #

Arguments

:: sh

Shape of the array.

-> sh

Index into the array.

-> Int 

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

fromIndex #

Arguments

:: sh

Shape of the array.

-> Int

Index into linear representation.

-> sh 

Inverse of toIndex.

inShapeRange #

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

Convert a shape into its list of dimensions.

shapeOfList :: [Int] -> sh #

Convert a list of dimensions to a shape

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

Ensure that a shape is completely evaluated.

Instances
Shape Z # 
Instance details

Defined in Data.Array.Repa.Index

Methods

rank :: Z -> Int #

zeroDim :: Z #

unitDim :: Z #

intersectDim :: Z -> Z -> Z #

addDim :: Z -> Z -> Z #

size :: Z -> Int #

sizeIsValid :: Z -> Bool #

toIndex :: Z -> Z -> Int #

fromIndex :: Z -> Int -> Z #

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

listOfShape :: Z -> [Int] #

shapeOfList :: [Int] -> Z #

deepSeq :: Z -> a -> a #

Shape sh => Shape (sh :. Int) # 
Instance details

Defined in Data.Array.Repa.Index

Methods

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

zeroDim :: sh :. Int #

unitDim :: sh :. Int #

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

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

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

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

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

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

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

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

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

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

inShape #

Arguments

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

Nicely format a shape as a string