ix-shapable-0.1.0: Reshape multi-dimensional arrays.

Data.Ix.Shapable

Synopsis

Documentation

class Shapable i whereSource

We need this type class to distinguish between different tuples of Ix. There are Shapable instances for homogenous Int tuples, but may Haddock doesn't see them.

Methods

sRank :: i -> IntSource

sShape :: i -> i -> [Int]Source

sBounds :: [Int] -> (i, i)Source

rank :: (Shapable i, Ix i, IArray a e) => a i e -> IntSource

Determine the rank of an array.

shape :: (Shapable i, Ix i, IArray a e) => a i e -> [Int]Source

Canonical representation of the shape. The following properties hold: 'length . shape = rank' 'product . shape = size'

shapeToStride :: [Int] -> [Int]Source

How much the offset changes when you move one element in the given direction. Since arrays are in row-major order, 'last . shapeToStride = const 1'

size :: (Ix i, IArray a e) => a i e -> IntSource

Number of elements in the Array.