range package:massiv

Create an array of indices with a range from start to finish (not-including), where indices are incremeted by one.

Examples

>>> import Data.Massiv.Array

>>> range Seq (Ix1 1) 6
Array D Seq (Sz1 5)
[ 1, 2, 3, 4, 5 ]

>>> fromIx2 <$> range Seq (-1) (2 :. 2)
Array D Seq (Sz (3 :. 3))
[ [ (-1,-1), (-1,0), (-1,1) ]
, [ (0,-1), (0,0), (0,1) ]
, [ (1,-1), (1,0), (1,1) ]
]
Just like range, except the finish index is included.
Create an array of specified size with indices starting with some index at position 0 and incremented by 1 until the end of the array is reached
Same as rangeStepM, but will throw an error whenever step contains zeros.

Example

>>> import Data.Massiv.Array

>>> rangeStep' Seq (Ix1 1) 2 6
Array D Seq (Sz1 3)
[ 1, 3, 5 ]
Just like range, except the finish index is included.
Just like rangeStepM, except the finish index is included.
Same as range, but with a custom step. Throws Exceptions: IndexZeroException

Examples

>>> import Data.Massiv.Array

>>> rangeStepM Seq (Ix1 1) 2 8
Array D Seq (Sz1 4)
[ 1, 3, 5, 7 ]

>>> rangeStepM Seq (Ix1 1) 0 8
*** Exception: IndexZeroException: 0
Same as rangeSize, but with ability to specify the step.
Same as uniformArray, but will generate values in a supplied range.