repa-array-4.0.0.2: Bulk array representations and operators.

Safe HaskellNone
LanguageHaskell98

Data.Repa.Array.RowWise

Synopsis

Documentation

data RW sh Source

A row-wise layout that maps higher rank indices to linear ones in a row-major order.

Indices are ordered so the inner-most coordinate varies most frequently:

> Prelude.map (fromIndex (RowWise (ish2 2 3))) [0..5]
   [(Z :. 0) :. 0, (Z :. 0) :. 1, (Z :. 0) :. 2, 
    (Z :. 1) :. 0, (Z :. 1) :. 1, (Z :. 1) :. 2]
  • Indexing is not bounds checked. Indexing outside the extent yields the corresponding index.

Constructors

RowWise 

Fields

rowWiseShape :: !sh
 

Instances

Eq (Name (RW sh)) => Eq (Name (RW ((:.) sh Int))) 
Eq (Name (RW Z)) 
Eq sh => Eq (RW sh) 
Show (Name (RW sh)) => Show (Name (RW ((:.) sh Int))) 
Show (Name (RW Z)) 
Show sh => Show (RW sh) 
Shape sh => Shape (RW sh) 
(Layout (RW sh), (~) * (Index (RW sh)) sh) => Layout (RW ((:.) sh Int)) 
Layout (RW Z) 
(Layout (RW sh), (~) * (Index (RW sh)) sh) => Bulk (RW sh) sh

Row-wise arrays.

data Name (RW ((:.) sh Int)) = RC (Name (RW sh)) 
data Name (RW Z) = RZ 
type Index (RW ((:.) sh Int)) = (:.) sh Int 
type Index (RW Z) = Z 
data Array (RW sh) sh = RArray sh 

rowWise :: sh -> Array (RW sh) sh Source

Construct a rowWise array that produces the corresponding index for every element.

> toList $ rowWise (ish2 3 2) 
   [(Z :. 0) :. 0, (Z :. 0) :. 1,
    (Z :. 1) :. 0, (Z :. 1) :. 1,
    (Z :. 2) :. 0, (Z :. 2) :. 1]

Synonyms for common layouts.

type DIM1 = RW SH1 Source

type DIM2 = RW SH2 Source

type DIM3 = RW SH3 Source

type DIM4 = RW SH4 Source

type DIM5 = RW SH5 Source

Helpers that contrain the coordinates to be Ints.

ix2 :: Int -> Int -> DIM2 Source

ix3 :: Int -> Int -> Int -> DIM3 Source

ix4 :: Int -> Int -> Int -> Int -> DIM4 Source

ix5 :: Int -> Int -> Int -> Int -> Int -> DIM5 Source