comfort-array-0.4.1: Arrays where the index type is a function of the shape type
Safe HaskellNone
LanguageHaskell98

Data.Array.Comfort.Storable

Synopsis

Documentation

data Array sh a Source #

Instances

Instances details
(C sh, Eq sh, Storable a, Eq a) => Eq (Array sh a) Source # 
Instance details

Defined in Data.Array.Comfort.Storable.Private

Methods

(==) :: Array sh a -> Array sh a -> Bool #

(/=) :: Array sh a -> Array sh a -> Bool #

(C sh, Show sh, Storable a, Show a) => Show (Array sh a) Source # 
Instance details

Defined in Data.Array.Comfort.Storable.Private

Methods

showsPrec :: Int -> Array sh a -> ShowS #

show :: Array sh a -> String #

showList :: [Array sh a] -> ShowS #

NFData sh => NFData (Array sh a) Source # 
Instance details

Defined in Data.Array.Comfort.Storable.Private

Methods

rnf :: Array sh a -> () #

shape :: Array sh a -> sh Source #

reshape :: (C sh0, C sh1) => sh1 -> Array sh0 a -> Array sh1 a Source #

mapShape :: (C sh0, C sh1) => (sh0 -> sh1) -> Array sh0 a -> Array sh1 a Source #

(!) :: (Indexed sh, Storable a) => Array sh a -> Index sh -> a infixl 9 Source #

toList :: (C sh, Storable a) => Array sh a -> [a] Source #

toAssociations :: (Indexed sh, Storable a) => Array sh a -> [(Index sh, a)] Source #

fromList :: (C sh, Storable a) => sh -> [a] -> Array sh a Source #

fromMap :: (Ord k, Storable a) => Map k a -> Array (Set k) a Source #

toMap :: (Ord k, Storable a) => Array (Set k) a -> Map k a Source #

fromContainer :: (C f, Storable a) => f a -> Array (Shape f) a Source #

toContainer :: (C f, Storable a) => Array (Shape f) a -> f a Source #

sample :: (Indexed sh, Storable a) => sh -> (Index sh -> a) -> Array sh a Source #

fromBoxed :: (C sh, Storable a) => Array sh a -> Array sh a Source #

toBoxed :: (C sh, Storable a) => Array sh a -> Array sh a Source #

map :: (C sh, Storable a, Storable b) => (a -> b) -> Array sh a -> Array sh b Source #

mapWithIndex :: (Indexed sh, Index sh ~ ix, Storable a, Storable b) => (ix -> a -> b) -> Array sh a -> Array sh b Source #

zipWith :: (C sh, Eq sh, Storable a, Storable b, Storable c) => (a -> b -> c) -> Array sh a -> Array sh b -> Array sh c Source #

(//) :: (Indexed sh, Storable a) => Array sh a -> [(Index sh, a)] -> Array sh a Source #

accumulate :: (Indexed sh, Storable a) => (a -> b -> a) -> Array sh a -> [(Index sh, b)] -> Array sh a Source #

fromAssociations :: (Indexed sh, Storable a) => a -> sh -> [(Index sh, a)] -> Array sh a Source #

singleton :: Storable a => a -> Array () a Source #

\x  ->  Array.singleton x ! () == (x::Word16)

append :: (C shx, C shy, Storable a) => Array shx a -> Array shy a -> Array (shx :+: shy) a Source #

take :: (Integral n, Storable a) => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a Source #

\(QC.NonNegative n) (Array16 x)  ->  x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x))

drop :: (Integral n, Storable a) => n -> Array (ZeroBased n) a -> Array (ZeroBased n) a Source #

\(QC.NonNegative n) (Array16 x)  ->  x == Array.mapShape (Shape.ZeroBased . Shape.size) (Array.append (Array.take n x) (Array.drop n x))

takeLeft :: (C sh0, C sh1, Storable a) => Array (sh0 :+: sh1) a -> Array sh0 a Source #

\(Array16 x) (Array16 y) -> let xy = Array.append x y in x == Array.takeLeft xy  &&  y == Array.takeRight xy

takeRight :: (C sh0, C sh1, Storable a) => Array (sh0 :+: sh1) a -> Array sh1 a Source #

split :: (C sh0, C sh1, Storable a) => Array (sh0 :+: sh1) a -> (Array sh0 a, Array sh1 a) Source #

takeCenter :: (C sh0, C sh1, C sh2, Storable a) => Array (sh0 :+: (sh1 :+: sh2)) a -> Array sh1 a Source #

\(Array16 x) (Array16 y) (Array16 z) -> let xyz = Array.append x $ Array.append y z in y == Array.takeCenter xyz

sum :: (C sh, Storable a, Num a) => Array sh a -> a Source #

\(Array16 xs)  ->  Array.sum xs == sum (Array.toList xs)

product :: (C sh, Storable a, Num a) => Array sh a -> a Source #

\(Array16 xs)  ->  Array.product xs == product (Array.toList xs)

minimum :: (C sh, Storable a, Ord a) => Array sh a -> a Source #

It is a checked error if the vector is empty.

forAllNonEmpty $ \xs -> Array.minimum xs ==? minimum (Array.toList xs)

argMinimum :: (InvIndexed sh, Index sh ~ ix, Storable a, Ord a) => Array sh a -> (ix, a) Source #

maximum :: (C sh, Storable a, Ord a) => Array sh a -> a Source #

It is a checked error if the vector is empty.

forAllNonEmpty $ \xs -> Array.maximum xs ==? maximum (Array.toList xs)

argMaximum :: (InvIndexed sh, Index sh ~ ix, Storable a, Ord a) => Array sh a -> (ix, a) Source #

limits :: (C sh, Storable a, Ord a) => Array sh a -> (a, a) Source #

forAllNonEmpty $ \xs -> Array.limits xs ==? (Array.minimum xs, Array.maximum xs)

foldl :: (C sh, Storable a) => (b -> a -> b) -> b -> Array sh a -> b Source #

foldl1 :: (C sh, Storable a) => (a -> a -> a) -> Array sh a -> a Source #

foldMap :: (C sh, Storable a, Ord a, Semigroup m) => (a -> m) -> Array sh a -> m Source #