{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
module Data.Dense.Unboxed
(
UArray
, Unbox
, Shape
, HasLayout (..)
, Layout
, extent
, size
, indexes
, indexesFrom
, indexesBetween
, vector
, values
, values'
, valuesBetween
, flat
, fromList
, fromListInto
, fromListInto_
, fromVectorInto
, fromVectorInto_
, replicate
, generate
, linearGenerate
, create
, replicateM
, generateM
, linearGenerateM
, empty
, null
, (!)
, (!?)
, unsafeIndex
, linearIndex
, unsafeLinearIndex
, indexM
, unsafeIndexM
, linearIndexM
, unsafeLinearIndexM
, (//)
, accum
, map
, imap
, zip
, zip3
, zipWith
, zipWith3
, izipWith
, izipWith3
, ixRow
, rows
, ixColumn
, columns
, ixPlane
, planes
, flattenPlane
, unsafeOrdinals
, UMArray
, thaw
, freeze
, unsafeThaw
, unsafeFreeze
, G.Delayed
, delayed
, seqDelayed
, delay
, manifest
, seqManifest
, G.genDelayed
, G.indexDelayed
, affirm
, seqAffirm
, G.Focused
, G.focusOn
, G.unfocus
, G.unfocused
, G.extendFocus
, G.locale
, G.shiftFocus
) where
import Control.Lens hiding (imap)
import Control.Monad.Primitive
import Control.Monad.ST
import qualified Data.Foldable as F
import Data.Vector.Unboxed (Unbox, Vector)
import Linear hiding (vector)
import Prelude hiding (map, null, replicate, zip,
zip3, zipWith, zipWith3)
import Data.Dense.Generic (UArray)
import qualified Data.Dense.Generic as G
import Data.Dense.Index
import Data.Dense.Mutable (UMArray)
values :: (Shape f, Unbox a, Unbox b)
=> IndexedTraversal (f Int) (UArray f a) (UArray f b) a b
values :: IndexedTraversal (f Int) (UArray f a) (UArray f b) a b
values = p a (f b) -> UArray f a -> f (UArray f b)
forall (f :: * -> *) (v :: * -> *) a b.
(Shape f, Vector v a, Vector v b) =>
IndexedTraversal (f Int) (Array v f a) (Array v f b) a b
G.values'
{-# INLINE values #-}
values' :: (Shape f, Unbox a, Unbox b)
=> IndexedTraversal (f Int) (UArray f a) (UArray f b) a b
values' :: IndexedTraversal (f Int) (UArray f a) (UArray f b) a b
values' = p a (f b) -> UArray f a -> f (UArray f b)
forall (f :: * -> *) (v :: * -> *) a b.
(Shape f, Vector v a, Vector v b) =>
IndexedTraversal (f Int) (Array v f a) (Array v f b) a b
G.values'
{-# INLINE values' #-}
valuesBetween
:: (Shape f, Unbox a)
=> f Int
-> f Int
-> IndexedTraversal' (f Int) (UArray f a) a
valuesBetween :: f Int -> f Int -> IndexedTraversal' (f Int) (UArray f a) a
valuesBetween = f Int -> f Int -> p a (f a) -> UArray f a -> f (UArray f a)
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
f Int -> f Int -> IndexedTraversal' (f Int) (Array v f a) a
G.valuesBetween
{-# INLINE valuesBetween #-}
flat :: Unbox b => Iso (UArray V1 a) (UArray V1 b) (Vector a) (Vector b)
flat :: Iso (UArray V1 a) (UArray V1 b) (Vector a) (Vector b)
flat = p (Vector a) (f (Vector b)) -> p (UArray V1 a) (f (UArray V1 b))
forall (w :: * -> *) b (v :: * -> *) a.
Vector w b =>
Iso (Array v V1 a) (Array w V1 b) (v a) (w b)
G.flat
{-# INLINE flat #-}
vector :: (Unbox a, Unbox b) => IndexedLens (Layout f) (UArray f a) (UArray f b) (Vector a) (Vector b)
vector :: IndexedLens
(Layout f) (UArray f a) (UArray f b) (Vector a) (Vector b)
vector = p (Vector a) (f (Vector b)) -> UArray f a -> f (UArray f b)
forall (v :: * -> *) a (w :: * -> *) b (f :: * -> *).
(Vector v a, Vector w b) =>
IndexedLens (Layout f) (Array v f a) (Array w f b) (v a) (w b)
G.vector
{-# INLINE vector #-}
fromList :: Unbox a => [a] -> UArray V1 a
fromList :: [a] -> UArray V1 a
fromList = [a] -> UArray V1 a
forall (v :: * -> *) a. Vector v a => [a] -> Array v V1 a
G.fromList
{-# INLINE fromList #-}
fromListInto :: (Shape f, Unbox a) => Layout f -> [a] -> Maybe (UArray f a)
fromListInto :: Layout f -> [a] -> Maybe (UArray f a)
fromListInto = Layout f -> [a] -> Maybe (UArray f a)
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Layout f -> [a] -> Maybe (Array v f a)
G.fromListInto
{-# INLINE fromListInto #-}
fromListInto_ :: (Shape f, Unbox a) => Layout f -> [a] -> UArray f a
fromListInto_ :: Layout f -> [a] -> UArray f a
fromListInto_ = Layout f -> [a] -> UArray f a
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Layout f -> [a] -> Array v f a
G.fromListInto_
{-# INLINE fromListInto_ #-}
fromVectorInto :: (Shape f, Unbox a) => Layout f -> Vector a -> Maybe (UArray f a)
fromVectorInto :: Layout f -> Vector a -> Maybe (UArray f a)
fromVectorInto = Layout f -> Vector a -> Maybe (UArray f a)
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Layout f -> v a -> Maybe (Array v f a)
G.fromVectorInto
{-# INLINE fromVectorInto #-}
fromVectorInto_ :: (Shape f, Unbox a) => Layout f -> Vector a -> UArray f a
fromVectorInto_ :: Layout f -> Vector a -> UArray f a
fromVectorInto_ = Layout f -> Vector a -> UArray f a
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Layout f -> v a -> Array v f a
G.fromVectorInto_
{-# INLINE fromVectorInto_ #-}
empty :: (Unbox a, Additive f) => UArray f a
empty :: UArray f a
empty = UArray f a
forall (v :: * -> *) a (f :: * -> *).
(Vector v a, Additive f) =>
Array v f a
G.empty
{-# INLINE empty #-}
null :: F.Foldable f => UArray f a -> Bool
null :: UArray f a -> Bool
null = UArray f a -> Bool
forall (f :: * -> *) (v :: * -> *) a.
Foldable f =>
Array v f a -> Bool
G.null
{-# INLINE null #-}
(!) :: (Shape f, Unbox a) => UArray f a -> f Int -> a
(!) = UArray f a -> f Int -> a
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Array v f a -> f Int -> a
(G.!)
{-# INLINE (!) #-}
(!?) :: (Shape f, Unbox a) => UArray f a -> f Int -> Maybe a
!? :: UArray f a -> f Int -> Maybe a
(!?) = UArray f a -> f Int -> Maybe a
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Array v f a -> f Int -> Maybe a
(G.!?)
{-# INLINE (!?) #-}
unsafeIndex :: (Shape f, Unbox a) => UArray f a -> f Int -> a
unsafeIndex :: UArray f a -> f Int -> a
unsafeIndex = UArray f a -> f Int -> a
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Array v f a -> f Int -> a
G.unsafeIndex
{-# INLINE unsafeIndex #-}
linearIndex :: Unbox a => UArray f a -> Int -> a
linearIndex :: UArray f a -> Int -> a
linearIndex = UArray f a -> Int -> a
forall (v :: * -> *) a (f :: * -> *).
Vector v a =>
Array v f a -> Int -> a
G.linearIndex
{-# INLINE linearIndex #-}
unsafeLinearIndex :: Unbox a => UArray f a -> Int -> a
unsafeLinearIndex :: UArray f a -> Int -> a
unsafeLinearIndex = UArray f a -> Int -> a
forall (v :: * -> *) a (f :: * -> *).
Vector v a =>
Array v f a -> Int -> a
G.unsafeLinearIndex
{-# INLINE unsafeLinearIndex #-}
indexM :: (Shape f, Unbox a, Monad m) => UArray f a -> f Int -> m a
indexM :: UArray f a -> f Int -> m a
indexM = UArray f a -> f Int -> m a
forall (f :: * -> *) (v :: * -> *) a (m :: * -> *).
(Shape f, Vector v a, Monad m) =>
Array v f a -> f Int -> m a
G.indexM
{-# INLINE indexM #-}
unsafeIndexM :: (Shape f, Unbox a, Monad m) => UArray f a -> f Int -> m a
unsafeIndexM :: UArray f a -> f Int -> m a
unsafeIndexM = UArray f a -> f Int -> m a
forall (f :: * -> *) (v :: * -> *) a (m :: * -> *).
(Shape f, Vector v a, Monad m) =>
Array v f a -> f Int -> m a
G.unsafeIndexM
{-# INLINE unsafeIndexM #-}
linearIndexM :: (Shape f, Unbox a, Monad m) => UArray f a -> Int -> m a
linearIndexM :: UArray f a -> Int -> m a
linearIndexM = UArray f a -> Int -> m a
forall (f :: * -> *) (v :: * -> *) a (m :: * -> *).
(Shape f, Vector v a, Monad m) =>
Array v f a -> Int -> m a
G.linearIndexM
{-# INLINE linearIndexM #-}
unsafeLinearIndexM :: (Unbox a, Monad m) => UArray f a -> Int -> m a
unsafeLinearIndexM :: UArray f a -> Int -> m a
unsafeLinearIndexM = UArray f a -> Int -> m a
forall (v :: * -> *) a (m :: * -> *) (f :: * -> *).
(Vector v a, Monad m) =>
Array v f a -> Int -> m a
G.unsafeLinearIndexM
{-# INLINE unsafeLinearIndexM #-}
create :: Unbox a
=> (forall s. ST s (UMArray f s a)) -> UArray f a
create :: (forall s. ST s (UMArray f s a)) -> UArray f a
create forall s. ST s (UMArray f s a)
m = ST Any (UMArray f Any a)
forall s. ST s (UMArray f s a)
m ST Any (UMArray f Any a) -> UArray f a -> UArray f a
`seq` (forall s. ST s (UArray f a)) -> UArray f a
forall a. (forall s. ST s a) -> a
runST (ST s (UMArray f s a)
forall s. ST s (UMArray f s a)
m ST s (UMArray f s a)
-> (UMArray f s a -> ST s (UArray f a)) -> ST s (UArray f a)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= UMArray f s a -> ST s (UArray f a)
forall (m :: * -> *) (v :: * -> *) a (f :: * -> *).
(PrimMonad m, Vector v a) =>
MArray (Mutable v) f (PrimState m) a -> m (Array v f a)
G.unsafeFreeze)
{-# INLINE create #-}
replicate :: (Shape f, Unbox a) => f Int -> a -> UArray f a
replicate :: f Int -> a -> UArray f a
replicate = f Int -> a -> UArray f a
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
f Int -> a -> Array v f a
G.replicate
{-# INLINE replicate #-}
linearGenerate :: (Shape f, Unbox a) => Layout f -> (Int -> a) -> UArray f a
linearGenerate :: Layout f -> (Int -> a) -> UArray f a
linearGenerate = Layout f -> (Int -> a) -> UArray f a
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Layout f -> (Int -> a) -> Array v f a
G.linearGenerate
{-# INLINE linearGenerate #-}
generate :: (Shape f, Unbox a) => Layout f -> (f Int -> a) -> UArray f a
generate :: Layout f -> (Layout f -> a) -> UArray f a
generate = Layout f -> (Layout f -> a) -> UArray f a
forall (f :: * -> *) (v :: * -> *) a.
(Shape f, Vector v a) =>
Layout f -> (Layout f -> a) -> Array v f a
G.generate
{-# INLINE generate #-}
replicateM :: (Monad m, Shape f, Unbox a) => Layout f -> m a -> m (UArray f a)
replicateM :: Layout f -> m a -> m (UArray f a)
replicateM = Layout f -> m a -> m (UArray f a)
forall (m :: * -> *) (f :: * -> *) (v :: * -> *) a.
(Monad m, Shape f, Vector v a) =>
Layout f -> m a -> m (Array v f a)
G.replicateM
{-# INLINE replicateM #-}
generateM :: (Monad m, Shape f, Unbox a) => Layout f -> (f Int -> m a) -> m (UArray f a)
generateM :: Layout f -> (Layout f -> m a) -> m (UArray f a)
generateM = Layout f -> (Layout f -> m a) -> m (UArray f a)
forall (m :: * -> *) (f :: * -> *) (v :: * -> *) a.
(Monad m, Shape f, Vector v a) =>
Layout f -> (Layout f -> m a) -> m (Array v f a)
G.generateM
{-# INLINE generateM #-}
linearGenerateM :: (Monad m, Shape f, Unbox a) => Layout f -> (Int -> m a) -> m (UArray f a)
linearGenerateM :: Layout f -> (Int -> m a) -> m (UArray f a)
linearGenerateM = Layout f -> (Int -> m a) -> m (UArray f a)
forall (m :: * -> *) (f :: * -> *) (v :: * -> *) a.
(Monad m, Shape f, Vector v a) =>
Layout f -> (Int -> m a) -> m (Array v f a)
G.linearGenerateM
{-# INLINE linearGenerateM #-}
map :: (Unbox a, Unbox b) => (a -> b) -> UArray f a -> UArray f b
map :: (a -> b) -> UArray f a -> UArray f b
map = (a -> b) -> UArray f a -> UArray f b
forall (v :: * -> *) a b (f :: * -> *).
(Vector v a, Vector v b) =>
(a -> b) -> Array v f a -> Array v f b
G.map
{-# INLINE map #-}
imap :: (Shape f, Unbox a, Unbox b) => (f Int -> a -> b) -> UArray f a -> UArray f b
imap :: (f Int -> a -> b) -> UArray f a -> UArray f b
imap = (f Int -> a -> b) -> UArray f a -> UArray f b
forall (f :: * -> *) (v :: * -> *) a b.
(Shape f, Vector v a, Vector v b) =>
(f Int -> a -> b) -> Array v f a -> Array v f b
G.imap
{-# INLINE imap #-}
(//) :: (Unbox a, Shape f) => UArray f a -> [(f Int, a)] -> UArray f a
// :: UArray f a -> [(f Int, a)] -> UArray f a
(//) = UArray f a -> [(f Int, a)] -> UArray f a
forall (v :: * -> *) a (f :: * -> *).
(Vector v a, Shape f) =>
Array v f a -> [(f Int, a)] -> Array v f a
(G.//)
{-# INLINE (//) #-}
accum :: (Shape f, Unbox a)
=> (a -> b -> a)
-> UArray f a
-> [(f Int, b)]
-> UArray f a
accum :: (a -> b -> a) -> UArray f a -> [(f Int, b)] -> UArray f a
accum = (a -> b -> a) -> UArray f a -> [(f Int, b)] -> UArray f a
forall (f :: * -> *) (v :: * -> *) a b.
(Shape f, Vector v a) =>
(a -> b -> a) -> Array v f a -> [(f Int, b)] -> Array v f a
G.accum
{-# INLINE accum #-}
zip :: (Shape f, Unbox a, Unbox b)
=> UArray f a
-> UArray f b
-> UArray f (a,b)
zip :: UArray f a -> UArray f b -> UArray f (a, b)
zip = UArray f a -> UArray f b -> UArray f (a, b)
forall (f :: * -> *) (v :: * -> *) a b.
(Shape f, Vector v a, Vector v b, Vector v (a, b)) =>
Array v f a -> Array v f b -> Array v f (a, b)
G.zip
zip3 :: (Shape f, Unbox a, Unbox b, Unbox c)
=> UArray f a
-> UArray f b
-> UArray f c
-> UArray f (a,b,c)
zip3 :: UArray f a -> UArray f b -> UArray f c -> UArray f (a, b, c)
zip3 = UArray f a -> UArray f b -> UArray f c -> UArray f (a, b, c)
forall (f :: * -> *) (v :: * -> *) a b c.
(Shape f, Vector v a, Vector v b, Vector v c,
Vector v (a, b, c)) =>
Array v f a -> Array v f b -> Array v f c -> Array v f (a, b, c)
G.zip3
zipWith :: (Shape f, Unbox a, Unbox b, Unbox c)
=> (a -> b -> c)
-> UArray f a
-> UArray f b
-> UArray f c
zipWith :: (a -> b -> c) -> UArray f a -> UArray f b -> UArray f c
zipWith = (a -> b -> c) -> UArray f a -> UArray f b -> UArray f c
forall (f :: * -> *) (v :: * -> *) a b c.
(Shape f, Vector v a, Vector v b, Vector v c) =>
(a -> b -> c) -> Array v f a -> Array v f b -> Array v f c
G.zipWith
{-# INLINE zipWith #-}
zipWith3 :: (Shape f, Unbox a, Unbox b, Unbox c, Unbox d)
=> (a -> b -> c -> d)
-> UArray f a
-> UArray f b
-> UArray f c
-> UArray f d
zipWith3 :: (a -> b -> c -> d)
-> UArray f a -> UArray f b -> UArray f c -> UArray f d
zipWith3 = (a -> b -> c -> d)
-> UArray f a -> UArray f b -> UArray f c -> UArray f d
forall (f :: * -> *) (v :: * -> *) a b c d.
(Shape f, Vector v a, Vector v b, Vector v c, Vector v d) =>
(a -> b -> c -> d)
-> Array v f a -> Array v f b -> Array v f c -> Array v f d
G.zipWith3
{-# INLINE zipWith3 #-}
izipWith :: (Shape f, Unbox a, Unbox b, Unbox c)
=> (f Int -> a -> b -> c)
-> UArray f a
-> UArray f b
-> UArray f c
izipWith :: (f Int -> a -> b -> c) -> UArray f a -> UArray f b -> UArray f c
izipWith = (f Int -> a -> b -> c) -> UArray f a -> UArray f b -> UArray f c
forall (f :: * -> *) (v :: * -> *) a b c.
(Shape f, Vector v a, Vector v b, Vector v c) =>
(f Int -> a -> b -> c) -> Array v f a -> Array v f b -> Array v f c
G.izipWith
{-# INLINE izipWith #-}
izipWith3 :: (Shape f, Unbox a, Unbox b, Unbox c, Unbox d)
=> (f Int -> a -> b -> c -> d)
-> UArray f a
-> UArray f b
-> UArray f c
-> UArray f d
izipWith3 :: (f Int -> a -> b -> c -> d)
-> UArray f a -> UArray f b -> UArray f c -> UArray f d
izipWith3 = (f Int -> a -> b -> c -> d)
-> UArray f a -> UArray f b -> UArray f c -> UArray f d
forall (f :: * -> *) (v :: * -> *) a b c d.
(Shape f, Vector v a, Vector v b, Vector v c, Vector v d) =>
(f Int -> a -> b -> c -> d)
-> Array v f a -> Array v f b -> Array v f c -> Array v f d
G.izipWith3
{-# INLINE izipWith3 #-}
rows :: (Unbox a, Unbox b)
=> IndexedTraversal Int (UArray V2 a) (UArray V2 b) (Vector a) (Vector b)
rows :: IndexedTraversal
Int (UArray V2 a) (UArray V2 b) (Vector a) (Vector b)
rows = p (Vector a) (f (Vector b)) -> UArray V2 a -> f (UArray V2 b)
forall (v :: * -> *) a (w :: * -> *) b.
(Vector v a, Vector w b) =>
IndexedTraversal Int (Array v V2 a) (Array w V2 b) (v a) (w b)
G.rows
{-# INLINE rows #-}
ixRow :: Unbox a => Int -> IndexedTraversal' Int (UArray V2 a) (Vector a)
ixRow :: Int -> IndexedTraversal' Int (UArray V2 a) (Vector a)
ixRow = Int
-> p (Vector a) (f (Vector a)) -> UArray V2 a -> f (UArray V2 a)
forall (v :: * -> *) a.
Vector v a =>
Int -> IndexedTraversal' Int (Array v V2 a) (v a)
G.ixRow
{-# INLINE ixRow #-}
columns :: (Unbox a, Unbox b)
=> IndexedTraversal Int (UArray V2 a) (UArray V2 b) (Vector a) (Vector b)
columns :: IndexedTraversal
Int (UArray V2 a) (UArray V2 b) (Vector a) (Vector b)
columns = p (Vector a) (f (Vector b)) -> UArray V2 a -> f (UArray V2 b)
forall (v :: * -> *) a (w :: * -> *) b.
(Vector v a, Vector w b) =>
IndexedTraversal Int (Array v V2 a) (Array w V2 b) (v a) (w b)
G.columns
{-# INLINE columns #-}
ixColumn :: Unbox a => Int -> IndexedTraversal' Int (UArray V2 a) (Vector a)
ixColumn :: Int -> IndexedTraversal' Int (UArray V2 a) (Vector a)
ixColumn = Int
-> p (Vector a) (f (Vector a)) -> UArray V2 a -> f (UArray V2 a)
forall (v :: * -> *) a.
Vector v a =>
Int -> IndexedTraversal' Int (Array v V2 a) (v a)
G.ixColumn
{-# INLINE ixColumn #-}
ixPlane :: Unbox a
=> ALens' (V3 Int) (V2 Int)
-> Int
-> IndexedTraversal' Int (UArray V3 a) (UArray V2 a)
ixPlane :: ALens' (V3 Int) (V2 Int)
-> Int -> IndexedTraversal' Int (UArray V3 a) (UArray V2 a)
ixPlane = ALens' (V3 Int) (V2 Int)
-> Int
-> p (UArray V2 a) (f (UArray V2 a))
-> UArray V3 a
-> f (UArray V3 a)
forall (v :: * -> *) a.
Vector v a =>
ALens' (V3 Int) (V2 Int)
-> Int -> IndexedTraversal' Int (Array v V3 a) (Array v V2 a)
G.ixPlane
{-# INLINE ixPlane #-}
planes :: (Unbox a, Unbox b)
=> ALens' (V3 Int) (V2 Int)
-> IndexedTraversal Int (UArray V3 a) (UArray V3 b) (UArray V2 a) (UArray V2 b)
planes :: ALens' (V3 Int) (V2 Int)
-> IndexedTraversal
Int (UArray V3 a) (UArray V3 b) (UArray V2 a) (UArray V2 b)
planes = ALens' (V3 Int) (V2 Int)
-> p (UArray V2 a) (f (UArray V2 b))
-> UArray V3 a
-> f (UArray V3 b)
forall (v :: * -> *) a (w :: * -> *) b.
(Vector v a, Vector w b) =>
ALens' (V3 Int) (V2 Int)
-> IndexedTraversal
Int (Array v V3 a) (Array w V3 b) (Array v V2 a) (Array w V2 b)
G.planes
{-# INLINE planes #-}
flattenPlane :: (Unbox a, Unbox b)
=> ALens' (V3 Int) (V2 Int)
-> (Vector a -> b)
-> UArray V3 a
-> UArray V2 b
flattenPlane :: ALens' (V3 Int) (V2 Int)
-> (Vector a -> b) -> UArray V3 a -> UArray V2 b
flattenPlane = ALens' (V3 Int) (V2 Int)
-> (Vector a -> b) -> UArray V3 a -> UArray V2 b
forall (v :: * -> *) a (w :: * -> *) b.
(Vector v a, Vector w b) =>
ALens' (V3 Int) (V2 Int)
-> (v a -> b) -> Array v V3 a -> Array w V2 b
G.flattenPlane
{-# INLINE flattenPlane #-}
unsafeOrdinals :: (Unbox a, Shape f) => [f Int] -> IndexedTraversal' (f Int) (UArray f a) a
unsafeOrdinals :: [f Int] -> IndexedTraversal' (f Int) (UArray f a) a
unsafeOrdinals = [f Int] -> p a (f a) -> UArray f a -> f (UArray f a)
forall (v :: * -> *) a (f :: * -> *).
(Vector v a, Shape f) =>
[f Int] -> IndexedTraversal' (f Int) (Array v f a) a
G.unsafeOrdinals
{-# INLINE [0] unsafeOrdinals #-}
freeze :: (PrimMonad m, Unbox a)
=> UMArray f (PrimState m) a -> m (UArray f a)
freeze :: UMArray f (PrimState m) a -> m (UArray f a)
freeze = UMArray f (PrimState m) a -> m (UArray f a)
forall (m :: * -> *) (v :: * -> *) a (f :: * -> *).
(PrimMonad m, Vector v a) =>
MArray (Mutable v) f (PrimState m) a -> m (Array v f a)
G.freeze
{-# INLINE freeze #-}
thaw :: (PrimMonad m, Unbox a)
=> UArray f a -> m (UMArray f (PrimState m) a)
thaw :: UArray f a -> m (UMArray f (PrimState m) a)
thaw = UArray f a -> m (UMArray f (PrimState m) a)
forall (m :: * -> *) (v :: * -> *) a (f :: * -> *).
(PrimMonad m, Vector v a) =>
Array v f a -> m (MArray (Mutable v) f (PrimState m) a)
G.thaw
{-# INLINE thaw #-}
unsafeFreeze :: (PrimMonad m, Unbox a)
=> UMArray f (PrimState m) a -> m (UArray f a)
unsafeFreeze :: UMArray f (PrimState m) a -> m (UArray f a)
unsafeFreeze = UMArray f (PrimState m) a -> m (UArray f a)
forall (m :: * -> *) (v :: * -> *) a (f :: * -> *).
(PrimMonad m, Vector v a) =>
MArray (Mutable v) f (PrimState m) a -> m (Array v f a)
G.unsafeFreeze
{-# INLINE unsafeFreeze #-}
unsafeThaw :: (PrimMonad m, Unbox a)
=> UArray f a -> m (UMArray f (PrimState m) a)
unsafeThaw :: UArray f a -> m (UMArray f (PrimState m) a)
unsafeThaw = UArray f a -> m (UMArray f (PrimState m) a)
forall (m :: * -> *) (v :: * -> *) a (f :: * -> *).
(PrimMonad m, Vector v a) =>
Array v f a -> m (MArray (Mutable v) f (PrimState m) a)
G.unsafeThaw
{-# INLINE unsafeThaw #-}
delayed :: (Unbox a, Unbox b, Shape f, Shape k)
=> Iso (UArray f a) (UArray k b) (G.Delayed f a) (G.Delayed k b)
delayed :: Iso (UArray f a) (UArray k b) (Delayed f a) (Delayed k b)
delayed = p (Delayed f a) (f (Delayed k b))
-> p (UArray f a) (f (UArray k b))
forall (v :: * -> *) a (w :: * -> *) b (f :: * -> *) (g :: * -> *).
(Vector v a, Vector w b, Shape f, Shape g) =>
Iso (Array v f a) (Array w g b) (Delayed f a) (Delayed g b)
G.delayed
{-# INLINE delayed #-}
seqDelayed :: (Unbox a, Unbox b, Shape f, Shape k)
=> Iso (UArray f a) (UArray k b) (G.Delayed f a) (G.Delayed k b)
seqDelayed :: Iso (UArray f a) (UArray k b) (Delayed f a) (Delayed k b)
seqDelayed = p (Delayed f a) (f (Delayed k b))
-> p (UArray f a) (f (UArray k b))
forall (v :: * -> *) a (w :: * -> *) b (f :: * -> *) (g :: * -> *).
(Vector v a, Vector w b, Shape f, Shape g) =>
Iso (Array v f a) (Array w g b) (Delayed f a) (Delayed g b)
G.seqDelayed
{-# INLINE seqDelayed #-}
delay :: (Unbox a, Shape f) => UArray f a -> G.Delayed f a
delay :: UArray f a -> Delayed f a
delay = UArray f a -> Delayed f a
forall (v :: * -> *) a (f :: * -> *).
(Vector v a, Shape f) =>
Array v f a -> Delayed f a
G.delay
{-# INLINE delay #-}
manifest :: (Unbox a, Shape f) => G.Delayed f a -> UArray f a
manifest :: Delayed f a -> UArray f a
manifest = Delayed f a -> UArray f a
forall (v :: * -> *) a (f :: * -> *).
(Vector v a, Shape f) =>
Delayed f a -> Array v f a
G.manifest
{-# INLINE manifest #-}
seqManifest :: (Unbox a, Shape f) => G.Delayed f a -> UArray f a
seqManifest :: Delayed f a -> UArray f a
seqManifest = Delayed f a -> UArray f a
forall (v :: * -> *) a (f :: * -> *).
(Vector v a, Shape f) =>
Delayed f a -> Array v f a
G.seqManifest
{-# INLINE seqManifest #-}
affirm :: (Shape f, Unbox a) => G.Delayed f a -> G.Delayed f a
affirm :: Delayed f a -> Delayed f a
affirm = UArray f a -> Delayed f a
forall a (f :: * -> *).
(Unbox a, Shape f) =>
UArray f a -> Delayed f a
delay (UArray f a -> Delayed f a)
-> (Delayed f a -> UArray f a) -> Delayed f a -> Delayed f a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Delayed f a -> UArray f a
forall a (f :: * -> *).
(Unbox a, Shape f) =>
Delayed f a -> UArray f a
manifest
{-# INLINE affirm #-}
seqAffirm :: (Shape f, Unbox a) => G.Delayed f a -> G.Delayed f a
seqAffirm :: Delayed f a -> Delayed f a
seqAffirm = UArray f a -> Delayed f a
forall a (f :: * -> *).
(Unbox a, Shape f) =>
UArray f a -> Delayed f a
delay (UArray f a -> Delayed f a)
-> (Delayed f a -> UArray f a) -> Delayed f a -> Delayed f a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Delayed f a -> UArray f a
forall a (f :: * -> *).
(Unbox a, Shape f) =>
Delayed f a -> UArray f a
seqManifest
{-# INLINE seqAffirm #-}