-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | core package for Numerical Haskell project -- -- the core package for Numerical Haskell. Still immature and incomplete @package numerical @version 0.0.0.0 module Control.NumericalApplicative.Backwards -- | The same functor, but with an Applicative instance that -- performs actions in the reverse order. newtype Backwards f a Backwards :: f a -> Backwards f a [forwards] :: Backwards f a -> f a (<**>) :: Applicative f => f a -> f (a -> b) -> f b liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c instance GHC.Base.Functor f => GHC.Base.Functor (Control.NumericalApplicative.Backwards.Backwards f) instance GHC.Base.Applicative f => GHC.Base.Applicative (Control.NumericalApplicative.Backwards.Backwards f) instance GHC.Base.Alternative f => GHC.Base.Alternative (Control.NumericalApplicative.Backwards.Backwards f) instance Data.Foldable.Foldable f => Data.Foldable.Foldable (Control.NumericalApplicative.Backwards.Backwards f) instance Data.Traversable.Traversable f => Data.Traversable.Traversable (Control.NumericalApplicative.Backwards.Backwards f) module Control.NumericalMonad.State.Strict -- | Identity functor and monad. newtype Identity a Identity :: a -> Identity a [runIdentity] :: Identity a -> a -- | A state monad parameterized by the type s of the state to -- carry. -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as -- the initial state of the second. type State s = StateT s Identity -- | Construct a state monad computation from a function. (The inverse of -- runState.) state :: Monad m => (s -> (a, s)) -> StateT s m a -- | Unwrap a state monad computation as a function. (The inverse of -- state.) runState :: State s a -> s -> (a, s) -- | Evaluate a state computation with the given initial state and return -- the final value, discarding the final state. -- -- evalState :: State s a -> s -> a -- | Evaluate a state computation with the given initial state and return -- the final state, discarding the final value. -- -- execState :: State s a -> s -> s -- | Map both the return value and final state of a computation using the -- given function. -- -- mapState :: ((a, s) -> (b, s)) -> State s a -> State s b -- | withState f m executes action m on a state -- modified by applying f. -- -- withState :: (s -> s) -> State s a -> State s a -- | A state transformer monad parameterized by: -- -- -- -- The return function leaves the state unchanged, while -- >>= uses the final state of the first computation as -- the initial state of the second. newtype StateT s m a StateT :: (s -> m (a, s)) -> StateT s m a [runStateT] :: StateT s m a -> s -> m (a, s) -- | Evaluate a state computation with the given initial state and return -- the final value, discarding the final state. -- -- evalStateT :: Monad m => StateT s m a -> s -> m a -- | Evaluate a state computation with the given initial state and return -- the final state, discarding the final value. -- -- execStateT :: Monad m => StateT s m a -> s -> m s -- | Map both the return value and final state of a computation using the -- given function. -- -- mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b -- | withStateT f m executes action m on a state -- modified by applying f. -- -- withStateT :: (s -> s) -> StateT s m a -> StateT s m a -- | Fetch the current value of the state within the monad. get :: Monad m => StateT s m s -- | put s sets the state within the monad to s. put :: Monad m => s -> StateT s m () -- | modify f is an action that updates the state to the -- result of applying f to the current state. -- -- modify :: Monad m => (s -> s) -> StateT s m () -- | A variant of modify in which the computation is strict in the -- new state. -- -- modify' :: Monad m => (s -> s) -> StateT s m () -- | Get a specific component of the state, using a projection function -- supplied. -- -- gets :: Monad m => (s -> a) -> StateT s m a instance GHC.Base.Functor m => GHC.Base.Functor (Control.NumericalMonad.State.Strict.StateT s m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Control.NumericalMonad.State.Strict.StateT s m) instance (GHC.Base.Functor m, GHC.Base.MonadPlus m) => GHC.Base.Alternative (Control.NumericalMonad.State.Strict.StateT s m) instance GHC.Base.Monad m => GHC.Base.Monad (Control.NumericalMonad.State.Strict.StateT s m) instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.NumericalMonad.State.Strict.StateT s m) instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Control.NumericalMonad.State.Strict.StateT s m) instance Control.Monad.Trans.Class.MonadTrans (Control.NumericalMonad.State.Strict.StateT s) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.NumericalMonad.State.Strict.StateT s m) instance GHC.Base.Functor Control.NumericalMonad.State.Strict.Identity instance Data.Foldable.Foldable Control.NumericalMonad.State.Strict.Identity instance Data.Traversable.Traversable Control.NumericalMonad.State.Strict.Identity instance GHC.Base.Applicative Control.NumericalMonad.State.Strict.Identity instance GHC.Base.Monad Control.NumericalMonad.State.Strict.Identity instance Control.Monad.Fix.MonadFix Control.NumericalMonad.State.Strict.Identity module Numerical.Array module Numerical.Array.Address -- | Address is the type used for addressing into the underlying -- memory buffers of numerical arrays, Used for Dense Rank n arrays, and -- 1dim sparse arrays. newtype Address Address :: Int -> Address -- | this m newtype LogicalExtent sparse address seems to be dead atm data SparseAddress SparseAddress :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> SparseAddress [outerIndex] :: SparseAddress -> {-# UNPACK #-} !Int [innerIndex] :: SparseAddress -> {-# UNPACK #-} !Int instance GHC.Generics.Generic Numerical.Array.Address.SparseAddress instance Data.Data.Data Numerical.Array.Address.SparseAddress instance GHC.Show.Show Numerical.Array.Address.SparseAddress instance GHC.Classes.Eq Numerical.Array.Address.SparseAddress instance Foreign.Storable.Storable Numerical.Array.Address.LogicalAddress instance Data.Data.Data Numerical.Array.Address.LogicalAddress instance GHC.Generics.Generic Numerical.Array.Address.LogicalAddress instance GHC.Read.Read Numerical.Array.Address.LogicalAddress instance GHC.Show.Show Numerical.Array.Address.LogicalAddress instance GHC.Classes.Ord Numerical.Array.Address.LogicalAddress instance GHC.Classes.Eq Numerical.Array.Address.LogicalAddress instance Foreign.Storable.Storable Numerical.Array.Address.Address instance Data.Data.Data Numerical.Array.Address.Address instance GHC.Generics.Generic Numerical.Array.Address.Address instance GHC.Read.Read Numerical.Array.Address.Address instance GHC.Show.Show Numerical.Array.Address.Address instance GHC.Classes.Ord Numerical.Array.Address.Address instance GHC.Classes.Eq Numerical.Array.Address.Address instance GHC.Num.Num Numerical.Array.Address.Address instance Data.Vector.Unboxed.Base.Unbox Numerical.Array.Address.Address instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector Numerical.Array.Address.Address instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector Numerical.Array.Address.Address module Numerical.Array.Locality data Locality Contiguous :: Locality Strided :: Locality InnerContiguous :: Locality type family LocalityMax (a :: Locality) (b :: Locality) :: Locality type family LocalityMin (a :: Locality) (b :: Locality) :: Locality instance Data.Data.Data Numerical.Array.Locality.Locality instance GHC.Read.Read Numerical.Array.Locality.Locality instance GHC.Show.Show Numerical.Array.Locality.Locality instance GHC.Classes.Eq Numerical.Array.Locality.Locality module Numerical.Array.Range -- | whenever you are tempted to do a (lo,hi) tuple, use this instead This -- should perhaps be made lazy, but strict for now. data Range a Range :: !a -> !a -> Range a [_RangeMin] :: Range a -> !a [_RangeMax] :: Range a -> !a -- | this is uniform address interval by any other name data AffineRange a AffineRange :: !a -> !Int -> !a -> AffineRange a [_AffineRangeMin] :: AffineRange a -> !a [_AffineRangeStride] :: AffineRange a -> !Int [_AffineRangeMax] :: AffineRange a -> !a class HasRange r a | r -> a rangeMin :: (HasRange r a, Functor f) => (a -> f a) -> r -> f r rangeMax :: (HasRange r a, Functor f) => (a -> f a) -> r -> f r affineRangeStride :: Functor f => (Int -> f Int) -> AffineRange a -> f (AffineRange a) instance Data.Traversable.Traversable Numerical.Array.Range.AffineRange instance Data.Foldable.Foldable Numerical.Array.Range.AffineRange instance GHC.Base.Functor Numerical.Array.Range.AffineRange instance GHC.Generics.Generic (Numerical.Array.Range.AffineRange a) instance Data.Data.Data a => Data.Data.Data (Numerical.Array.Range.AffineRange a) instance GHC.Show.Show a => GHC.Show.Show (Numerical.Array.Range.AffineRange a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Numerical.Array.Range.AffineRange a) instance GHC.Base.Functor Numerical.Array.Range.Range instance Data.Traversable.Traversable Numerical.Array.Range.Range instance Data.Foldable.Foldable Numerical.Array.Range.Range instance GHC.Generics.Generic (Numerical.Array.Range.Range a) instance Data.Data.Data a => Data.Data.Data (Numerical.Array.Range.Range a) instance GHC.Show.Show a => GHC.Show.Show (Numerical.Array.Range.Range a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Numerical.Array.Range.Range a) instance Numerical.Array.Range.HasRange (Numerical.Array.Range.AffineRange a) a instance Numerical.Array.Range.HasRange (Numerical.Array.Range.Range a) a module Numerical.Array.Storage -- | Boxed is the type index for Buffers that use the boxed -- data structure Vector as the underlying storage representation. data Boxed -- | Unboxed is the type index for Buffers that use the -- unboxed data structure Vector as the underlying storage -- representation. data Unboxed -- | Stored is the type index for Buffers that use the -- Storable for values, in pinned byte array buffers, provided by -- Storable data Stored data family BufferPure sort elem data family BufferMut sort st elem -- | The class instance Buffer mode a is a shorthand for -- saying that a given buffer representation mode has a -- Vector instance for both BufferPure and -- BufferMut. class (Vector (BufferPure mode) a, MVector (BufferMut mode) a) => Buffer mode a class MVector (BufferMut mode) a => MBuffer mode a unsafeBufferThaw :: (Buffer rep a, PrimMonad m) => BufferPure rep a -> m (BufferMut rep (PrimState m) a) -- | unsafeBufferFreeze unsafeBufferFreeze :: (Buffer rep a, PrimMonad m) => BufferMut rep (PrimState m) a -> m (BufferPure rep a) instance Data.Traversable.Traversable (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Boxed) instance Data.Foldable.Foldable (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Boxed) instance GHC.Base.Functor (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Boxed) instance GHC.Generics.Generic (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Boxed elem) instance Data.Data.Data elem => Data.Data.Data (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Boxed elem) instance GHC.Show.Show elem => GHC.Show.Show (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Boxed elem) instance GHC.Generics.Generic (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Unboxed elem) instance (Data.Data.Data elem, Data.Vector.Unboxed.Base.Unbox elem) => Data.Data.Data (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Unboxed elem) instance (GHC.Show.Show elem, Data.Vector.Unboxed.Base.Unbox elem) => GHC.Show.Show (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Unboxed elem) instance GHC.Generics.Generic (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Stored elem) instance (Data.Data.Data elem, Foreign.Storable.Storable elem) => Data.Data.Data (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Stored elem) instance (GHC.Show.Show elem, Foreign.Storable.Storable elem) => GHC.Show.Show (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Stored elem) instance Data.Data.Data Numerical.Array.Storage.Boxed instance Data.Data.Data Numerical.Array.Storage.Unboxed instance Data.Data.Data Numerical.Array.Storage.Stored instance (Data.Vector.Generic.Base.Vector (Numerical.Array.Storage.BufferPure mode) a, Data.Vector.Generic.Mutable.Base.MVector (Numerical.Array.Storage.BufferMut mode) a) => Numerical.Array.Storage.Buffer mode a instance Data.Vector.Generic.Mutable.Base.MVector (Numerical.Array.Storage.BufferMut mode) a => Numerical.Array.Storage.MBuffer mode a instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Mutable.MVector elem => Data.Vector.Generic.Mutable.Base.MVector (Numerical.Array.Storage.BufferMut Numerical.Array.Storage.Boxed) elem instance Foreign.Storable.Storable elem => Data.Vector.Generic.Mutable.Base.MVector (Numerical.Array.Storage.BufferMut Numerical.Array.Storage.Stored) elem instance Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector elem => Data.Vector.Generic.Mutable.Base.MVector (Numerical.Array.Storage.BufferMut Numerical.Array.Storage.Unboxed) elem instance Data.Vector.Generic.Base.Vector Data.Vector.Vector a => Data.Vector.Generic.Base.Vector (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Boxed) a instance Foreign.Storable.Storable a => Data.Vector.Generic.Base.Vector (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Stored) a instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector a => Data.Vector.Generic.Base.Vector (Numerical.Array.Storage.BufferPure Numerical.Array.Storage.Unboxed) a -- | This module is pretty cool because it gives you a way to talk about -- heterogeneous representations for different columns! -- -- might be replaced with an HList of Vectors approach module Numerical.Data.Vector.HPair data VHProd (prd :: HProd (* -> *)) val [VHLeaf] :: !v a -> VHProd ( 'HUnit v) a [VHNode] :: !VHProd pra a -> !VHProd prb b -> VHProd ( 'HPair pra prb) (a, b) vHPair :: (va a, vb b) -> VHProd ( 'HPair ( 'HUnit va) ( 'HUnit vb)) (a, b) vUnHPair :: VHProd ( 'HPair ( 'HUnit va) ( 'HUnit vb)) (a, b) -> (va a, vb b) data MVHProd (prd :: HProd (* -> * -> *)) (st :: *) val [MVHLeaf] :: !mv st a -> MVHProd ( 'HUnit mv) st a [MVHNode] :: !MVHProd pra st a -> !MVHProd prb st b -> MVHProd ( 'HPair pra prb) st (a, b) data HProd a [HPair] :: HProd a -> HProd a -> HProd a [HUnit] :: a -> HProd a type family MutableHProdTree (a :: HProd (* -> *)) = r | r -> a type family TransformHProdTree (f :: k -> m) (a :: HProd k) :: HProd m instance (Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.HPair.MVHProd (Numerical.Data.Vector.HPair.MutableHProdTree ('Numerical.Data.Vector.HPair.HPair pa pb))) (a, b), Data.Vector.Generic.Base.Vector (Numerical.Data.Vector.HPair.VHProd pa) a, Data.Vector.Generic.Base.Vector (Numerical.Data.Vector.HPair.VHProd pb) b) => Data.Vector.Generic.Base.Vector (Numerical.Data.Vector.HPair.VHProd ('Numerical.Data.Vector.HPair.HPair pa pb)) (a, b) instance (Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.HPair.MVHProd ('Numerical.Data.Vector.HPair.HUnit (Data.Vector.Generic.Base.Mutable v))) a, Data.Vector.Generic.Base.Vector v a) => Data.Vector.Generic.Base.Vector (Numerical.Data.Vector.HPair.VHProd ('Numerical.Data.Vector.HPair.HUnit v)) a instance Data.Vector.Generic.Mutable.Base.MVector mv a => Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.HPair.MVHProd ('Numerical.Data.Vector.HPair.HUnit mv)) a instance (Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.HPair.MVHProd pra) a, Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.HPair.MVHProd prb) b) => Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.HPair.MVHProd ('Numerical.Data.Vector.HPair.HPair pra prb)) (a, b) -- | This module is pretty cool because it gives you a way to talk about -- open struct of arrays style vectors -- -- might be replaced with an HList of Vectors approach module Numerical.Data.Vector.Pair data family VProd (vect :: * -> *) (prd :: Prod) val vPair :: (v a, v b) -> VProd v ( 'Pair 'Unit 'Unit) (a, b) vUnPair :: VProd v ( 'Pair 'Unit 'Unit) (a, b) -> (v a, v b) data family MVProd (vect :: * -> * -> *) (prd :: Prod) (st :: *) val data Prod Pair :: Prod -> Prod -> Prod Unit :: Prod instance (Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.Pair.MVProd (Data.Vector.Generic.Base.Mutable v) ('Numerical.Data.Vector.Pair.Pair pa pb)) (a, b), Data.Vector.Generic.Base.Vector (Numerical.Data.Vector.Pair.VProd v pa) a, Data.Vector.Generic.Base.Vector (Numerical.Data.Vector.Pair.VProd v pb) b) => Data.Vector.Generic.Base.Vector (Numerical.Data.Vector.Pair.VProd v ('Numerical.Data.Vector.Pair.Pair pa pb)) (a, b) instance (Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.Pair.MVProd (Data.Vector.Generic.Base.Mutable v) 'Numerical.Data.Vector.Pair.Unit) a, Data.Vector.Generic.Base.Vector v a) => Data.Vector.Generic.Base.Vector (Numerical.Data.Vector.Pair.VProd v 'Numerical.Data.Vector.Pair.Unit) a instance Data.Vector.Generic.Mutable.Base.MVector mv a => Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.Pair.MVProd mv 'Numerical.Data.Vector.Pair.Unit) a instance (Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.Pair.MVProd mv pra) a, Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.Pair.MVProd mv prb) b) => Data.Vector.Generic.Mutable.Base.MVector (Numerical.Data.Vector.Pair.MVProd mv ('Numerical.Data.Vector.Pair.Pair pra prb)) (a, b) module Numerical.InternalUtils -- | error stops execution and displays an error message. error :: HasCallStack => [Char] -> a module Numerical.Matrix.Basic module Numerical.Nat data Nat S :: !Nat -> Nat Z :: Nat type N0 = 'Z type N1 = 'S N0 type N2 = 'S N1 type N3 = 'S N2 type N4 = 'S N3 type N5 = 'S N4 type N6 = 'S N5 type N7 = 'S N6 type N8 = 'S N7 type N9 = 'S N8 type N10 = 'S N9 data SNat :: Nat -> * [SZero] :: SNat 'Z [SSucc] :: SNat n -> SNat ( 'S n) type family n1 + n2 plus_id_r :: SNat n -> (n + 'Z) :~: n plus_succ_r :: SNat n1 -> Proxy n2 -> (n1 + 'S n2) :~: 'S (n1 + n2) -- | Generalized form of type-safe cast using propositional equality gcastWith :: () => (a :~: b) -> ((a ~ b) -> r) -> r -- | Proxy is a type that holds no data, but has a phantom parameter -- of arbitrary type (or even kind). Its use is to provide type -- information, even though there is no value available of that type (or -- it may be too costly to create one). -- -- Historically, Proxy :: Proxy a is a safer -- alternative to the 'undefined :: a' idiom. -- --
--   >>> Proxy :: Proxy (Void, Int -> Int)
--   Proxy
--   
-- -- Proxy can even hold types of higher kinds, -- --
--   >>> Proxy :: Proxy Either
--   Proxy
--   
-- --
--   >>> Proxy :: Proxy Functor
--   Proxy
--   
-- --
--   >>> Proxy :: Proxy complicatedStructure
--   Proxy
--   
data Proxy (t :: k) :: forall k. () => k -> Type Proxy :: Proxy type LitNat = Nat type family U (n :: Nat) :: Nat instance Data.Data.Data Numerical.Nat.Nat instance GHC.Read.Read Numerical.Nat.Nat instance GHC.Show.Show Numerical.Nat.Nat instance GHC.Classes.Eq Numerical.Nat.Nat module Numerical.Array.Shape data Shape (rank :: Nat) a [Nil] :: Shape 'Z a [:*] :: !a -> !Shape r a -> Shape ( 'S r) a infixr 3 :* foldl :: forall a b r. Foldable (Shape r) => (b -> a -> b) -> b -> Shape r a -> b foldr :: forall a b r. Foldable (Shape r) => (a -> b -> b) -> b -> Shape r a -> b foldl' :: forall a b r. Foldable (Shape r) => (b -> a -> b) -> b -> Shape r a -> b foldl1 :: forall b r. Foldable (Shape ( 'S r)) => (b -> b -> b) -> Shape ( 'S r) b -> b foldr1 :: forall b r. Foldable (Shape ( 'S r)) => (b -> b -> b) -> Shape ( 'S r) b -> b map :: forall a b r. Applicative (Shape r) => (a -> b) -> Shape r a -> Shape r b map2 :: forall a b c r. Applicative (Shape r) => (a -> b -> c) -> Shape r a -> Shape r b -> Shape r c reverseShape :: Shape n a -> Shape n a data Nat S :: !Nat -> Nat Z :: Nat shapeSize :: Foldable (Shape n) => Shape n a -> Int data SNat :: Nat -> * [SZero] :: SNat 'Z [SSucc] :: SNat n -> SNat ( 'S n) -- | weaklyDominates is the <= operator lifted onto a -- sized vector to induce a partial order relation weaklyDominates :: (Ord a, Applicative (Shape n), Foldable (Shape n)) => Shape n a -> Shape n a -> Bool -- | strictlyDominates is the < operator lifted onto a -- sized vector to induce a partial order relation strictlyDominates :: (Ord a, Applicative (Shape n), Foldable (Shape n)) => Shape n a -> Shape n a -> Bool shapeToList :: Shape n a -> [a] type Index rank = Shape rank Int backwards :: (Traversable t, Applicative f) => ((a -> Backwards f b) -> t a -> Backwards f (t b)) -> (a -> f b) -> t a -> f (t b) class (Unbox (Shape n a)) => UnBoxedShapeMorphism n a unShapeMVector :: UnBoxedShapeMorphism n a => MVector s (Shape n a) -> (Int, Shape n (MVector s a)) reShapeMVector :: UnBoxedShapeMorphism n a => (Int, Shape n (MVector s a)) -> MVector s (Shape n a) unShapeVector :: (UnBoxedShapeMorphism n a, Traversable (Shape n), Unbox a) => Vector (Shape n a) -> (Int, Shape n (Vector a)) reShapeVector :: (UnBoxedShapeMorphism n a, Traversable (Shape n), Unbox a) => (Int, Shape n (Vector a)) -> Vector (Shape n a) -- | Map each element of a structure to an action, evaluate these actions -- from left to right, and collect the results. For a version that -- ignores the results see traverse_. traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) instance Data.Vector.Unboxed.Base.Unbox a => Numerical.Array.Shape.UnBoxedShapeMorphism 'Numerical.Nat.Z a instance Data.Vector.Unboxed.Base.Unbox a => Numerical.Array.Shape.UnBoxedShapeMorphism ('Numerical.Nat.S 'Numerical.Nat.Z) a instance (Data.Vector.Unboxed.Base.Unbox a, Numerical.Array.Shape.UnBoxedShapeMorphism ('Numerical.Nat.S n) a) => Numerical.Array.Shape.UnBoxedShapeMorphism ('Numerical.Nat.S ('Numerical.Nat.S n)) a instance (Data.Data.Data a, Data.Typeable.Internal.Typeable 'Numerical.Nat.Z) => Data.Data.Data (Numerical.Array.Shape.Shape 'Numerical.Nat.Z a) instance (Data.Data.Data a, Data.Data.Data (Numerical.Array.Shape.Shape n a), Data.Typeable.Internal.Typeable ('Numerical.Nat.S n)) => Data.Data.Data (Numerical.Array.Shape.Shape ('Numerical.Nat.S n) a) instance GHC.Classes.Eq (Numerical.Array.Shape.Shape 'Numerical.Nat.Z a) instance (GHC.Classes.Eq a, GHC.Classes.Eq (Numerical.Array.Shape.Shape s a)) => GHC.Classes.Eq (Numerical.Array.Shape.Shape ('Numerical.Nat.S s) a) instance GHC.Show.Show (Numerical.Array.Shape.Shape 'Numerical.Nat.Z a) instance (GHC.Show.Show a, GHC.Show.Show (Numerical.Array.Shape.Shape s a)) => GHC.Show.Show (Numerical.Array.Shape.Shape ('Numerical.Nat.S s) a) instance Data.Traversable.Traversable (Numerical.Array.Shape.Shape 'Numerical.Nat.Z) instance Data.Traversable.Traversable (Numerical.Array.Shape.Shape ('Numerical.Nat.S 'Numerical.Nat.Z)) instance Data.Traversable.Traversable (Numerical.Array.Shape.Shape ('Numerical.Nat.S n)) => Data.Traversable.Traversable (Numerical.Array.Shape.Shape ('Numerical.Nat.S ('Numerical.Nat.S n))) instance GHC.Base.Functor (Numerical.Array.Shape.Shape 'Numerical.Nat.Z) instance GHC.Base.Functor (Numerical.Array.Shape.Shape r) => GHC.Base.Functor (Numerical.Array.Shape.Shape ('Numerical.Nat.S r)) instance GHC.Base.Applicative (Numerical.Array.Shape.Shape 'Numerical.Nat.Z) instance GHC.Base.Applicative (Numerical.Array.Shape.Shape r) => GHC.Base.Applicative (Numerical.Array.Shape.Shape ('Numerical.Nat.S r)) instance Data.Foldable.Foldable (Numerical.Array.Shape.Shape 'Numerical.Nat.Z) instance Data.Foldable.Foldable (Numerical.Array.Shape.Shape ('Numerical.Nat.S 'Numerical.Nat.Z)) instance Data.Foldable.Foldable (Numerical.Array.Shape.Shape ('Numerical.Nat.S r)) => Data.Foldable.Foldable (Numerical.Array.Shape.Shape ('Numerical.Nat.S ('Numerical.Nat.S r))) instance (GHC.Base.Semigroup a, GHC.Base.Applicative (Numerical.Array.Shape.Shape n)) => GHC.Base.Semigroup (Numerical.Array.Shape.Shape n a) instance (GHC.Base.Monoid a, GHC.Base.Applicative (Numerical.Array.Shape.Shape n)) => GHC.Base.Monoid (Numerical.Array.Shape.Shape n a) instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Numerical.Array.Shape.Shape ('Numerical.Nat.S 'Numerical.Nat.Z) a) instance (Foreign.Storable.Storable a, Foreign.Storable.Storable (Numerical.Array.Shape.Shape ('Numerical.Nat.S n) a)) => Foreign.Storable.Storable (Numerical.Array.Shape.Shape ('Numerical.Nat.S ('Numerical.Nat.S n)) a) instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Numerical.Array.Shape.Shape 'Numerical.Nat.Z a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Unboxed.Base.Unbox (Numerical.Array.Shape.Shape 'Numerical.Nat.Z a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Unboxed.Base.Unbox (Numerical.Array.Shape.Shape ('Numerical.Nat.S 'Numerical.Nat.Z) a) instance (Data.Vector.Unboxed.Base.Unbox a, Data.Vector.Unboxed.Base.Unbox (Numerical.Array.Shape.Shape ('Numerical.Nat.S n) a)) => Data.Vector.Unboxed.Base.Unbox (Numerical.Array.Shape.Shape ('Numerical.Nat.S ('Numerical.Nat.S n)) a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Numerical.Array.Shape.Shape 'Numerical.Nat.Z a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Numerical.Array.Shape.Shape 'Numerical.Nat.Z a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Numerical.Array.Shape.Shape ('Numerical.Nat.S 'Numerical.Nat.Z) a) instance Data.Vector.Unboxed.Base.Unbox a => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Numerical.Array.Shape.Shape ('Numerical.Nat.S 'Numerical.Nat.Z) a) instance (Data.Vector.Unboxed.Base.Unbox a, Data.Vector.Unboxed.Base.Unbox (Numerical.Array.Shape.Shape ('Numerical.Nat.S n) a)) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Numerical.Array.Shape.Shape ('Numerical.Nat.S ('Numerical.Nat.S n)) a) instance (Data.Vector.Unboxed.Base.Unbox a, Data.Vector.Unboxed.Base.Unbox (Numerical.Array.Shape.Shape ('Numerical.Nat.S n) a)) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Numerical.Array.Shape.Shape ('Numerical.Nat.S ('Numerical.Nat.S n)) a) -- | Comments for this modules module Numerical.Array.Layout.Base -- | the Layout type class class Layout form (rank :: Nat) | form -> rank -- | basicLogicalShape gives the extent of the format basicLogicalShape :: Layout form rank => form -> Shape rank Int -- | basicLogicalForm converts a given format into its "contiguous" -- analogue this is useful for supporting various address translation -- manipulation tricks efficiently. Note that any valid simple format -- should strive to ensure this is an O(1) operation. though certain -- composite Layout instances may provide a slower implementation. basicLogicalForm :: (Layout form rank, logicalForm ~ LayoutLogicalFormat form) => form -> logicalForm -- | transposedLayout transposes the format data type transposedLayout :: (Layout form rank, form ~ Transposed transform, transform ~ Transposed form) => form -> transform -- | basicCompareIndex lets you compare where two (presumably -- inbounds) Index values are in a formats ordering. The logical -- Shape of the array is not needed basicCompareIndex :: Layout form rank => p form -> Shape rank Int -> Shape rank Int -> Ordering -- | the (possibly empty) min and max of the valid addresses for a given -- format. minAddress = fmap _RangeMin . rangedFormatAddress and -- maxAddress = fmap _RangeMax . rangedFormatAddress FIXME : -- This also is a terrible name basicAddressRange :: (Layout form rank, address ~ LayoutAddress form) => form -> Maybe (Range address) -- | basicToAddress takes an Index, and tries to translate it to an -- address if its in bounds basicToAddress :: (Layout form rank, address ~ LayoutAddress form) => form -> Index rank -> Maybe address -- | basicToIndex takes an address, and always successfully -- translates it to a valid index. Behavior of invalid addresses -- constructed by a library user is unspecified. basicToIndex :: (Layout form rank, address ~ LayoutAddress form) => form -> address -> Index rank -- | basicNextAddress takes an address, and tries to compute the -- next valid address, or returns Nothing if there is no subsequent valid -- address. basicNextAddress :: (Layout form rank, address ~ LayoutAddress form) => form -> address -> Maybe address -- | basicNextIndex form ix mbeAddress computes the next -- valid index after ix if it exists. It takes a -- Maybe address as a hint for where to do the search for -- the successor. If the index is in bounds and not the last index, it -- returns both the index and the associated address. basicNextIndex :: (Layout form rank, address ~ LayoutAddress form) => form -> Index rank -> Maybe address -> Maybe (Index rank, address) basicAddressPopCount :: (Layout form rank, address ~ LayoutAddress form) => form -> Range address -> Int -- | This operation is REALLY unsafe This should ONLY be used on Formats -- that are directly paired with a Buffer or Mutable Buffer (ie a Vector) -- This operation being in this class is also kinda a hack but lets leave -- it here for now basicAddressAsInt :: (Layout form rank, address ~ LayoutAddress form) => form -> address -> Int -- | The semantics of basicAffineAddressShift form addr -- step is that when step > 0, its equivalent to iteratively -- computing basicNextAddress step times. However, the -- step size can be negative, which means it can basicAffineAddressShift :: (Layout form rank, address ~ LayoutAddress form) => form -> address -> Int -> Maybe address -- | DenseLayout only has instances for Dense array formats. this -- class will need some sprucing up for the beta, but its ok for now. NB -- that DenseLayout is really strictly meant to be used for -- optimization purposes, and not meant as a default api class Layout form rank => DenseLayout form (rank :: Nat) | form -> rank basicToDenseAddress :: DenseLayout form rank => form -> Index rank -> Address basicToDenseIndex :: DenseLayout form rank => form -> Address -> Index rank basicNextDenseAddress :: DenseLayout form rank => form -> Address -> Address basicNextDenseIndex :: DenseLayout form rank => form -> Index rank -> (Index rank, Address) -- | RectilinearLayout is the type class that supports the modle -- widely usable class of slicing operations in Numerical. for every -- instance RectilinearLayout format rank orientation, a -- corresponding RectOrientationForm form , -- RectDownRankForm form and InnerContigForm -- form type family instance should be defined -- -- The purpose of RectilinearLayout class is to provide class Layout form rank => RectilinearLayout form (rank :: Nat) (oriented :: MajorOrientation) | form -> rank oriented -- | formRectOrientation provides a runtime mechanism for reflecting -- the orientation of the format formRectOrientation :: RectilinearLayout form rank oriented => p form -> SMajorOrientation oriented -- | For rectlinearShape form==shp, we always have that -- basicLogicalShape form weaklyDominates shp. -- when strictlyDominates holds, that implies that the underlying -- array format is a rectilinear layout whose "elements" are tiles of a -- fixed size array format. For this initial release and initial set of -- applicable rectilinear array formats, the following is always true -- basicLogicalShape form == basicLogicalShape' form -- Should be O(1) always. Or more precisely O(rank) rectlinearShape :: RectilinearLayout form rank oriented => form -> Index rank unconsOuter :: (RectilinearLayout form rank oriented, 'S down ~ rank) => p form -> Shape rank a -> (a, Shape down a) consOuter :: (RectilinearLayout form rank oriented, 'S down ~ rank) => p form -> a -> Shape down a -> Shape rank a -- | majorAxisSlice fm (x,y) requires that y-x>=1, ie -- that more than one sub range wrt the major axis be selected, so that -- the logical rank of the selected array stays the same. This operation -- also preserves memory locality as applicable. O(1) / -- O(rank) majorAxisSlice :: RectilinearLayout form rank oriented => form -> (Int, Int) -> form -- | majorAxixProject form x picks a "row" with respect -- to the outer most dimension of the array format. This will -- O(1) or O(rank) majorAxisProject :: (RectilinearLayout form rank oriented, RectilinearLayout downForm subRank oriented, rank ~ 'S subRank, downForm ~ RectDownRankForm form) => form -> Int -> downForm -- | this is the nonstrided subset of general array slice notation. Invoke -- as rectilinearSlice form leastCorner greatestCorner, -- where the least and greatest corners of the sub array are determined -- by the strictlyDominates partial order on the bounds of the sub -- array. For Dense array formats, this should be O(1) or more -- precisely O(rank) For the basic Sparse array formats thus far -- the complexity should be O(size of outermost dimension), -- which could be computed by fst . unconsOuter [form] . -- rectilinearShape $ form rectlinearSlice :: (RectilinearLayout form rank oriented, RectilinearLayout icForm rank oriented, icForm ~ InnerContigForm form) => form -> Index rank -> Index rank -> icForm type family LayoutAddress (form :: *) :: * -- | every format has a "logical" sibling, that represents the address -- translation when the underlying buffer layer is contiguous and packed. -- So it could be claimed that any type that obeys -- a~LayoutLogicalFormat a is one that an be a legal -- instance of LayoutBuilder? type family LayoutLogicalFormat (form :: *) :: * type family Transposed (form :: *) :: * type family FormatStorageRep (a :: *) :: * -- | Every instance of RectilinearLayout needs to have a -- corresponding RectOrientationForm, RectDownRankForm, and -- InnerContigForm type family RectOrientationForm form :: MajorOrientation type family RectDownRankForm form :: * type family InnerContigForm form :: * data family Format lay (contiguity :: Locality) (rank :: Nat) rep -- | this is kinda a hack newtype TaggedShape (form :: *) (rank :: Nat) TaggedShape :: Shape rank Int -> TaggedShape [unTagShape] :: TaggedShape -> Shape rank Int -- | Generalized Dense Slice Projection notation, not sure if it should be -- defined in this module or elsewhere This provides a type safe -- interface for the classical general array slice notation. That said, -- its only useful for dense array formats, at least in general. For -- formats that aren't "rectilinear dense", this COULD be used as a -- description format for traversing over various rectilinear subsets of -- points though? data GDSlice (from :: Nat) (to :: Nat) :: * [GDNil] :: GDSlice 'Z 'Z [GDPick] :: Int -> !GDSlice from to -> GDSlice ( 'S from) to [GDRange] :: (Int, Int, Int) -> !GDSlice from to -> GDSlice ( 'S from) ( 'S to) [GDAll] :: !GDSlice from to -> GDSlice ( 'S from) ( 'S to) data SMajorOrientation (o :: MajorOrientation) [SRowed] :: SMajorOrientation 'Rowed [SColumned] :: SMajorOrientation 'Columned [SBlockedRow] :: SMajorOrientation 'BlockedRow [SBlockedColumn] :: SMajorOrientation 'BlockedColumn -- | these names aren't ideal, but lets punt on bikeshedding till theres -- >= 2 serious users data MajorOrientation Rowed :: MajorOrientation Columned :: MajorOrientation BlockedColumn :: MajorOrientation BlockedRow :: MajorOrientation majorCompareRightToLeft :: Ordering -> Ordering -> Ordering majorCompareLeftToRight :: Ordering -> Ordering -> Ordering shapeCompareRightToLeft :: (Foldable (Shape r), Applicative (Shape r), Ord a) => Shape r a -> Shape r a -> Ordering shapeCompareLeftToRight :: (Foldable (Shape r), Applicative (Shape r), Ord a) => Shape r a -> Shape r a -> Ordering instance Data.Data.Data Numerical.Array.Layout.Base.MajorOrientation instance (GHC.Classes.Eq (Numerical.Array.Shape.Shape rank GHC.Types.Int), Numerical.Array.Layout.Base.Layout form rank) => GHC.Classes.Ord (Numerical.Array.Layout.Base.TaggedShape form rank) instance GHC.Show.Show (Numerical.Array.Layout.Base.GDSlice 'Numerical.Nat.Z 'Numerical.Nat.Z) instance (GHC.Show.Show (Numerical.Array.Layout.Base.GDSlice f ('Numerical.Nat.S t)), GHC.Show.Show (Numerical.Array.Layout.Base.GDSlice f t)) => GHC.Show.Show (Numerical.Array.Layout.Base.GDSlice ('Numerical.Nat.S f) ('Numerical.Nat.S t)) instance GHC.Show.Show (Numerical.Array.Layout.Base.GDSlice f 'Numerical.Nat.Z) => GHC.Show.Show (Numerical.Array.Layout.Base.GDSlice ('Numerical.Nat.S f) 'Numerical.Nat.Z) instance GHC.Classes.Eq (Numerical.Array.Shape.Shape rank GHC.Types.Int) => GHC.Classes.Eq (Numerical.Array.Layout.Base.TaggedShape f rank) instance GHC.Show.Show (Numerical.Array.Shape.Shape rank GHC.Types.Int) => GHC.Show.Show (Numerical.Array.Layout.Base.TaggedShape f rank) module Numerical.Array.Layout.Sparse -- | the Layout type class class Layout form (rank :: Nat) | form -> rank -- | basicLogicalShape gives the extent of the format basicLogicalShape :: Layout form rank => form -> Shape rank Int -- | basicLogicalForm converts a given format into its "contiguous" -- analogue this is useful for supporting various address translation -- manipulation tricks efficiently. Note that any valid simple format -- should strive to ensure this is an O(1) operation. though certain -- composite Layout instances may provide a slower implementation. basicLogicalForm :: (Layout form rank, logicalForm ~ LayoutLogicalFormat form) => form -> logicalForm -- | transposedLayout transposes the format data type transposedLayout :: (Layout form rank, form ~ Transposed transform, transform ~ Transposed form) => form -> transform -- | basicCompareIndex lets you compare where two (presumably -- inbounds) Index values are in a formats ordering. The logical -- Shape of the array is not needed basicCompareIndex :: Layout form rank => p form -> Shape rank Int -> Shape rank Int -> Ordering -- | the (possibly empty) min and max of the valid addresses for a given -- format. minAddress = fmap _RangeMin . rangedFormatAddress and -- maxAddress = fmap _RangeMax . rangedFormatAddress FIXME : -- This also is a terrible name basicAddressRange :: (Layout form rank, address ~ LayoutAddress form) => form -> Maybe (Range address) -- | basicToAddress takes an Index, and tries to translate it to an -- address if its in bounds basicToAddress :: (Layout form rank, address ~ LayoutAddress form) => form -> Index rank -> Maybe address -- | basicToIndex takes an address, and always successfully -- translates it to a valid index. Behavior of invalid addresses -- constructed by a library user is unspecified. basicToIndex :: (Layout form rank, address ~ LayoutAddress form) => form -> address -> Index rank -- | basicNextAddress takes an address, and tries to compute the -- next valid address, or returns Nothing if there is no subsequent valid -- address. basicNextAddress :: (Layout form rank, address ~ LayoutAddress form) => form -> address -> Maybe address -- | basicNextIndex form ix mbeAddress computes the next -- valid index after ix if it exists. It takes a -- Maybe address as a hint for where to do the search for -- the successor. If the index is in bounds and not the last index, it -- returns both the index and the associated address. basicNextIndex :: (Layout form rank, address ~ LayoutAddress form) => form -> Index rank -> Maybe address -> Maybe (Index rank, address) basicAddressPopCount :: (Layout form rank, address ~ LayoutAddress form) => form -> Range address -> Int -- | This operation is REALLY unsafe This should ONLY be used on Formats -- that are directly paired with a Buffer or Mutable Buffer (ie a Vector) -- This operation being in this class is also kinda a hack but lets leave -- it here for now basicAddressAsInt :: (Layout form rank, address ~ LayoutAddress form) => form -> address -> Int -- | The semantics of basicAffineAddressShift form addr -- step is that when step > 0, its equivalent to iteratively -- computing basicNextAddress step times. However, the -- step size can be negative, which means it can basicAffineAddressShift :: (Layout form rank, address ~ LayoutAddress form) => form -> address -> Int -> Maybe address data DirectSparse type CSR = CompressedSparseRow type CSC = CompressedSparseColumn data CompressedSparseRow data CompressedSparseColumn data family Format lay (contiguity :: Locality) (rank :: Nat) rep data ContiguousCompressedSparseMatrix rep FormatContiguousCompressedSparseInternal :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> !BufferPure rep Int -> !BufferPure rep Int -> ContiguousCompressedSparseMatrix rep [_outerDimContiguousSparseFormat] :: ContiguousCompressedSparseMatrix rep -> {-# UNPACK #-} !Int [_innerDimContiguousSparseFormat] :: ContiguousCompressedSparseMatrix rep -> {-# UNPACK #-} !Int [_innerDimIndexContiguousSparseFormat] :: ContiguousCompressedSparseMatrix rep -> !BufferPure rep Int [_outerDim2InnerDimContiguousSparseFormat] :: ContiguousCompressedSparseMatrix rep -> !BufferPure rep Int data InnerContiguousCompressedSparseMatrix rep FormatInnerContiguousCompressedSparseInternal :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> !BufferPure rep Int -> !BufferPure rep Int -> !BufferPure rep Int -> InnerContiguousCompressedSparseMatrix rep [_outerDimInnerContiguousSparseFormat] :: InnerContiguousCompressedSparseMatrix rep -> {-# UNPACK #-} !Int [_innerDimInnerContiguousSparseFormat] :: InnerContiguousCompressedSparseMatrix rep -> {-# UNPACK #-} !Int [_innerDimIndexShiftInnerContiguousSparseFormat] :: InnerContiguousCompressedSparseMatrix rep -> {-# UNPACK #-} !Int [_innerDimIndexInnerContiguousSparseFormat] :: InnerContiguousCompressedSparseMatrix rep -> !BufferPure rep Int [_outerDim2InnerDimStartInnerContiguousSparseFormat] :: InnerContiguousCompressedSparseMatrix rep -> !BufferPure rep Int [_outerDim2InnerDimEndInnerContiguousSparseFormat] :: InnerContiguousCompressedSparseMatrix rep -> !BufferPure rep Int instance GHC.Show.Show (Numerical.Array.Storage.BufferPure rep GHC.Types.Int) => GHC.Show.Show (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.DirectSparse 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) instance GHC.Show.Show (Numerical.Array.Storage.BufferPure rep GHC.Types.Int) => GHC.Show.Show (Numerical.Array.Layout.Sparse.ContiguousCompressedSparseMatrix rep) instance GHC.Show.Show (Numerical.Array.Storage.BufferPure rep GHC.Types.Int) => GHC.Show.Show (Numerical.Array.Layout.Sparse.InnerContiguousCompressedSparseMatrix rep) instance GHC.Show.Show (Numerical.Array.Layout.Sparse.ContiguousCompressedSparseMatrix rep) => GHC.Show.Show (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.CompressedSparseRow 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S ('Numerical.Nat.S 'Numerical.Nat.Z)) rep) instance GHC.Show.Show (Numerical.Array.Layout.Sparse.ContiguousCompressedSparseMatrix rep) => GHC.Show.Show (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.CompressedSparseColumn 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S ('Numerical.Nat.S 'Numerical.Nat.Z)) rep) instance GHC.Show.Show (Numerical.Array.Layout.Sparse.InnerContiguousCompressedSparseMatrix rep) => GHC.Show.Show (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.CompressedSparseRow 'Numerical.Array.Locality.InnerContiguous ('Numerical.Nat.S ('Numerical.Nat.S 'Numerical.Nat.Z)) rep) instance GHC.Show.Show (Numerical.Array.Layout.Sparse.InnerContiguousCompressedSparseMatrix rep) => GHC.Show.Show (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.CompressedSparseColumn 'Numerical.Array.Locality.InnerContiguous ('Numerical.Nat.S ('Numerical.Nat.S 'Numerical.Nat.Z)) rep) instance Data.Vector.Generic.Base.Vector (Numerical.Array.Storage.BufferPure rep) GHC.Types.Int => Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.CompressedSparseRow 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S ('Numerical.Nat.S 'Numerical.Nat.Z)) rep) ('Numerical.Nat.S ('Numerical.Nat.S 'Numerical.Nat.Z)) instance Data.Vector.Generic.Base.Vector (Numerical.Array.Storage.BufferPure rep) GHC.Types.Int => Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.DirectSparse 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) ('Numerical.Nat.S 'Numerical.Nat.Z) module Numerical.Array.Layout.Dense -- | DenseLayout only has instances for Dense array formats. this -- class will need some sprucing up for the beta, but its ok for now. NB -- that DenseLayout is really strictly meant to be used for -- optimization purposes, and not meant as a default api class Layout form rank => DenseLayout form (rank :: Nat) | form -> rank basicToDenseAddress :: DenseLayout form rank => form -> Index rank -> Address basicToDenseIndex :: DenseLayout form rank => form -> Address -> Index rank basicNextDenseAddress :: DenseLayout form rank => form -> Address -> Address basicNextDenseIndex :: DenseLayout form rank => form -> Index rank -> (Index rank, Address) data Locality Contiguous :: Locality Strided :: Locality InnerContiguous :: Locality data family Format lay (contiguity :: Locality) (rank :: Nat) rep data Row data Column data Direct instance Data.Data.Data rep => Data.Data.Data (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Direct 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) instance GHC.Classes.Eq (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Direct 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) instance GHC.Show.Show (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Direct 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) instance GHC.Show.Show (Numerical.Array.Shape.Shape n GHC.Types.Int) => GHC.Show.Show (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.InnerContiguous n rep) instance (Data.Data.Data (Numerical.Array.Shape.Shape n GHC.Types.Int), Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable rep) => Data.Data.Data (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.InnerContiguous n rep) instance GHC.Show.Show (Numerical.Array.Shape.Shape n GHC.Types.Int) => GHC.Show.Show (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.Strided n rep) instance (Data.Data.Data (Numerical.Array.Shape.Shape n GHC.Types.Int), Data.Typeable.Internal.Typeable n, Data.Typeable.Internal.Typeable rep) => Data.Data.Data (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.Strided n rep) instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.Contiguous rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.InnerContiguous rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.Strided rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Foldable.Foldable (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.DenseLayout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.Contiguous rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Foldable.Foldable (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.DenseLayout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.InnerContiguous rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Foldable.Foldable (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.DenseLayout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.Strided rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Row 'Numerical.Array.Locality.Contiguous rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Row 'Numerical.Array.Locality.InnerContiguous rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Row 'Numerical.Array.Locality.Strided rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Foldable.Foldable (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.DenseLayout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Row 'Numerical.Array.Locality.Contiguous rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Foldable.Foldable (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.DenseLayout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Row 'Numerical.Array.Locality.InnerContiguous rank rep) rank instance (GHC.Base.Applicative (Numerical.Array.Shape.Shape rank), Data.Foldable.Foldable (Numerical.Array.Shape.Shape rank), Data.Traversable.Traversable (Numerical.Array.Shape.Shape rank)) => Numerical.Array.Layout.Base.DenseLayout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Row 'Numerical.Array.Locality.Strided rank rep) rank instance Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Direct 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) ('Numerical.Nat.S 'Numerical.Nat.Z) instance Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Direct 'Numerical.Array.Locality.Strided ('Numerical.Nat.S 'Numerical.Nat.Z) rep) ('Numerical.Nat.S 'Numerical.Nat.Z) instance Numerical.Array.Layout.Base.DenseLayout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Direct 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) ('Numerical.Nat.S 'Numerical.Nat.Z) instance Numerical.Array.Layout.Base.DenseLayout (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Direct 'Numerical.Array.Locality.Strided ('Numerical.Nat.S 'Numerical.Nat.Z) rep) ('Numerical.Nat.S 'Numerical.Nat.Z) module Numerical.Array.Layout.Builder data BatchInit v BatchInit :: !Int -> !Either [v] (IntFun v) -> BatchInit v [batchInitSize] :: BatchInit v -> !Int [batchInitKV] :: BatchInit v -> !Either [v] (IntFun v) materializeBatchMV :: (PrimMonad m, MVector mv a) => BatchInit a -> m (mv (PrimState m) a) newtype AnyMV mv e AMV :: (forall s. mv s e) -> AnyMV mv e newtype IntFun a IntFun :: (forall m. PrimMonad m => Int -> m a) -> IntFun a fromListBI :: [a] -> BatchInit a fromVectorBI :: Vector v e => v e -> BatchInit e fromMVectorBI :: MVector mv e => AnyMV mv e -> BatchInit e class Layout form (rank :: Nat) => LayoutBuilder form (rank :: Nat) | form -> rank buildFormatM :: (LayoutBuilder form rank, store ~ FormatStorageRep form, Buffer store Int, Buffer store a, PrimMonad m) => Index rank -> proxy form -> a -> Maybe (BatchInit (Index rank, a)) -> m (form, BufferMut store (PrimState m) a) buildFormatPure :: forall store form rank proxy m a. (LayoutBuilder form (rank :: Nat), store ~ FormatStorageRep form, Buffer store Int, Buffer store a, Monad m) => Index rank -> proxy form -> a -> Maybe (BatchInit (Index rank, a)) -> m (form, BufferPure store a) isStrictlyMonotonicV :: Vector v e => (e -> e -> Ordering) -> v e -> Maybe Int computeRunLengths :: (Vector v e, Eq e) => v e -> [(e, Int)] computeStarts :: (Enum a, Ord a, Num b) => [(a, b)] -> a -> a -> [(a, b)] instance Numerical.Array.Layout.Builder.LayoutBuilder (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Direct 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) ('Numerical.Nat.S 'Numerical.Nat.Z) instance (Data.Foldable.Foldable (Numerical.Array.Shape.Shape r), Data.Traversable.Traversable (Numerical.Array.Shape.Shape r), GHC.Base.Applicative (Numerical.Array.Shape.Shape r)) => Numerical.Array.Layout.Builder.LayoutBuilder (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Row 'Numerical.Array.Locality.Contiguous r rep) r instance (Data.Foldable.Foldable (Numerical.Array.Shape.Shape r), Data.Traversable.Traversable (Numerical.Array.Shape.Shape r), GHC.Base.Applicative (Numerical.Array.Shape.Shape r)) => Numerical.Array.Layout.Builder.LayoutBuilder (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Dense.Column 'Numerical.Array.Locality.Contiguous r rep) r instance Numerical.Array.Storage.Buffer rep GHC.Types.Int => Numerical.Array.Layout.Builder.LayoutBuilder (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.DirectSparse 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S 'Numerical.Nat.Z) rep) ('Numerical.Nat.S 'Numerical.Nat.Z) instance Numerical.Array.Storage.Buffer rep GHC.Types.Int => Numerical.Array.Layout.Builder.LayoutBuilder (Numerical.Array.Layout.Base.Format Numerical.Array.Layout.Sparse.CompressedSparseRow 'Numerical.Array.Locality.Contiguous ('Numerical.Nat.S ('Numerical.Nat.S 'Numerical.Nat.Z)) rep) ('Numerical.Nat.S ('Numerical.Nat.S 'Numerical.Nat.Z)) instance GHC.Show.Show a => GHC.Show.Show (Numerical.Array.Layout.Builder.BatchInit a) instance GHC.Base.Functor Numerical.Array.Layout.Builder.BatchInit instance GHC.Base.Functor Numerical.Array.Layout.Builder.IntFun module Numerical.Array.Layout module Numerical.World -- | Every numerical algorithm runs somewhere. -- -- This could be on a CPU, a GPU, data Native data ForeignNative module Numerical.Array.Pure data family ImmArray world rep lay (view :: Locality) (rank :: Nat) el class PureArray arr (rank :: Nat) a | arr -> rank where { type family PureArrayAddress (arr :: * -> *) :: *; } -- | gives the shape, a rank length list of the dimensions basicShape :: PureArray arr rank a => arr a -> Index rank basicSparseIndexToAddress :: (PureArray arr rank a, address ~ PureArrayAddress arr) => arr a -> Index rank -> Maybe address basicAddressToIndex :: (PureArray arr rank a, address ~ PureArrayAddress arr) => arr a -> address -> Index rank -- | return the Range of valid logical addresses basicAddressRange :: (PureArray arr rank a, address ~ PureArrayAddress arr) => arr a -> Maybe (Range address) -- | gives the next valid logical address undefined on invalid addresses -- and the greatest valid address. Note that for invalid addresses in -- between minAddress and maxAddress, will return the next valid address basicNextAddress :: (PureArray arr rank a, address ~ PureArrayAddress arr) => arr a -> address -> Maybe address -- | gives the next valid array index undefined on invalid indices and the -- greatest valid index basicNextIndex :: (PureArray arr rank a, address ~ PureArrayAddress arr) => arr a -> Index rank -> Maybe address -> Maybe (Index rank, address) -- | for a given valid address, basicAddressRegion addr -- will return an AddressInterval that contains addr. This will -- be a singleton when the "maximal uniform stride interval" containing -- addr has strictly less than 3 elements. Otherwise will return -- an Address range covering the maximal interval that will have -- cardinality at least 3. basicUnsafeAddressRead :: (PureArray arr rank a, Monad m, address ~ PureArrayAddress arr) => arr a -> address -> m a -- | Yield the element at the given position. This method should not be -- called directly, use unsafeSparseRead instead. basicUnsafeSparseRead :: (PureArray arr rank a, Monad m) => arr a -> Index rank -> m (Maybe a) class PureArray arr rank a => PureDenseArray arr rank a -- | basicIndexInBounds is an O(1) bounds check. basicIndexInBounds :: PureDenseArray arr rank a => arr a -> Index rank -> Bool basicUnsafeAddressDenseRead :: (PureDenseArray arr rank a, address ~ PureArrayAddress arr, Monad m) => arr a -> address -> m a -- | Yield the element at the given position. This method should not be -- called directly, use unsafeRead instead. basicUnsafeDenseReadM :: (PureDenseArray arr rank a, Monad m) => arr a -> Index rank -> m a instance (Numerical.Array.Storage.Buffer rep el, Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format lay locality rank rep) rank) => Numerical.Array.Pure.PureArray (Numerical.Array.Pure.ImmArray Numerical.World.Native rep lay locality rank) rank el module Numerical.Array.Mutable -- | MArray is the generic data family that data family MArray world rep lay (view :: Locality) (rank :: Nat) st el class PureArray (ArrPure marr) rank a => Array marr (rank :: Nat) a | marr -> rank where { type family ArrPure (marr :: * -> * -> *) :: * -> *; type family MArrayAddress (marr :: * -> * -> *) :: *; } -- | basicUnsafeAffineAddressShift is needed to handle abstracting -- access in popcount space basicUnsafeAffineAddressShift :: (Array marr rank a, address ~ MArrayAddress marr) => marr st a -> Int -> address -> address -- | Unsafely convert a mutable Array to its immutable version without -- copying. The mutable Array may not be used after this operation. -- Assumed O(1) complexity basicUnsafeFreeze :: (Array marr rank a, PrimMonad m, arr ~ ArrPure marr, marr ~ ArrMutable arr) => marr (PrimState m) a -> m (arr a) -- | Unsafely convert a pure Array to its mutable version without copying. -- the pure array may not be used after this operation. Assumed O(1) -- complexity basicUnsafeThaw :: (Array marr rank a, PrimMonad m, marr ~ ArrMutable arr, arr ~ ArrPure marr) => arr a -> m (marr (PrimState m) a) -- | gives the shape, a rank length list of the dimensions basicShape :: Array marr rank a => marr st a -> Index rank -- | basicCardinality reports the number of manifest -- addresses/entries are in the array in a given address sub range. This -- is useful for determining when to switch from a recursive algorithm to -- a direct algorithm. Should this be renamed to something like -- basicPopCount/ basicCardinality :: (Array marr rank a, address ~ MArrayAddress marr) => marr st a -> Range address -> Int basicSparseIndexToAddress :: (Array marr rank a, address ~ MArrayAddress marr) => marr s a -> Index rank -> Maybe address -- | basicMutableAddressToIndex assumes you only give it legal -- manifest addresses basicAddressToIndex :: (Array marr rank a, address ~ MArrayAddress marr) => marr s a -> address -> Index rank -- | return the smallest and largest valid logical address basicAddressRange :: (Array marr rank a, address ~ MArrayAddress marr) => marr st a -> Maybe (Range address) -- | gives the next valid logical address undefined on invalid addresses -- and the greatest valid address. Note that for invalid addresses in -- between minAddress and maxAddress, will return the next valid address. basicSparseNextAddress :: (Array marr rank a, address ~ MArrayAddress marr) => marr st a -> address -> Maybe address -- | gives the next valid array index, the least valid index that is or basicSparseNextIndex :: (Array marr rank a, address ~ MArrayAddress marr) => marr st a -> Index rank -> Maybe address -> Maybe (Index rank, address) -- | for a given valid address, basicAddressRegion addr -- will return an AddressInterval that contains addr. This will -- be a singleton when the "maximal uniform stride interval" containing -- addr has strictly less than 3 elements. Otherwise will return -- an Address range covering the maximal interval that will have -- cardinality at least 3. basicLocalAffineAddressRegion :: (Array marr rank a, address ~ MArrayAddress marr) => marr st a -> address -> AffineRange address -- | this doesn't quite fit in this class, but thats ok, will deal with -- that later basicOverlaps :: Array marr rank a => marr st a -> marr st a -> Bool -- | Reset all elements of the vector to some undefined value, clearing all -- references to external objects. This is usually a noop for unboxed -- vectors. This method should not be called directly, use clear -- instead. basicClear :: (Array marr rank a, PrimMonad m) => marr (PrimState m) a -> m () basicUnsafeAddressRead :: (Array marr rank a, PrimMonad m, address ~ MArrayAddress marr) => marr (PrimState m) a -> address -> m a basicUnsafeAddressWrite :: (Array marr rank a, PrimMonad m, address ~ MArrayAddress marr) => marr (PrimState m) a -> address -> a -> m () -- | Yield the element at the given position. This method should not be -- called directly, use unsafeSparseRead instead. basicUnsafeSparseRead :: (Array marr rank a, PrimMonad m) => marr (PrimState m) a -> Index rank -> m (Maybe a) class RectilinearArray marr rank a | marr -> rank where { -- | MutableRectilinearOrientation marr should equal Row or -- Column for any sane choice of instance, because every -- MutableRectilinear instance will have a notion of what the nominal -- major axix will be. The intended use case is side condition -- constraints like MutableRectilinearOrientation -- marr~Row)=> marr -> b for operations where majorAxix -- projections are correct only for Row major formats. Such as Row based -- forward/backward substitution (triangular solvers) type family MutableRectilinearOrientation marr :: *; type family MutableArrayDownRank marr (st :: *) a; -- | MutableInnerContigArray is the "meet" (minimum) of the locality level -- of marr and InnerContiguous. Thus both Contiguous and InnerContiguous -- are made InnerContiguous, and Strided stays Strided for now this makes -- sense to have in the MutableRectilinear class, though that may change. -- This could also be thought of as being the GLB (greatest lower bound) -- on locality type family MutableInnerContigArray (marr :: * -> * -> *) st a; } -- | basicSliceMajorAxis arr (x,y) returns the sub array -- of the same rank, with the outermost (ie major axis) dimension of arr -- restricted to the (x,y) is an inclusive interval, MUST satisfy x<y -- , and be a valid subinterval of the major axis of arr. basicMutableSliceMajorAxis :: (RectilinearArray marr rank a, PrimMonad m) => marr (PrimState m) a -> (Int, Int) -> m (marr (PrimState m) a) basicMutableProjectMajorAxis :: (RectilinearArray marr rank a, PrimMonad m) => marr (PrimState m) a -> Int -> m (MutableArrayDownRank marr (PrimState m) a) -- | basicMutableSlice arr ix1 ix2 picks out the (hyper) -- rectangle in dimension rank where ix1 is the minimal corner -- and ix2 basicMutableSlice :: (RectilinearArray marr rank a, PrimMonad m) => marr (PrimState m) a -> Index rank -> Index rank -> m (MutableInnerContigArray marr (PrimState m) a) class DenseArray marr rank a => DenseArrayBuilder marr rank a basicUnsafeNew :: (DenseArrayBuilder marr rank a, PrimMonad m) => Index rank -> m (marr (PrimState m) a) basicUnsafeReplicate :: (DenseArrayBuilder marr rank a, PrimMonad m) => Index rank -> a -> m (marr (PrimState m) a) class (Array marr rank a, PureDenseArray (ArrPure marr) rank a) => DenseArray marr rank a | marr -> rank -- | for Dense arrays, it is always easy to check if a given index is -- valid. this operation better have O(1) complexity or else! basicIndexInBounds :: DenseArray marr rank a => marr st a -> Index rank -> Bool -- | Yield the element at the given position. This method should not be -- called directly, use unsafeRead instead. basicUnsafeDenseRead :: (DenseArray marr rank a, PrimMonad m) => marr (PrimState m) a -> Index rank -> m a -- | Replace the element at the given position. This method should not be -- called directly, use unsafeWrite instead. basicUnsafeDenseWrite :: (DenseArray marr rank a, PrimMonad m) => marr (PrimState m) a -> Index rank -> a -> m () -- | gives the next valid logical address undefined on invalid addresses -- and the greatest valid address. Note that for invalid addresses in -- between minAddress and maxAddress, will return the next valid address. basicNextAddress :: DenseArray marr rank a => marr st a -> Address -> Address -- | gives the next valid array index undefined on invalid indices and the -- greatest valid index basicNextIndex :: DenseArray marr rank a => marr st a -> Index rank -> Index rank -- | Boxed is the type index for Buffers that use the boxed -- data structure Vector as the underlying storage representation. data Boxed -- | Unboxed is the type index for Buffers that use the -- unboxed data structure Vector as the underlying storage -- representation. data Unboxed -- | Stored is the type index for Buffers that use the -- Storable for values, in pinned byte array buffers, provided by -- Storable data Stored instance (Numerical.Array.Storage.Buffer rep el, Numerical.Array.Layout.Base.Layout (Numerical.Array.Layout.Base.Format lay locality rank rep) rank) => Numerical.Array.Mutable.Array (Numerical.Array.Mutable.MArray Numerical.World.Native rep lay locality rank) rank el