-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Arrays where the index type is a function of the shape type
--
-- Arrays from the basic array package are already very powerful
-- compared with arrays in other languages. They may have any number of
-- dimensions, are type safe and defined in a uniform way using the Ix
-- class with free choice of the lower bounds (0, 1, or whatever you
-- like).
--
-- This package goes one step further: The shape and the index type are
-- different, but the index type is a type function of the shape type.
-- This offers much more flexibility and type safety.
--
-- Some examples are:
--
--
-- - Range: Allow dynamic choice of lower and upper array
-- bounds such as in the Arrays from the array package.
-- You can combine it with other shapes in other dimensions. It allows
-- you to describe the bounds of each dimension individually.
-- - Shifted: Describe array bounds by start index and length.
-- It is sometimes more natural to use these parameters. E.g. a
-- non-negative index type like Word cannot represent -1
-- and thus cannot encode an empty range starting with index
-- 0.
-- - ZeroBased, OneBased: Arrays with fixed lower bound,
-- either 0 or 1, respectively.
-- - (:+:): The Append type constructor allows to respresent
-- block arrays, e.g. block matrices.
-- - Enumeration: Arrays with indices like LT,
-- EQ, GT and dummy shape.
-- - Set: Use an arbitrary ordered set as index set.
-- - Triangular: A 2D array with the shape of lower or upper
-- triangular matrix.
--
--
-- The lapack package defines even more fancy shapes like tall
-- rectangular matrices, triangular matrices and banded matrices.
@package comfort-array
@version 0.3.1
module Data.Array.Comfort.Shape
class C sh
size :: C sh => sh -> Int
uncheckedSize :: C sh => sh -> Int
class C sh => Indexed sh where {
type family Index sh :: *;
}
indices :: Indexed sh => sh -> [Index sh]
offset :: Indexed sh => sh -> Index sh -> Int
uncheckedOffset :: Indexed sh => sh -> Index sh -> Int
inBounds :: Indexed sh => sh -> Index sh -> Bool
sizeOffset :: Indexed sh => sh -> (Int, Index sh -> Int)
uncheckedSizeOffset :: Indexed sh => sh -> (Int, Index sh -> Int)
class Indexed sh => InvIndexed sh
-- | It should hold indexFromOffset sh k == indices sh !! k, but
-- indexFromOffset should generally be faster.
indexFromOffset :: InvIndexed sh => sh -> Int -> Index sh
uncheckedIndexFromOffset :: InvIndexed sh => sh -> Int -> Index sh
-- | ZeroBased denotes a range starting at zero and has a certain
-- length.
newtype ZeroBased n
ZeroBased :: n -> ZeroBased n
[zeroBasedSize] :: ZeroBased n -> n
-- | OneBased denotes a range starting at one and has a certain
-- length.
newtype OneBased n
OneBased :: n -> OneBased n
[oneBasedSize] :: OneBased n -> n
-- | Range denotes an inclusive range like those of the Haskell 98
-- standard Array type from the array package. E.g. the
-- shape type (Range Int32, Range Int64) is equivalent to the ix
-- type (Int32, Int64) for Arrays.
data Range n
Range :: n -> Range n
[rangeFrom, rangeTo] :: Range n -> n
-- | Shifted denotes a range defined by the start index and the
-- length.
data Shifted n
Shifted :: n -> Shifted n
[shiftedOffset, shiftedSize] :: Shifted n -> n
-- | Enumeration denotes a shape of fixed size that is defined by
-- Enum and Bounded methods. For correctness it is
-- necessary that the Enum and Bounded instances are
-- properly implemented. Automatically derived instances are fine.
data Enumeration n
Enumeration :: Enumeration n
-- | This data type wraps another array shape. Its index type is a wrapped
-- Int. The advantages are: No conversion forth and back
-- Int and Index sh. You can convert once using
-- deferIndex and revealIndex whenever you need your
-- application specific index type. No need for e.g. Storable (Index
-- sh), because Int is already Storable.
newtype Deferred sh
Deferred :: sh -> Deferred sh
data DeferredIndex ix
deferIndex :: (Indexed sh, Index sh ~ ix) => sh -> ix -> DeferredIndex ix
revealIndex :: (InvIndexed sh, Index sh ~ ix) => sh -> DeferredIndex ix -> ix
data sh0 :+: sh1
(:+:) :: sh0 -> sh1 -> (:+:) sh0 sh1
infixr 5 :+:
infixr 5 :+:
data Triangular part size
Triangular :: part -> size -> Triangular part size
[triangularPart] :: Triangular part size -> part
[triangularSize] :: Triangular part size -> size
data Lower
Lower :: Lower
data Upper
Upper :: Upper
type LowerTriangular = Triangular Lower
type UpperTriangular = Triangular Upper
lowerTriangular :: size -> LowerTriangular size
upperTriangular :: size -> UpperTriangular size
triangleSize :: Int -> Int
triangleRoot :: Floating a => a -> a
instance (GHC.Show.Show sh0, GHC.Show.Show sh1) => GHC.Show.Show (sh0 Data.Array.Comfort.Shape.:+: sh1)
instance (GHC.Classes.Eq sh0, GHC.Classes.Eq sh1) => GHC.Classes.Eq (sh0 Data.Array.Comfort.Shape.:+: sh1)
instance (GHC.Show.Show part, GHC.Show.Show size) => GHC.Show.Show (Data.Array.Comfort.Shape.Triangular part size)
instance (GHC.Classes.Eq part, GHC.Classes.Eq size) => GHC.Classes.Eq (Data.Array.Comfort.Shape.Triangular part size)
instance GHC.Show.Show Data.Array.Comfort.Shape.Upper
instance GHC.Classes.Eq Data.Array.Comfort.Shape.Upper
instance GHC.Show.Show Data.Array.Comfort.Shape.Lower
instance GHC.Classes.Eq Data.Array.Comfort.Shape.Lower
instance GHC.Show.Show (Data.Array.Comfort.Shape.DeferredIndex ix)
instance GHC.Classes.Eq (Data.Array.Comfort.Shape.DeferredIndex ix)
instance GHC.Show.Show sh => GHC.Show.Show (Data.Array.Comfort.Shape.Deferred sh)
instance GHC.Classes.Eq sh => GHC.Classes.Eq (Data.Array.Comfort.Shape.Deferred sh)
instance GHC.Show.Show (Data.Array.Comfort.Shape.Enumeration n)
instance GHC.Classes.Eq (Data.Array.Comfort.Shape.Enumeration n)
instance GHC.Show.Show n => GHC.Show.Show (Data.Array.Comfort.Shape.Shifted n)
instance GHC.Classes.Eq n => GHC.Classes.Eq (Data.Array.Comfort.Shape.Shifted n)
instance GHC.Show.Show n => GHC.Show.Show (Data.Array.Comfort.Shape.Range n)
instance GHC.Classes.Eq n => GHC.Classes.Eq (Data.Array.Comfort.Shape.Range n)
instance GHC.Show.Show n => GHC.Show.Show (Data.Array.Comfort.Shape.OneBased n)
instance GHC.Classes.Eq n => GHC.Classes.Eq (Data.Array.Comfort.Shape.OneBased n)
instance GHC.Show.Show n => GHC.Show.Show (Data.Array.Comfort.Shape.ZeroBased n)
instance GHC.Classes.Eq n => GHC.Classes.Eq (Data.Array.Comfort.Shape.ZeroBased n)
instance (Control.DeepSeq.NFData sh0, Control.DeepSeq.NFData sh1) => Control.DeepSeq.NFData (sh0 Data.Array.Comfort.Shape.:+: sh1)
instance (Data.Array.Comfort.Shape.C sh0, Data.Array.Comfort.Shape.C sh1) => Data.Array.Comfort.Shape.C (sh0 Data.Array.Comfort.Shape.:+: sh1)
instance (Data.Array.Comfort.Shape.Indexed sh0, Data.Array.Comfort.Shape.Indexed sh1) => Data.Array.Comfort.Shape.Indexed (sh0 Data.Array.Comfort.Shape.:+: sh1)
instance (Data.Array.Comfort.Shape.InvIndexed sh0, Data.Array.Comfort.Shape.InvIndexed sh1) => Data.Array.Comfort.Shape.InvIndexed (sh0 Data.Array.Comfort.Shape.:+: sh1)
instance (Data.Array.Comfort.Shape.TriangularPart part, Control.DeepSeq.NFData size) => Control.DeepSeq.NFData (Data.Array.Comfort.Shape.Triangular part size)
instance (Data.Array.Comfort.Shape.TriangularPart part, Data.Array.Comfort.Shape.C size) => Data.Array.Comfort.Shape.C (Data.Array.Comfort.Shape.Triangular part size)
instance (Data.Array.Comfort.Shape.TriangularPart part, Data.Array.Comfort.Shape.Indexed size) => Data.Array.Comfort.Shape.Indexed (Data.Array.Comfort.Shape.Triangular part size)
instance (Data.Array.Comfort.Shape.TriangularPart part, Data.Array.Comfort.Shape.InvIndexed size) => Data.Array.Comfort.Shape.InvIndexed (Data.Array.Comfort.Shape.Triangular part size)
instance Data.Array.Comfort.Shape.TriangularPart Data.Array.Comfort.Shape.Lower
instance Data.Array.Comfort.Shape.TriangularPart Data.Array.Comfort.Shape.Upper
instance Data.Array.Comfort.Shape.C sh => Data.Array.Comfort.Shape.Indexed (Data.Array.Comfort.Shape.Deferred sh)
instance Data.Array.Comfort.Shape.C sh => Data.Array.Comfort.Shape.InvIndexed (Data.Array.Comfort.Shape.Deferred sh)
instance Foreign.Storable.Storable (Data.Array.Comfort.Shape.DeferredIndex ix)
instance Control.DeepSeq.NFData sh => Control.DeepSeq.NFData (Data.Array.Comfort.Shape.Deferred sh)
instance Data.Array.Comfort.Shape.C sh => Data.Array.Comfort.Shape.C (Data.Array.Comfort.Shape.Deferred sh)
instance Control.DeepSeq.NFData (Data.Array.Comfort.Shape.Enumeration n)
instance (GHC.Enum.Enum n, GHC.Enum.Bounded n) => Data.Array.Comfort.Shape.C (Data.Array.Comfort.Shape.Enumeration n)
instance (GHC.Enum.Enum n, GHC.Enum.Bounded n) => Data.Array.Comfort.Shape.Indexed (Data.Array.Comfort.Shape.Enumeration n)
instance (GHC.Enum.Enum n, GHC.Enum.Bounded n) => Data.Array.Comfort.Shape.InvIndexed (Data.Array.Comfort.Shape.Enumeration n)
instance Foreign.Storable.Storable (Data.Array.Comfort.Shape.Enumeration n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.Indexed (Data.Array.Comfort.Shape.ZeroBased n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.Indexed (Data.Array.Comfort.Shape.OneBased n)
instance GHC.Base.Functor Data.Array.Comfort.Shape.Shifted
instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Data.Array.Comfort.Shape.Shifted n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.C (Data.Array.Comfort.Shape.Shifted n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.Indexed (Data.Array.Comfort.Shape.Shifted n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.InvIndexed (Data.Array.Comfort.Shape.Shifted n)
instance Foreign.Storable.Storable n => Foreign.Storable.Storable (Data.Array.Comfort.Shape.Shifted n)
instance GHC.Base.Functor Data.Array.Comfort.Shape.Range
instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Data.Array.Comfort.Shape.Range n)
instance GHC.Arr.Ix n => Data.Array.Comfort.Shape.C (Data.Array.Comfort.Shape.Range n)
instance GHC.Arr.Ix n => Data.Array.Comfort.Shape.Indexed (Data.Array.Comfort.Shape.Range n)
instance GHC.Arr.Ix n => Data.Array.Comfort.Shape.InvIndexed (Data.Array.Comfort.Shape.Range n)
instance Foreign.Storable.Storable n => Foreign.Storable.Storable (Data.Array.Comfort.Shape.Range n)
instance GHC.Base.Functor Data.Array.Comfort.Shape.OneBased
instance GHC.Base.Applicative Data.Array.Comfort.Shape.OneBased
instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Data.Array.Comfort.Shape.OneBased n)
instance Foreign.Storable.Storable n => Foreign.Storable.Storable (Data.Array.Comfort.Shape.OneBased n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.C (Data.Array.Comfort.Shape.OneBased n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.InvIndexed (Data.Array.Comfort.Shape.OneBased n)
instance GHC.Base.Functor Data.Array.Comfort.Shape.ZeroBased
instance GHC.Base.Applicative Data.Array.Comfort.Shape.ZeroBased
instance Control.DeepSeq.NFData n => Control.DeepSeq.NFData (Data.Array.Comfort.Shape.ZeroBased n)
instance Foreign.Storable.Storable n => Foreign.Storable.Storable (Data.Array.Comfort.Shape.ZeroBased n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.C (Data.Array.Comfort.Shape.ZeroBased n)
instance GHC.Real.Integral n => Data.Array.Comfort.Shape.InvIndexed (Data.Array.Comfort.Shape.ZeroBased n)
instance Data.Array.Comfort.Shape.InvIndexed ()
instance GHC.Classes.Ord n => Data.Array.Comfort.Shape.InvIndexed (Data.Set.Internal.Set n)
instance (Data.Array.Comfort.Shape.InvIndexed sh0, Data.Array.Comfort.Shape.InvIndexed sh1) => Data.Array.Comfort.Shape.InvIndexed (sh0, sh1)
instance (Data.Array.Comfort.Shape.InvIndexed sh0, Data.Array.Comfort.Shape.InvIndexed sh1, Data.Array.Comfort.Shape.InvIndexed sh2) => Data.Array.Comfort.Shape.InvIndexed (sh0, sh1, sh2)
instance Data.Array.Comfort.Shape.Indexed ()
instance GHC.Classes.Ord n => Data.Array.Comfort.Shape.Indexed (Data.Set.Internal.Set n)
instance (Data.Array.Comfort.Shape.Indexed sh0, Data.Array.Comfort.Shape.Indexed sh1) => Data.Array.Comfort.Shape.Indexed (sh0, sh1)
instance (Data.Array.Comfort.Shape.Indexed sh0, Data.Array.Comfort.Shape.Indexed sh1, Data.Array.Comfort.Shape.Indexed sh2) => Data.Array.Comfort.Shape.Indexed (sh0, sh1, sh2)
instance Data.Array.Comfort.Shape.C ()
instance GHC.Classes.Ord n => Data.Array.Comfort.Shape.C (Data.Set.Internal.Set n)
instance (Data.Array.Comfort.Shape.C sh0, Data.Array.Comfort.Shape.C sh1) => Data.Array.Comfort.Shape.C (sh0, sh1)
instance (Data.Array.Comfort.Shape.C sh0, Data.Array.Comfort.Shape.C sh1, Data.Array.Comfort.Shape.C sh2) => Data.Array.Comfort.Shape.C (sh0, sh1, sh2)
module Data.Array.Comfort.Shape.Test
tests :: (InvIndexed sh, Show sh, Index sh ~ ix, Eq ix, Show ix) => Gen sh -> [(String, Property)]
module Data.Array.Comfort.Boxed
data Array sh a
shape :: Array sh a -> sh
(!) :: Indexed sh => Array sh a -> Index sh -> a
infixl 9 !
toList :: C sh => Array sh a -> [a]
toAssociations :: Indexed sh => Array sh a -> [(Index sh, a)]
fromList :: C sh => sh -> [a] -> Array sh a
fromMap :: Ord k => Map k a -> Array (Set k) a
vectorFromList :: [a] -> Array (ZeroBased Int) a
indices :: Indexed sh => sh -> Array sh (Index sh)
map :: C sh => (a -> b) -> Array sh a -> Array sh b
zipWith :: (C sh, Eq sh) => (a -> b -> c) -> Array sh a -> Array sh b -> Array sh c
(//) :: Indexed sh => Array sh a -> [(Index sh, a)] -> Array sh a
accumulate :: Indexed sh => (a -> b -> a) -> Array sh a -> [(Index sh, b)] -> Array sh a
fromAssociations :: Indexed sh => sh -> a -> [(Index sh, a)] -> Array sh a
module Data.Array.Comfort.Storable.Mutable.Private
data Array (m :: * -> *) sh a
Array :: sh -> MutablePtr a -> Array sh a
[shape] :: Array sh a -> sh
[buffer] :: Array sh a -> MutablePtr a
type STArray s = Array (ST s)
type IOArray = Array IO
copy :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m (Array m sh a)
create :: (C sh, Storable a) => sh -> (Ptr a -> IO ()) -> IO (IOArray sh a)
createWithSize :: (C sh, Storable a) => sh -> (Int -> Ptr a -> IO ()) -> IO (IOArray sh a)
createWithSizeAndResult :: (C sh, Storable a) => sh -> (Int -> Ptr a -> IO b) -> IO (IOArray sh a, b)
unsafeCreate :: (PrimMonad m, C sh, Storable a) => sh -> (Ptr a -> IO ()) -> m (Array m sh a)
unsafeCreateWithSize :: (PrimMonad m, C sh, Storable a) => sh -> (Int -> Ptr a -> IO ()) -> m (Array m sh a)
unsafeCreateWithSizeAndResult :: (PrimMonad m, C sh, Storable a) => sh -> (Int -> Ptr a -> IO b) -> m (Array m sh a, b)
unsafeArrayIOToPrim :: PrimMonad m => IOArray sh a -> Array m sh a
show :: (PrimMonad m, C sh, Show sh, Storable a, Show a) => Array m sh a -> m String
withArrayPtr :: PrimMonad m => MutablePtr a -> (Ptr a -> IO b) -> m b
withPtr :: PrimMonad m => Array m sh a -> (Ptr a -> IO b) -> m b
read :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> m a
write :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> a -> m ()
update :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> (a -> a) -> m ()
new :: (PrimMonad m, C sh, Storable a) => sh -> a -> m (Array m sh a)
toList :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m [a]
fromList :: (PrimMonad m, C sh, Storable a) => sh -> [a] -> m (Array m sh a)
vectorFromList :: (PrimMonad m, Storable a) => [a] -> m (Array m (ZeroBased Int) a)
module Data.Array.Comfort.Storable.Private
data Array sh a
Array :: sh -> ForeignPtr a -> Array sh a
[shape] :: Array sh a -> sh
[buffer] :: Array sh a -> ForeignPtr a
reshape :: sh1 -> Array sh0 a -> Array sh1 a
mapShape :: (sh0 -> sh1) -> Array sh0 a -> Array sh1 a
(!) :: (Indexed sh, Storable a) => Array sh a -> Index sh -> a
infixl 9 !
toList :: (C sh, Storable a) => Array sh a -> [a]
fromList :: (C sh, Storable a) => sh -> [a] -> Array sh a
vectorFromList :: Storable a => [a] -> Array (ZeroBased Int) a
(//) :: (Indexed sh, Storable a) => Array sh a -> [(Index sh, a)] -> Array sh a
accumulate :: (Indexed sh, Storable a) => (a -> b -> a) -> Array sh a -> [(Index sh, b)] -> Array sh a
fromAssociations :: (Indexed sh, Storable a) => sh -> a -> [(Index sh, a)] -> Array sh a
freeze :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m (Array sh a)
thaw :: (PrimMonad m, C sh, Storable a) => Array sh a -> m (Array m sh a)
unsafeFreeze :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m (Array sh a)
unsafeThaw :: (PrimMonad m, C sh, Storable a) => Array sh a -> m (Array m sh a)
instance (Data.Array.Comfort.Shape.C sh, GHC.Show.Show sh, Foreign.Storable.Storable a, GHC.Show.Show a) => GHC.Show.Show (Data.Array.Comfort.Storable.Private.Array sh a)
instance Control.DeepSeq.NFData sh => Control.DeepSeq.NFData (Data.Array.Comfort.Storable.Private.Array sh a)
-- | The functions in this module miss any bound checking.
module Data.Array.Comfort.Storable.Mutable.Unchecked
data Array (m :: * -> *) sh a
Array :: sh -> MutablePtr a -> Array sh a
[shape] :: Array sh a -> sh
[buffer] :: Array sh a -> MutablePtr a
type STArray s = Array (ST s)
type IOArray = Array IO
new :: (PrimMonad m, C sh, Storable a) => sh -> a -> m (Array m sh a)
copy :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m (Array m sh a)
create :: (C sh, Storable a) => sh -> (Ptr a -> IO ()) -> IO (IOArray sh a)
createWithSize :: (C sh, Storable a) => sh -> (Int -> Ptr a -> IO ()) -> IO (IOArray sh a)
createWithSizeAndResult :: (C sh, Storable a) => sh -> (Int -> Ptr a -> IO b) -> IO (IOArray sh a, b)
unsafeCreate :: (PrimMonad m, C sh, Storable a) => sh -> (Ptr a -> IO ()) -> m (Array m sh a)
unsafeCreateWithSize :: (PrimMonad m, C sh, Storable a) => sh -> (Int -> Ptr a -> IO ()) -> m (Array m sh a)
unsafeCreateWithSizeAndResult :: (PrimMonad m, C sh, Storable a) => sh -> (Int -> Ptr a -> IO b) -> m (Array m sh a, b)
withPtr :: PrimMonad m => Array m sh a -> (Ptr a -> IO b) -> m b
read :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> m a
write :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> a -> m ()
update :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> (a -> a) -> m ()
toList :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m [a]
fromList :: (PrimMonad m, C sh, Storable a) => sh -> [a] -> m (Array m sh a)
vectorFromList :: (PrimMonad m, Storable a) => [a] -> m (Array m (ZeroBased Int) a)
freeze :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m (Array sh a)
unsafeFreeze :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m (Array sh a)
thaw :: (PrimMonad m, C sh, Storable a) => Array sh a -> m (Array m sh a)
unsafeThaw :: (PrimMonad m, C sh, Storable a) => Array sh a -> m (Array m sh a)
module Data.Array.Comfort.Storable.Mutable
data Array (m :: * -> *) sh a
type STArray s = Array (ST s)
type IOArray = Array IO
shape :: Array m sh a -> sh
new :: (PrimMonad m, C sh, Storable a) => sh -> a -> m (Array m sh a)
read :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> m a
write :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> a -> m ()
update :: (PrimMonad m, Indexed sh, Storable a) => Array m sh a -> Index sh -> (a -> a) -> m ()
toList :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m [a]
fromList :: (PrimMonad m, C sh, Storable a) => sh -> [a] -> m (Array m sh a)
vectorFromList :: (PrimMonad m, Storable a) => [a] -> m (Array m (ZeroBased Int) a)
thaw :: (PrimMonad m, C sh, Storable a) => Array sh a -> m (Array m sh a)
freeze :: (PrimMonad m, C sh, Storable a) => Array m sh a -> m (Array sh a)
module Data.Array.Comfort.Storable.Unchecked.Monadic
unsafeCreate :: (PrimMonad m, C sh, Storable a) => sh -> (Ptr a -> IO ()) -> m (Array sh a)
unsafeCreateWithSize :: (PrimMonad m, C sh, Storable a) => sh -> (Int -> Ptr a -> IO ()) -> m (Array sh a)
unsafeCreateWithSizeAndResult :: (PrimMonad m, C sh, Storable a) => sh -> (Int -> Ptr a -> IO b) -> m (Array sh a, b)
-- | The functions in this module miss any bound checking.
module Data.Array.Comfort.Storable.Unchecked
data Array sh a
Array :: sh -> ForeignPtr a -> Array sh a
[shape] :: Array sh a -> sh
[buffer] :: Array sh a -> ForeignPtr a
reshape :: sh1 -> Array sh0 a -> Array sh1 a
mapShape :: (sh0 -> sh1) -> Array sh0 a -> Array sh1 a
(!) :: (Indexed sh, Storable a) => Array sh a -> Index sh -> a
infixl 9 !
unsafeCreate :: (C sh, Storable a) => sh -> (Ptr a -> IO ()) -> Array sh a
unsafeCreateWithSize :: (C sh, Storable a) => sh -> (Int -> Ptr a -> IO ()) -> Array sh a
unsafeCreateWithSizeAndResult :: (C sh, Storable a) => sh -> (Int -> Ptr a -> IO b) -> (Array sh a, b)
toList :: (C sh, Storable a) => Array sh a -> [a]
fromList :: (C sh, Storable a) => sh -> [a] -> Array sh a
vectorFromList :: Storable a => [a] -> Array (ZeroBased Int) a
map :: (C sh, Storable a, Storable b) => (a -> b) -> Array sh a -> Array sh b
mapWithIndex :: (Indexed sh, Index sh ~ ix, Storable a, Storable b) => (ix -> a -> b) -> Array sh a -> Array sh b
(//) :: (Indexed sh, Storable a) => Array sh a -> [(Index sh, a)] -> Array sh a
accumulate :: (Indexed sh, Storable a) => (a -> b -> a) -> Array sh a -> [(Index sh, b)] -> Array sh a
fromAssociations :: (Indexed sh, Storable a) => sh -> a -> [(Index sh, a)] -> Array sh a
module Data.Array.Comfort.Storable
data Array sh a
shape :: Array sh a -> sh
reshape :: (C sh0, C sh1) => sh1 -> Array sh0 a -> Array sh1 a
mapShape :: (C sh0, C sh1) => (sh0 -> sh1) -> Array sh0 a -> Array sh1 a
(!) :: (Indexed sh, Storable a) => Array sh a -> Index sh -> a
infixl 9 !
toList :: (C sh, Storable a) => Array sh a -> [a]
fromList :: (C sh, Storable a) => sh -> [a] -> Array sh a
fromMap :: (Ord k, Storable a) => Map k a -> Array (Set k) a
vectorFromList :: Storable a => [a] -> Array (ZeroBased Int) a
sample :: (Indexed sh, Storable a) => sh -> (Index sh -> a) -> Array sh a
fromBoxed :: (C sh, Storable a) => Array sh a -> Array sh a
toBoxed :: (C sh, Storable a) => Array sh a -> Array sh a
map :: (C sh, Storable a, Storable b) => (a -> b) -> Array sh a -> Array sh b
mapWithIndex :: (Indexed sh, Index sh ~ ix, Storable a, Storable b) => (ix -> a -> b) -> Array sh a -> Array sh b
(//) :: (Indexed sh, Storable a) => Array sh a -> [(Index sh, a)] -> Array sh a
accumulate :: (Indexed sh, Storable a) => (a -> b -> a) -> Array sh a -> [(Index sh, b)] -> Array sh a
fromAssociations :: (Indexed sh, Storable a) => sh -> a -> [(Index sh, a)] -> Array sh a