comfort-array-shape-0.0: Additional shape types for the comfort-array package
Safe HaskellNone
LanguageHaskell98

Data.Array.Comfort.Shape.Extra

Synopsis

Documentation

data Simplex d size Source #

Simplex is a generalization of Triangular to more than two dimensions. Indices are tuples of fixed size with elements ordered in ascending, strictly ascending, descending or strictly descending order. "Order" refers to the index order in indices. In order to avoid confusion we suggest that the order of indices is consistent with <=.

Obviously, offset implements ranking and indexFromOffset implements unranking of combinations (in the combinatorial sense) with or without repetitions.

>>> Shape.indices $ ShapeExtra.Simplex (Unary.unary TypeNum.u3) $ Shape.ZeroBased (4::Int)
[0!:1!:2!:end,0!:1!:3!:end,0!:2!:3!:end,1!:2!:3!:end]

Constructors

Simplex 

Fields

Instances

Instances details
(Natural d, Show size) => Show (Simplex d size) Source # 
Instance details

Defined in Data.Array.Comfort.Shape.Extra

Methods

showsPrec :: Int -> Simplex d size -> ShowS #

show :: Simplex d size -> String #

showList :: [Simplex d size] -> ShowS #

(Natural d, C size) => C (Simplex d size) Source # 
Instance details

Defined in Data.Array.Comfort.Shape.Extra

Methods

size :: Simplex d size -> Int #

(Natural d, Indexed size) => Indexed (Simplex d size) Source # 
Instance details

Defined in Data.Array.Comfort.Shape.Extra

Associated Types

type Index (Simplex d size) #

Methods

indices :: Simplex d size -> [Index (Simplex d size)] #

offset :: Simplex d size -> Index (Simplex d size) -> Int #

uncheckedOffset :: Simplex d size -> Index (Simplex d size) -> Int #

unifiedOffset :: Checking check => Simplex d size -> Index (Simplex d size) -> Result check Int #

inBounds :: Simplex d size -> Index (Simplex d size) -> Bool #

sizeOffset :: Simplex d size -> (Int, Index (Simplex d size) -> Int) #

uncheckedSizeOffset :: Simplex d size -> (Int, Index (Simplex d size) -> Int) #

unifiedSizeOffset :: Checking check => Simplex d size -> (Int, Index (Simplex d size) -> Result check Int) #

(Natural d, InvIndexed size) => InvIndexed (Simplex d size) Source # 
Instance details

Defined in Data.Array.Comfort.Shape.Extra

Methods

indexFromOffset :: Simplex d size -> Int -> Index (Simplex d size) #

uncheckedIndexFromOffset :: Simplex d size -> Int -> Index (Simplex d size) #

unifiedIndexFromOffset :: Checking check => Simplex d size -> Int -> Result check (Index (Simplex d size)) #

type Index (Simplex d size) Source # 
Instance details

Defined in Data.Array.Comfort.Shape.Extra

type Index (Simplex d size) = T d (Index size)