telescope-0.1.1: Astronomical Observations (FITS, ASDF, WCS, etc)
Safe HaskellSafe-Inferred
LanguageGHC2021

Telescope.Fits.Encoding.DataArray

Synopsis

Encoding Images

decodeArray :: forall ix a m. MonadThrow m => (Index ix, AxesIndex ix, Prim a, GetPix a) => DataArray -> m (Array D ix a) Source #

Decode a DataArray of arbitrary dimensions ix and type a. Inspect the DataArray's (.bitpix) and (.axes) if these are unknown.

>>> decodeArray @Ix2 @Float hdu.dataArray
Array D Seq (Sz (2 :. 3))
  [ [ 1.0, 2.0, 3.0 ]
  , [ 4.0, 5.0, 6.0 ]
  ]

This creates a delayed (D) array, which will postpone evaluation of cells until needed

encodeArray :: forall r ix a. (Source r a, Stream r Ix1 a, Size r, PutArray ix, Index ix, AxesIndex ix, PutPix a, Prim a) => Array r ix a -> DataArray Source #

Encode an Array to a DataArray

>>> encodeImage array
DataArray:
  data: 48 bytes
  dimensions:
    format: Int64
    axes: [3,2]

Encoding as ByteStrings

decodeArrayData :: forall ix a m. (AxesIndex ix, Prim a, GetPix a, Index ix, MonadThrow m) => BitPix -> Axes Column -> ByteString -> m (Array D ix a) Source #

Decode data into an Array of arbitrary dimensions ix specifying BitPixFormat and Axes

>>> decodeArray @Ix2 @Float BPFloat [3, 2] input
Array P Seq (Sz (2 :. 3))
  [ [ 1.0, 2.0, 3.0 ]
  , [ 4.0, 5.0, 6.0 ]
  ]

encodeArrayData :: (Source r a, Stream r Ix1 a, PutArray ix, Index ix, PutPix a, Prim a) => Array r ix a -> ByteString Source #

Encode an Array as a Lazy ByteString based on the type of the element a

>>> myArray = decodeArray @Ix2 @Float BPFloat [3, 2] input
>>> output = encodeArray myArray

Handling Axes

totalPix :: Axes Column -> Int Source #

The total number of pixels to read from the input ByteString

class AxesIndex ix where Source #

Methods

axesIndex :: MonadThrow m => Axes Row -> m ix Source #

indexAxes :: ix -> Axes Row Source #

Instances

Instances details
AxesIndex Ix1 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

AxesIndex Ix2 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

AxesIndex Ix3 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

AxesIndex Ix4 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

AxesIndex Ix5 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

getAxesVector :: Get a -> Axes Column -> Get (Vector DS a) Source #

Decode Axes as a delayed 1d vector

runGetThrow :: forall a m. MonadThrow m => Get a -> ByteString -> m a Source #

sizeAxes :: (AxesIndex ix, Index ix) => Sz ix -> Axes Column Source #

Binary Encoding

class GetPix a where Source #

Methods

getPix :: BitPix -> Get a Source #

Instances

Instances details
GetPix Int16 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

getPix :: BitPix -> Get Int16 Source #

GetPix Int32 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

getPix :: BitPix -> Get Int32 Source #

GetPix Int64 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

getPix :: BitPix -> Get Int64 Source #

GetPix Int8 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

getPix :: BitPix -> Get Int8 Source #

GetPix Double Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

GetPix Float Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

getPix :: BitPix -> Get Float Source #

GetPix Int Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

getPix :: BitPix -> Get Int Source #

class PutPix a where Source #

How to encode an element type. Note that there is no instance for Int, since the size is system dependent. Use Int64 or Int32 instead

class PutArray ix where Source #

Methods

putArray :: (Source r a, Stream r Ix1 a, PutPix a, Prim a) => Array r ix a -> Put Source #

Instances

Instances details
PutArray Ix1 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

putArray :: (Source r a, Stream r Ix1 a, PutPix a, Prim a) => Array r Ix1 a -> Put Source #

PutArray Ix2 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

putArray :: (Source r a, Stream r Ix1 a, PutPix a, Prim a) => Array r Ix2 a -> Put Source #

PutArray Ix3 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

putArray :: (Source r a, Stream r Ix1 a, PutPix a, Prim a) => Array r Ix3 a -> Put Source #

PutArray Ix4 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

putArray :: (Source r a, Stream r Ix1 a, PutPix a, Prim a) => Array r Ix4 a -> Put Source #

PutArray Ix5 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

putArray :: (Source r a, Stream r Ix1 a, PutPix a, Prim a) => Array r Ix5 a -> Put Source #

parseVector :: forall a. GetPix a => Comp -> BitPix -> ByteString -> Vector D a Source #

fromVector :: forall ix a m. (AxesIndex ix, Index ix, Prim a, MonadThrow m) => Axes Column -> Vector D a -> m (Array D ix a) Source #

Exports from Data.Massiv.Array

data family Array r ix e #

The array family. Representations r describe how data is arranged or computed. All arrays have a common property that each index ix always maps to the same unique element e, even if that element does not yet exist in memory and the array has to be computed in order to get the value of that element. Data is always arranged in a nested row-major fashion. Rank of an array is specified by Dimensions ix.

Since: massiv-0.1.0

Instances

Instances details
Index ix => Foldable (Array DI ix) 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

fold :: Monoid m => Array DI ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array DI ix a -> m #

foldMap' :: Monoid m => (a -> m) -> Array DI ix a -> m #

foldr :: (a -> b -> b) -> b -> Array DI ix a -> b #

foldr' :: (a -> b -> b) -> b -> Array DI ix a -> b #

foldl :: (b -> a -> b) -> b -> Array DI ix a -> b #

foldl' :: (b -> a -> b) -> b -> Array DI ix a -> b #

foldr1 :: (a -> a -> a) -> Array DI ix a -> a #

foldl1 :: (a -> a -> a) -> Array DI ix a -> a #

toList :: Array DI ix a -> [a] #

null :: Array DI ix a -> Bool #

length :: Array DI ix a -> Int #

elem :: Eq a => a -> Array DI ix a -> Bool #

maximum :: Ord a => Array DI ix a -> a #

minimum :: Ord a => Array DI ix a -> a #

sum :: Num a => Array DI ix a -> a #

product :: Num a => Array DI ix a -> a #

Index ix => Foldable (Array D ix)

Row-major sequential folding over a Delayed array.

Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

fold :: Monoid m => Array D ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array D ix a -> m #

foldMap' :: Monoid m => (a -> m) -> Array D ix a -> m #

foldr :: (a -> b -> b) -> b -> Array D ix a -> b #

foldr' :: (a -> b -> b) -> b -> Array D ix a -> b #

foldl :: (b -> a -> b) -> b -> Array D ix a -> b #

foldl' :: (b -> a -> b) -> b -> Array D ix a -> b #

foldr1 :: (a -> a -> a) -> Array D ix a -> a #

foldl1 :: (a -> a -> a) -> Array D ix a -> a #

toList :: Array D ix a -> [a] #

null :: Array D ix a -> Bool #

length :: Array D ix a -> Int #

elem :: Eq a => a -> Array D ix a -> Bool #

maximum :: Ord a => Array D ix a -> a #

minimum :: Ord a => Array D ix a -> a #

sum :: Num a => Array D ix a -> a #

product :: Num a => Array D ix a -> a #

Foldable (Array DS Ix1) 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

fold :: Monoid m => Array DS Ix1 m -> m #

foldMap :: Monoid m => (a -> m) -> Array DS Ix1 a -> m #

foldMap' :: Monoid m => (a -> m) -> Array DS Ix1 a -> m #

foldr :: (a -> b -> b) -> b -> Array DS Ix1 a -> b #

foldr' :: (a -> b -> b) -> b -> Array DS Ix1 a -> b #

foldl :: (b -> a -> b) -> b -> Array DS Ix1 a -> b #

foldl' :: (b -> a -> b) -> b -> Array DS Ix1 a -> b #

foldr1 :: (a -> a -> a) -> Array DS Ix1 a -> a #

foldl1 :: (a -> a -> a) -> Array DS Ix1 a -> a #

toList :: Array DS Ix1 a -> [a] #

null :: Array DS Ix1 a -> Bool #

length :: Array DS Ix1 a -> Int #

elem :: Eq a => a -> Array DS Ix1 a -> Bool #

maximum :: Ord a => Array DS Ix1 a -> a #

minimum :: Ord a => Array DS Ix1 a -> a #

sum :: Num a => Array DS Ix1 a -> a #

product :: Num a => Array DS Ix1 a -> a #

Index ix => Foldable (Array B ix)

Row-major sequential folding over a Boxed array.

Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fold :: Monoid m => Array B ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array B ix a -> m #

foldMap' :: Monoid m => (a -> m) -> Array B ix a -> m #

foldr :: (a -> b -> b) -> b -> Array B ix a -> b #

foldr' :: (a -> b -> b) -> b -> Array B ix a -> b #

foldl :: (b -> a -> b) -> b -> Array B ix a -> b #

foldl' :: (b -> a -> b) -> b -> Array B ix a -> b #

foldr1 :: (a -> a -> a) -> Array B ix a -> a #

foldl1 :: (a -> a -> a) -> Array B ix a -> a #

toList :: Array B ix a -> [a] #

null :: Array B ix a -> Bool #

length :: Array B ix a -> Int #

elem :: Eq a => a -> Array B ix a -> Bool #

maximum :: Ord a => Array B ix a -> a #

minimum :: Ord a => Array B ix a -> a #

sum :: Num a => Array B ix a -> a #

product :: Num a => Array B ix a -> a #

Index ix => Foldable (Array BL ix)

Row-major sequential folding over a Boxed array.

Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fold :: Monoid m => Array BL ix m -> m #

foldMap :: Monoid m => (a -> m) -> Array BL ix a -> m #

foldMap' :: Monoid m => (a -> m) -> Array BL ix a -> m #

foldr :: (a -> b -> b) -> b -> Array BL ix a -> b #

foldr' :: (a -> b -> b) -> b -> Array BL ix a -> b #

foldl :: (b -> a -> b) -> b -> Array BL ix a -> b #

foldl' :: (b -> a -> b) -> b -> Array BL ix a -> b #

foldr1 :: (a -> a -> a) -> Array BL ix a -> a #

foldl1 :: (a -> a -> a) -> Array BL ix a -> a #

toList :: Array BL ix a -> [a] #

null :: Array BL ix a -> Bool #

length :: Array BL ix a -> Int #

elem :: Eq a => a -> Array BL ix a -> Bool #

maximum :: Ord a => Array BL ix a -> a #

minimum :: Ord a => Array BL ix a -> a #

sum :: Num a => Array BL ix a -> a #

product :: Num a => Array BL ix a -> a #

Index ix => Traversable (Array B ix) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

traverse :: Applicative f => (a -> f b) -> Array B ix a -> f (Array B ix b) #

sequenceA :: Applicative f => Array B ix (f a) -> f (Array B ix a) #

mapM :: Monad m => (a -> m b) -> Array B ix a -> m (Array B ix b) #

sequence :: Monad m => Array B ix (m a) -> m (Array B ix a) #

Index ix => Traversable (Array BL ix) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

traverse :: Applicative f => (a -> f b) -> Array BL ix a -> f (Array BL ix b) #

sequenceA :: Applicative f => Array BL ix (f a) -> f (Array BL ix a) #

mapM :: Monad m => (a -> m b) -> Array BL ix a -> m (Array BL ix b) #

sequence :: Monad m => Array BL ix (m a) -> m (Array BL ix a) #

Index ix => Applicative (Array DI ix) 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

pure :: a -> Array DI ix a #

(<*>) :: Array DI ix (a -> b) -> Array DI ix a -> Array DI ix b #

liftA2 :: (a -> b -> c) -> Array DI ix a -> Array DI ix b -> Array DI ix c #

(*>) :: Array DI ix a -> Array DI ix b -> Array DI ix b #

(<*) :: Array DI ix a -> Array DI ix b -> Array DI ix a #

Index ix => Applicative (Array D ix) 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

pure :: a -> Array D ix a #

(<*>) :: Array D ix (a -> b) -> Array D ix a -> Array D ix b #

liftA2 :: (a -> b -> c) -> Array D ix a -> Array D ix b -> Array D ix c #

(*>) :: Array D ix a -> Array D ix b -> Array D ix b #

(<*) :: Array D ix a -> Array D ix b -> Array D ix a #

Applicative (Array DS Ix1) 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

pure :: a -> Array DS Ix1 a #

(<*>) :: Array DS Ix1 (a -> b) -> Array DS Ix1 a -> Array DS Ix1 b #

liftA2 :: (a -> b -> c) -> Array DS Ix1 a -> Array DS Ix1 b -> Array DS Ix1 c #

(*>) :: Array DS Ix1 a -> Array DS Ix1 b -> Array DS Ix1 b #

(<*) :: Array DS Ix1 a -> Array DS Ix1 b -> Array DS Ix1 a #

Functor (Array DI ix) 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

fmap :: (a -> b) -> Array DI ix a -> Array DI ix b #

(<$) :: a -> Array DI ix b -> Array DI ix a #

Functor (Array D ix) 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

fmap :: (a -> b) -> Array D ix a -> Array D ix b #

(<$) :: a -> Array D ix b -> Array D ix a #

Index ix => Functor (Array DL ix) 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

fmap :: (a -> b) -> Array DL ix a -> Array DL ix b #

(<$) :: a -> Array DL ix b -> Array DL ix a #

Functor (Array DS Ix1) 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

fmap :: (a -> b) -> Array DS Ix1 a -> Array DS Ix1 b #

(<$) :: a -> Array DS Ix1 b -> Array DS Ix1 a #

Functor (Array DW ix) 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

fmap :: (a -> b) -> Array DW ix a -> Array DW ix b #

(<$) :: a -> Array DW ix b -> Array DW ix a #

Index ix => Functor (Array B ix) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fmap :: (a -> b) -> Array B ix a -> Array B ix b #

(<$) :: a -> Array B ix b -> Array B ix a #

Index ix => Functor (Array BL ix) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

fmap :: (a -> b) -> Array BL ix a -> Array BL ix b #

(<$) :: a -> Array BL ix b -> Array BL ix a #

Monad (Array DS Ix1) 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

(>>=) :: Array DS Ix1 a -> (a -> Array DS Ix1 b) -> Array DS Ix1 b #

(>>) :: Array DS Ix1 a -> Array DS Ix1 b -> Array DS Ix1 b #

return :: a -> Array DS Ix1 a #

Monoid (Array DL Ix1 e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

mempty :: Array DL Ix1 e #

mappend :: Array DL Ix1 e -> Array DL Ix1 e -> Array DL Ix1 e #

mconcat :: [Array DL Ix1 e] -> Array DL Ix1 e #

Monoid (Array DS Ix1 e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

mempty :: Array DS Ix1 e #

mappend :: Array DS Ix1 e -> Array DS Ix1 e -> Array DS Ix1 e #

mconcat :: [Array DS Ix1 e] -> Array DS Ix1 e #

Semigroup (Array DL Ix1 e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

Methods

(<>) :: Array DL Ix1 e -> Array DL Ix1 e -> Array DL Ix1 e #

sconcat :: NonEmpty (Array DL Ix1 e) -> Array DL Ix1 e #

stimes :: Integral b => b -> Array DL Ix1 e -> Array DL Ix1 e #

Semigroup (Array DS Ix1 e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Methods

(<>) :: Array DS Ix1 e -> Array DS Ix1 e -> Array DS Ix1 e #

sconcat :: NonEmpty (Array DS Ix1 e) -> Array DS Ix1 e #

stimes :: Integral b => b -> Array DS Ix1 e -> Array DS Ix1 e #

IsList (Array DS Ix1 e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

Associated Types

type Item (Array DS Ix1 e) #

Methods

fromList :: [Item (Array DS Ix1 e)] -> Array DS Ix1 e #

fromListN :: Int -> [Item (Array DS Ix1 e)] -> Array DS Ix1 e #

toList :: Array DS Ix1 e -> [Item (Array DS Ix1 e)] #

(IsList (Array L ix e), Ragged L ix e) => IsList (Array B ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type Item (Array B ix e) #

Methods

fromList :: [Item (Array B ix e)] -> Array B ix e #

fromListN :: Int -> [Item (Array B ix e)] -> Array B ix e #

toList :: Array B ix e -> [Item (Array B ix e)] #

(IsList (Array L ix e), Ragged L ix e) => IsList (Array BL ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type Item (Array BL ix e) #

Methods

fromList :: [Item (Array BL ix e)] -> Array BL ix e #

fromListN :: Int -> [Item (Array BL ix e)] -> Array BL ix e #

toList :: Array BL ix e -> [Item (Array BL ix e)] #

(NFData e, IsList (Array L ix e), Ragged L ix e) => IsList (Array BN ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Associated Types

type Item (Array BN ix e) #

Methods

fromList :: [Item (Array BN ix e)] -> Array BN ix e #

fromListN :: Int -> [Item (Array BN ix e)] -> Array BN ix e #

toList :: Array BN ix e -> [Item (Array BN ix e)] #

(Prim e, IsList (Array L ix e), Ragged L ix e) => IsList (Array P ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Associated Types

type Item (Array P ix e) #

Methods

fromList :: [Item (Array P ix e)] -> Array P ix e #

fromListN :: Int -> [Item (Array P ix e)] -> Array P ix e #

toList :: Array P ix e -> [Item (Array P ix e)] #

(Storable e, IsList (Array L ix e), Ragged L ix e) => IsList (Array S ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Associated Types

type Item (Array S ix e) #

Methods

fromList :: [Item (Array S ix e)] -> Array S ix e #

fromListN :: Int -> [Item (Array S ix e)] -> Array S ix e #

toList :: Array S ix e -> [Item (Array S ix e)] #

(Unbox e, IsList (Array L ix e), Ragged L ix e) => IsList (Array U ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Associated Types

type Item (Array U ix e) #

Methods

fromList :: [Item (Array U ix e)] -> Array U ix e #

fromListN :: Int -> [Item (Array U ix e)] -> Array U ix e #

toList :: Array U ix e -> [Item (Array U ix e)] #

Coercible (Elt ix e) (ListItem ix e) => IsList (Array L ix e) 
Instance details

Defined in Data.Massiv.Core.List

Associated Types

type Item (Array L ix e) #

Methods

fromList :: [Item (Array L ix e)] -> Array L ix e #

fromListN :: Int -> [Item (Array L ix e)] -> Array L ix e #

toList :: Array L ix e -> [Item (Array L ix e)] #

(Ragged L ix e, Show e) => Show (Array DI ix e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

showsPrec :: Int -> Array DI ix e -> ShowS #

show :: Array DI ix e -> String #

showList :: [Array DI ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array D ix e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

showsPrec :: Int -> Array D ix e -> ShowS #

show :: Array D ix e -> String #

showList :: [Array D ix e] -> ShowS #

(Ragged L ix e, Load DW ix e, Show e) => Show (Array DW ix e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

showsPrec :: Int -> Array DW ix e -> ShowS #

show :: Array DW ix e -> String #

showList :: [Array DW ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array B ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array B ix e -> ShowS #

show :: Array B ix e -> String #

showList :: [Array B ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array BL ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array BL ix e -> ShowS #

show :: Array BL ix e -> String #

showList :: [Array BL ix e] -> ShowS #

(Ragged L ix e, Show e, NFData e) => Show (Array BN ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

showsPrec :: Int -> Array BN ix e -> ShowS #

show :: Array BN ix e -> String #

showList :: [Array BN ix e] -> ShowS #

(Ragged L ix e, Show e, Prim e) => Show (Array P ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

showsPrec :: Int -> Array P ix e -> ShowS #

show :: Array P ix e -> String #

showList :: [Array P ix e] -> ShowS #

(Ragged L ix e, Show e, Storable e) => Show (Array S ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

showsPrec :: Int -> Array S ix e -> ShowS #

show :: Array S ix e -> String #

showList :: [Array S ix e] -> ShowS #

(Ragged L ix e, Show e, Unbox e) => Show (Array U ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

showsPrec :: Int -> Array U ix e -> ShowS #

show :: Array U ix e -> String #

showList :: [Array U ix e] -> ShowS #

(Ragged L ix e, Show e) => Show (Array L ix e) 
Instance details

Defined in Data.Massiv.Core.List

Methods

showsPrec :: Int -> Array L ix e -> ShowS #

show :: Array L ix e -> String #

showList :: [Array L ix e] -> ShowS #

(Index ix, NFData e) => NFData (Array B ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

rnf :: Array B ix e -> () #

(Index ix, NFData e) => NFData (Array BL ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

rnf :: Array BL ix e -> () #

NFData (Array BN ix e)

O(1) - BN is already in normal form

Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

rnf :: Array BN ix e -> () #

Index ix => NFData (Array P ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

rnf :: Array P ix e -> () #

NFData ix => NFData (Array S ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

rnf :: Array S ix e -> () #

NFData ix => NFData (Array U ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

rnf :: Array U ix e -> () #

(Index ix, Eq e) => Eq (Array DI ix e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

(==) :: Array DI ix e -> Array DI ix e -> Bool #

(/=) :: Array DI ix e -> Array DI ix e -> Bool #

(Eq e, Index ix) => Eq (Array D ix e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

(==) :: Array D ix e -> Array D ix e -> Bool #

(/=) :: Array D ix e -> Array D ix e -> Bool #

(Index ix, Eq e) => Eq (Array B ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

(==) :: Array B ix e -> Array B ix e -> Bool #

(/=) :: Array B ix e -> Array B ix e -> Bool #

(Index ix, Eq e) => Eq (Array BL ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

(==) :: Array BL ix e -> Array BL ix e -> Bool #

(/=) :: Array BL ix e -> Array BL ix e -> Bool #

(Index ix, NFData e, Eq e) => Eq (Array BN ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

(==) :: Array BN ix e -> Array BN ix e -> Bool #

(/=) :: Array BN ix e -> Array BN ix e -> Bool #

(Prim e, Eq e, Index ix) => Eq (Array P ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

(==) :: Array P ix e -> Array P ix e -> Bool #

(/=) :: Array P ix e -> Array P ix e -> Bool #

(Storable e, Eq e, Index ix) => Eq (Array S ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

(==) :: Array S ix e -> Array S ix e -> Bool #

(/=) :: Array S ix e -> Array S ix e -> Bool #

(Unbox e, Eq e, Index ix) => Eq (Array U ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

(==) :: Array U ix e -> Array U ix e -> Bool #

(/=) :: Array U ix e -> Array U ix e -> Bool #

(Index ix, Ord e) => Ord (Array DI ix e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

Methods

compare :: Array DI ix e -> Array DI ix e -> Ordering #

(<) :: Array DI ix e -> Array DI ix e -> Bool #

(<=) :: Array DI ix e -> Array DI ix e -> Bool #

(>) :: Array DI ix e -> Array DI ix e -> Bool #

(>=) :: Array DI ix e -> Array DI ix e -> Bool #

max :: Array DI ix e -> Array DI ix e -> Array DI ix e #

min :: Array DI ix e -> Array DI ix e -> Array DI ix e #

(Ord e, Index ix) => Ord (Array D ix e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

Methods

compare :: Array D ix e -> Array D ix e -> Ordering #

(<) :: Array D ix e -> Array D ix e -> Bool #

(<=) :: Array D ix e -> Array D ix e -> Bool #

(>) :: Array D ix e -> Array D ix e -> Bool #

(>=) :: Array D ix e -> Array D ix e -> Bool #

max :: Array D ix e -> Array D ix e -> Array D ix e #

min :: Array D ix e -> Array D ix e -> Array D ix e #

(Index ix, Ord e) => Ord (Array B ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

compare :: Array B ix e -> Array B ix e -> Ordering #

(<) :: Array B ix e -> Array B ix e -> Bool #

(<=) :: Array B ix e -> Array B ix e -> Bool #

(>) :: Array B ix e -> Array B ix e -> Bool #

(>=) :: Array B ix e -> Array B ix e -> Bool #

max :: Array B ix e -> Array B ix e -> Array B ix e #

min :: Array B ix e -> Array B ix e -> Array B ix e #

(Index ix, Ord e) => Ord (Array BL ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

compare :: Array BL ix e -> Array BL ix e -> Ordering #

(<) :: Array BL ix e -> Array BL ix e -> Bool #

(<=) :: Array BL ix e -> Array BL ix e -> Bool #

(>) :: Array BL ix e -> Array BL ix e -> Bool #

(>=) :: Array BL ix e -> Array BL ix e -> Bool #

max :: Array BL ix e -> Array BL ix e -> Array BL ix e #

min :: Array BL ix e -> Array BL ix e -> Array BL ix e #

(Index ix, NFData e, Ord e) => Ord (Array BN ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

Methods

compare :: Array BN ix e -> Array BN ix e -> Ordering #

(<) :: Array BN ix e -> Array BN ix e -> Bool #

(<=) :: Array BN ix e -> Array BN ix e -> Bool #

(>) :: Array BN ix e -> Array BN ix e -> Bool #

(>=) :: Array BN ix e -> Array BN ix e -> Bool #

max :: Array BN ix e -> Array BN ix e -> Array BN ix e #

min :: Array BN ix e -> Array BN ix e -> Array BN ix e #

(Prim e, Ord e, Index ix) => Ord (Array P ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

Methods

compare :: Array P ix e -> Array P ix e -> Ordering #

(<) :: Array P ix e -> Array P ix e -> Bool #

(<=) :: Array P ix e -> Array P ix e -> Bool #

(>) :: Array P ix e -> Array P ix e -> Bool #

(>=) :: Array P ix e -> Array P ix e -> Bool #

max :: Array P ix e -> Array P ix e -> Array P ix e #

min :: Array P ix e -> Array P ix e -> Array P ix e #

(Storable e, Ord e, Index ix) => Ord (Array S ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

Methods

compare :: Array S ix e -> Array S ix e -> Ordering #

(<) :: Array S ix e -> Array S ix e -> Bool #

(<=) :: Array S ix e -> Array S ix e -> Bool #

(>) :: Array S ix e -> Array S ix e -> Bool #

(>=) :: Array S ix e -> Array S ix e -> Bool #

max :: Array S ix e -> Array S ix e -> Array S ix e #

min :: Array S ix e -> Array S ix e -> Array S ix e #

(Unbox e, Ord e, Index ix) => Ord (Array U ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

Methods

compare :: Array U ix e -> Array U ix e -> Ordering #

(<) :: Array U ix e -> Array U ix e -> Bool #

(<=) :: Array U ix e -> Array U ix e -> Bool #

(>) :: Array U ix e -> Array U ix e -> Bool #

(>=) :: Array U ix e -> Array U ix e -> Bool #

max :: Array U ix e -> Array U ix e -> Array U ix e #

min :: Array U ix e -> Array U ix e -> Array U ix e #

newtype Array DI ix e 
Instance details

Defined in Data.Massiv.Array.Delayed.Interleaved

newtype Array DI ix e = DIArray {}
data Array D ix e 
Instance details

Defined in Data.Massiv.Array.Delayed.Pull

data Array D ix e = DArray {}
data Array DL ix e 
Instance details

Defined in Data.Massiv.Array.Delayed.Push

data Array DL ix e = DLArray {}
data Array DW ix e 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

data Array DW ix e = DWArray {}
newtype Array B ix e 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

newtype Array B ix e = BArray (Array BL ix e)
data Array BL ix e 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

data Array BL ix e = BLArray {}
newtype Array BN ix e 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

newtype Array BN ix e = BNArray (Array BL ix e)
data Array P ix e 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

data Array P ix e = PArray {}
data Array S ix e 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

data Array S ix e = SArray {}
data Array U ix e 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

data Array U ix e = UArray {}
data Array L ix e 
Instance details

Defined in Data.Massiv.Core.List

data Array L ix e = LArray {}
newtype Array DS Ix1 e 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

newtype Array DS Ix1 e = DSArray {}
type Item (Array DS Ix1 e) 
Instance details

Defined in Data.Massiv.Array.Delayed.Stream

type Item (Array DS Ix1 e) = e
type Item (Array B ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type Item (Array B ix e) = Item (Array L ix e)
type Item (Array BL ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type Item (Array BL ix e) = Item (Array L ix e)
type Item (Array BN ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Boxed

type Item (Array BN ix e) = Item (Array L ix e)
type Item (Array P ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Primitive

type Item (Array P ix e) = Item (Array L ix e)
type Item (Array S ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Storable

type Item (Array S ix e) = Item (Array L ix e)
type Item (Array U ix e) 
Instance details

Defined in Data.Massiv.Array.Manifest.Unboxed

type Item (Array U ix e) = Item (Array L ix e)
type Item (Array L ix e) 
Instance details

Defined in Data.Massiv.Core.List

type Item (Array L ix e) = ListItem ix e

type Ix1 = Int #

A type synonym for 1-dimensional index, i.e. Int.

>>> 5 :: Ix1
5

Since: massiv-0.1.0

data Ix2 #

2-dimensional index. This is also a base index for higher dimensions.

Since: massiv-0.1.0

Instances

Instances details
Bounded Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

minBound :: Ix2 #

maxBound :: Ix2 #

Ix Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

range :: (Ix2, Ix2) -> [Ix2] #

index :: (Ix2, Ix2) -> Ix2 -> Int #

unsafeIndex :: (Ix2, Ix2) -> Ix2 -> Int #

inRange :: (Ix2, Ix2) -> Ix2 -> Bool #

rangeSize :: (Ix2, Ix2) -> Int #

unsafeRangeSize :: (Ix2, Ix2) -> Int #

Num Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

(+) :: Ix2 -> Ix2 -> Ix2 #

(-) :: Ix2 -> Ix2 -> Ix2 #

(*) :: Ix2 -> Ix2 -> Ix2 #

negate :: Ix2 -> Ix2 #

abs :: Ix2 -> Ix2 #

signum :: Ix2 -> Ix2 #

fromInteger :: Integer -> Ix2 #

Show Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

showsPrec :: Int -> Ix2 -> ShowS #

show :: Ix2 -> String #

showList :: [Ix2] -> ShowS #

NFData Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

rnf :: Ix2 -> () #

Eq Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

(==) :: Ix2 -> Ix2 -> Bool #

(/=) :: Ix2 -> Ix2 -> Bool #

Ord Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

compare :: Ix2 -> Ix2 -> Ordering #

(<) :: Ix2 -> Ix2 -> Bool #

(<=) :: Ix2 -> Ix2 -> Bool #

(>) :: Ix2 -> Ix2 -> Bool #

(>=) :: Ix2 -> Ix2 -> Bool #

max :: Ix2 -> Ix2 -> Ix2 #

min :: Ix2 -> Ix2 -> Ix2 #

Index Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Associated Types

type Dimensions Ix2 :: Nat #

Methods

dimensions :: proxy Ix2 -> Dim #

totalElem :: Sz Ix2 -> Int #

consDim :: Int -> Lower Ix2 -> Ix2 #

unconsDim :: Ix2 -> (Int, Lower Ix2) #

snocDim :: Lower Ix2 -> Int -> Ix2 #

unsnocDim :: Ix2 -> (Lower Ix2, Int) #

pullOutDimM :: MonadThrow m => Ix2 -> Dim -> m (Int, Lower Ix2) #

insertDimM :: MonadThrow m => Lower Ix2 -> Dim -> Int -> m Ix2 #

getDimM :: MonadThrow m => Ix2 -> Dim -> m Int #

setDimM :: MonadThrow m => Ix2 -> Dim -> Int -> m Ix2 #

modifyDimM :: MonadThrow m => Ix2 -> Dim -> (Int -> Int) -> m (Int, Ix2) #

pureIndex :: Int -> Ix2 #

liftIndex2 :: (Int -> Int -> Int) -> Ix2 -> Ix2 -> Ix2 #

liftIndex :: (Int -> Int) -> Ix2 -> Ix2 #

foldlIndex :: (a -> Int -> a) -> a -> Ix2 -> a #

isSafeIndex :: Sz Ix2 -> Ix2 -> Bool #

toLinearIndex :: Sz Ix2 -> Ix2 -> Ix1 #

toLinearIndexAcc :: Ix1 -> Ix2 -> Ix2 -> Ix1 #

fromLinearIndex :: Sz Ix2 -> Ix1 -> Ix2 #

fromLinearIndexAcc :: Ix2 -> Ix1 -> (Int, Ix2) #

repairIndex :: Sz Ix2 -> Ix2 -> (Sz Int -> Int -> Int) -> (Sz Int -> Int -> Int) -> Ix2 #

iterM :: Monad m => Ix2 -> Ix2 -> Ix2 -> (Int -> Int -> Bool) -> a -> (Ix2 -> a -> m a) -> m a #

iterRowMajorST :: Int -> Scheduler s a -> Ix2 -> Ix2 -> Sz Ix2 -> a -> (a -> ST s (a, a)) -> (Ix2 -> a -> ST s a) -> ST s a #

iterF :: Ix2 -> Ix2 -> Ix2 -> (Int -> Int -> Bool) -> f a -> (Ix2 -> f a -> f a) -> f a #

stepNextMF :: Ix2 -> Ix2 -> Ix2 -> (Int -> Int -> Bool) -> (Maybe Ix2 -> f a) -> f a #

iterTargetRowMajorA_ :: Applicative f => Int -> Int -> Sz Ix2 -> Ix2 -> Ix2 -> (Ix1 -> Ix2 -> f a) -> f () #

iterTargetRowMajorAccM :: Monad m => Int -> Int -> Sz Ix2 -> Ix2 -> Ix2 -> a -> (Ix1 -> Ix2 -> a -> m a) -> m a #

iterTargetRowMajorAccST :: Int -> Int -> Scheduler s a -> Int -> Sz Ix2 -> Ix2 -> Ix2 -> a -> (a -> ST s (a, a)) -> (Ix1 -> Ix2 -> a -> ST s a) -> ST s a #

iterTargetRowMajorAccST_ :: Int -> Int -> Scheduler s () -> Int -> Sz Ix2 -> Ix2 -> Ix2 -> a -> (a -> ST s (a, a)) -> (Ix1 -> Ix2 -> a -> ST s a) -> ST s () #

Random Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

randomR :: RandomGen g => (Ix2, Ix2) -> g -> (Ix2, g) #

random :: RandomGen g => g -> (Ix2, g) #

randomRs :: RandomGen g => (Ix2, Ix2) -> g -> [Ix2] #

randoms :: RandomGen g => g -> [Ix2] #

Uniform Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

uniformM :: StatefulGen g m => g -> m Ix2 #

UniformRange Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Methods

uniformRM :: StatefulGen g m => (Ix2, Ix2) -> g -> m Ix2 #

AxesIndex Ix2 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

PutArray Ix2 Source # 
Instance details

Defined in Telescope.Fits.Encoding.DataArray

Methods

putArray :: (Source r a, Stream r Ix1 a, PutPix a, Prim a) => Array r Ix2 a -> Put Source #

Unbox Ix2

Unboxing of a Ix2.

Instance details

Defined in Data.Massiv.Core.Index.Ix

Shape L Ix2 
Instance details

Defined in Data.Massiv.Core.List

Vector Vector Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

MVector MVector Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

Load DW Ix2 e 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

makeArray :: Comp -> Sz Ix2 -> (Ix2 -> e) -> Array DW Ix2 e #

makeArrayLinear :: Comp -> Sz Ix2 -> (Int -> e) -> Array DW Ix2 e #

replicate :: Comp -> Sz Ix2 -> e -> Array DW Ix2 e #

iterArrayLinearST_ :: Scheduler s () -> Array DW Ix2 e -> (Int -> e -> ST s ()) -> ST s () #

iterArrayLinearWithSetST_ :: Scheduler s () -> Array DW Ix2 e -> (Ix1 -> e -> ST s ()) -> (Ix1 -> Sz1 -> e -> ST s ()) -> ST s () #

unsafeLoadIntoST :: Manifest r' e => MVector s r' e -> Array DW Ix2 e -> ST s (MArray s r' Ix2 e) #

unsafeLoadIntoIO :: Manifest r' e => MVector RealWorld r' e -> Array DW Ix2 e -> IO (MArray RealWorld r' Ix2 e) #

Ragged L Ix2 e 
Instance details

Defined in Data.Massiv.Core.List

Methods

generateRaggedM :: Monad m => Comp -> Sz Ix2 -> (Ix2 -> m e) -> m (Array L Ix2 e)

flattenRagged :: Array L Ix2 e -> Vector L e

loadRaggedST :: Scheduler s () -> Array L Ix2 e -> (Ix1 -> e -> ST s ()) -> Ix1 -> Ix1 -> Sz Ix2 -> ST s ()

raggedFormat :: (e -> String) -> String -> Array L Ix2 e -> String

StrideLoad DW Ix2 e 
Instance details

Defined in Data.Massiv.Array.Delayed.Windowed

Methods

iterArrayLinearWithStrideST_ :: Scheduler s () -> Stride Ix2 -> Sz Ix2 -> Array DW Ix2 e -> (Int -> e -> ST s ()) -> ST s () #

type Dimensions Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

type Dimensions Ix2 = 2
type Lower Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

type Lower Ix2 = Ix1
newtype Vector Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

newtype Vector Ix2 = V_Ix2 (Vector (Int, Int))
newtype MVector s Ix2 
Instance details

Defined in Data.Massiv.Core.Index.Ix

newtype MVector s Ix2 = MV_Ix2 (MVector s (Int, Int))

type Ix3 = IxN 3 #

3-dimensional type synonym. Useful as a alternative to enabling DataKinds and using type level Nats.

Since: massiv-0.1.0

type Ix4 = IxN 4 #

4-dimensional type synonym.

Since: massiv-0.1.0

type Ix5 = IxN 5 #

5-dimensional type synonym.

Since: massiv-0.1.0

size :: Size r => Array r ix e -> Sz ix #

O(1) - Get the exact size of an immutabe array. Most of the time will produce the size in constant time, except for DS representation, which could result in evaluation of the whole stream. See maxLinearSize and slength for more info.

Since: massiv-0.1.0

(!>) :: forall r ix e. (HasCallStack, Index ix, Index (Lower ix), Source r e) => Array r ix e -> Int -> Array r (Lower ix) e infixl 4 #

O(1) - Slices the array from the outside. For 2-dimensional array this will be equivalent of taking a row. Throws an error when index is out of bounds.

Examples

Expand

You could say that slicing from outside is synonymous to slicing from the end or slicing at the highermost dimension. For example with rank-3 arrays outer slice would be equivalent to getting a page:

>>> import Data.Massiv.Array
>>> arr = makeArrayR U Seq (Sz (3 :> 2 :. 4)) fromIx3
>>> arr
Array U Seq (Sz (3 :> 2 :. 4))
  [ [ [ (0,0,0), (0,0,1), (0,0,2), (0,0,3) ]
    , [ (0,1,0), (0,1,1), (0,1,2), (0,1,3) ]
    ]
  , [ [ (1,0,0), (1,0,1), (1,0,2), (1,0,3) ]
    , [ (1,1,0), (1,1,1), (1,1,2), (1,1,3) ]
    ]
  , [ [ (2,0,0), (2,0,1), (2,0,2), (2,0,3) ]
    , [ (2,1,0), (2,1,1), (2,1,2), (2,1,3) ]
    ]
  ]
>>> arr !> 2
Array U Seq (Sz (2 :. 4))
  [ [ (2,0,0), (2,0,1), (2,0,2), (2,0,3) ]
  , [ (2,1,0), (2,1,1), (2,1,2), (2,1,3) ]
  ]

There is nothing wrong with chaining, mixing and matching slicing operators:

>>> arr !> 2 !> 0 ! 3
(2,0,3)
>>> evaluateM (arr !> 2 <! 3) 0
(2,0,3)
>>> (arr !> 2 !> 0 ! 3) == (arr ! 2 :> 0 :. 3)
True

Since: massiv-0.1.0

(!?>) :: forall r ix e m. (MonadThrow m, Index ix, Index (Lower ix), Source r e) => Array r ix e -> Int -> m (Array r (Lower ix) e) infixl 4 #

O(1) - Just like !> slices the array from the outside, but returns Nothing when index is out of bounds.

Since: massiv-0.1.0

(<!) :: forall r ix e. (HasCallStack, Index ix, Source r e) => Array r ix e -> Int -> Array D (Lower ix) e infixl 4 #

O(1) - Similarly to (!>) slice an array from an opposite direction.

Since: massiv-0.1.0

(<!?) :: forall r ix e m. (MonadThrow m, Index ix, Source r e) => Array r ix e -> Int -> m (Array D (Lower ix) e) infixl 4 #

O(1) - Safe slice from the inside

Since: massiv-0.1.0

(<!>) :: forall r ix e. (HasCallStack, Index ix, Index (Lower ix), Source r e) => Array r ix e -> (Dim, Int) -> Array D (Lower ix) e infixl 4 #

O(1) - Slices the array in any available dimension. Throws an error when index is out of bounds or dimensions is invalid.

Since: massiv-0.1.0

newtype Dim #

A way to select Array dimension at a value level.

Since: massiv-0.1.0

Constructors

Dim 

Fields

Instances

Instances details
Enum Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

succ :: Dim -> Dim #

pred :: Dim -> Dim #

toEnum :: Int -> Dim #

fromEnum :: Dim -> Int #

enumFrom :: Dim -> [Dim] #

enumFromThen :: Dim -> Dim -> [Dim] #

enumFromTo :: Dim -> Dim -> [Dim] #

enumFromThenTo :: Dim -> Dim -> Dim -> [Dim] #

Num Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

(+) :: Dim -> Dim -> Dim #

(-) :: Dim -> Dim -> Dim #

(*) :: Dim -> Dim -> Dim #

negate :: Dim -> Dim #

abs :: Dim -> Dim #

signum :: Dim -> Dim #

fromInteger :: Integer -> Dim #

Integral Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

quot :: Dim -> Dim -> Dim #

rem :: Dim -> Dim -> Dim #

div :: Dim -> Dim -> Dim #

mod :: Dim -> Dim -> Dim #

quotRem :: Dim -> Dim -> (Dim, Dim) #

divMod :: Dim -> Dim -> (Dim, Dim) #

toInteger :: Dim -> Integer #

Real Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

toRational :: Dim -> Rational #

Show Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

showsPrec :: Int -> Dim -> ShowS #

show :: Dim -> String #

showList :: [Dim] -> ShowS #

NFData Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

rnf :: Dim -> () #

Eq Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

(==) :: Dim -> Dim -> Bool #

(/=) :: Dim -> Dim -> Bool #

Ord Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

compare :: Dim -> Dim -> Ordering #

(<) :: Dim -> Dim -> Bool #

(<=) :: Dim -> Dim -> Bool #

(>) :: Dim -> Dim -> Bool #

(>=) :: Dim -> Dim -> Bool #

max :: Dim -> Dim -> Dim #

min :: Dim -> Dim -> Dim #

Random Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

randomR :: RandomGen g => (Dim, Dim) -> g -> (Dim, g) #

random :: RandomGen g => g -> (Dim, g) #

randomRs :: RandomGen g => (Dim, Dim) -> g -> [Dim] #

randoms :: RandomGen g => g -> [Dim] #

Uniform Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

uniformM :: StatefulGen g m => g -> m Dim #

UniformRange Dim 
Instance details

Defined in Data.Massiv.Core.Index.Internal

Methods

uniformRM :: StatefulGen g m => (Dim, Dim) -> g -> m Dim #