| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Vision.Primitive.Shape
Contents
Description
Synopsis
- class Eq sh => Shape sh where
- shapeRank :: sh -> Int
- shapeLength :: sh -> Int
- shapeZero :: sh
- shapeSucc :: sh -> sh -> sh
- toLinearIndex :: sh -> sh -> Int
- fromLinearIndex :: sh -> Int -> sh
- shapeList :: sh -> [sh]
- inShape :: sh -> sh -> Bool
- data Z = Z
- data tail :. head = !tail :. !head
- type DIM0 = Z
- type DIM1 = DIM0 :. Int
- type DIM2 = DIM1 :. Int
- type DIM3 = DIM2 :. Int
- type DIM4 = DIM3 :. Int
- type DIM5 = DIM4 :. Int
- type DIM6 = DIM5 :. Int
- type DIM7 = DIM6 :. Int
- type DIM8 = DIM7 :. Int
- type DIM9 = DIM8 :. Int
- ix1 :: Int -> DIM1
- ix2 :: Int -> Int -> DIM2
- ix3 :: Int -> Int -> Int -> DIM3
- ix4 :: Int -> Int -> Int -> Int -> DIM4
- ix5 :: Int -> Int -> Int -> Int -> Int -> DIM5
- ix6 :: Int -> Int -> Int -> Int -> Int -> Int -> DIM6
- ix7 :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> DIM7
- ix8 :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> DIM8
- ix9 :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> Int -> DIM9
Documentation
class Eq sh => Shape sh where Source #
Class of types that can be used as array shapes and indices.
Methods
shapeRank :: sh -> Int Source #
Gets the number of dimensions in a shape.
shapeLength :: sh -> Int Source #
Gets the total number of elements in an array of this shape.
Gives the first index of an array.
Arguments
| :: sh | Shape of the array. |
| -> sh | Index. |
| -> sh |
Gives the successor of an index, given the shape of the array.
Arguments
| :: sh | Shape of the array. |
| -> sh | Index into the array. |
| -> Int |
Convert an index into its equivalent flat, linear, row-major version.
Arguments
| :: sh | Shape of the array. |
| -> Int | Index into linear representation. |
| -> sh |
Inverse of toLinearIndex.
shapeList :: sh -> [sh] Source #
Return the ascending list of indexes for the given shape.
Arguments
| :: sh | Shape of the array. |
| -> sh | Index to check for. |
| -> Bool |
Check whether an index is within a given shape.
Instances
| Shape Z Source # | |
Defined in Vision.Primitive.Shape | |
| Shape sh => Shape (sh :. Int) Source # | |
Defined in Vision.Primitive.Shape Methods shapeRank :: (sh :. Int) -> Int Source # shapeLength :: (sh :. Int) -> Int Source # shapeZero :: sh :. Int Source # shapeSucc :: (sh :. Int) -> (sh :. Int) -> sh :. Int Source # toLinearIndex :: (sh :. Int) -> (sh :. Int) -> Int Source # fromLinearIndex :: (sh :. Int) -> Int -> sh :. Int Source # | |
An index of dimension zero.
Constructors
| Z |
Instances
data tail :. head infixl 3 Source #
Our index type, used for both shapes and indices.
Constructors
| !tail :. !head infixl 3 |
Instances
Common dimensions.
Helpers
Helper for index construction.
Use this instead of explicit constructors like (Z :. (x :: Int))
The this is sometimes needed to ensure that x is constrained to
be in Int.