module Data.Array.Repa.Repr.HintSmall
(S, Array (..), hintSmall)
where
import Data.Array.Repa.Eval.Load
import Data.Array.Repa.Base
import Data.Array.Repa.Shape
data S r1
instance Source r1 a => Source (S r1) a where
data Array (S r1) sh a
= ASmall !(Array r1 sh a)
extent :: forall sh. Shape sh => Array (S r1) sh a -> sh
extent (ASmall Array r1 sh a
arr)
= Array r1 sh a -> sh
forall sh. Shape sh => Array r1 sh a -> sh
forall r e sh. (Source r e, Shape sh) => Array r sh e -> sh
extent Array r1 sh a
arr
{-# INLINE extent #-}
index :: forall sh. Shape sh => Array (S r1) sh a -> sh -> a
index (ASmall Array r1 sh a
arr) sh
ix
= Array r1 sh a -> sh -> a
forall sh. Shape sh => Array r1 sh a -> sh -> a
forall r e sh. (Source r e, Shape sh) => Array r sh e -> sh -> e
index Array r1 sh a
arr sh
ix
{-# INLINE index #-}
unsafeIndex :: forall sh. Shape sh => Array (S r1) sh a -> sh -> a
unsafeIndex (ASmall Array r1 sh a
arr) sh
ix
= Array r1 sh a -> sh -> a
forall sh. Shape sh => Array r1 sh a -> sh -> a
forall r e sh. (Source r e, Shape sh) => Array r sh e -> sh -> e
unsafeIndex Array r1 sh a
arr sh
ix
{-# INLINE unsafeIndex #-}
linearIndex :: forall sh. Shape sh => Array (S r1) sh a -> Int -> a
linearIndex (ASmall Array r1 sh a
arr) Int
ix
= Array r1 sh a -> Int -> a
forall sh. Shape sh => Array r1 sh a -> Int -> a
forall r e sh. (Source r e, Shape sh) => Array r sh e -> Int -> e
linearIndex Array r1 sh a
arr Int
ix
{-# INLINE linearIndex #-}
unsafeLinearIndex :: forall sh. Shape sh => Array (S r1) sh a -> Int -> a
unsafeLinearIndex (ASmall Array r1 sh a
arr) Int
ix
= Array r1 sh a -> Int -> a
forall sh. Shape sh => Array r1 sh a -> Int -> a
forall r e sh. (Source r e, Shape sh) => Array r sh e -> Int -> e
unsafeLinearIndex Array r1 sh a
arr Int
ix
{-# INLINE unsafeLinearIndex #-}
deepSeqArray :: forall sh b. Shape sh => Array (S r1) sh a -> b -> b
deepSeqArray (ASmall Array r1 sh a
arr) b
x
= Array r1 sh a -> b -> b
forall sh b. Shape sh => Array r1 sh a -> b -> b
forall r e sh b. (Source r e, Shape sh) => Array r sh e -> b -> b
deepSeqArray Array r1 sh a
arr b
x
{-# INLINE deepSeqArray #-}
hintSmall :: Array r1 sh e -> Array (S r1) sh e
hintSmall :: forall r1 sh e. Array r1 sh e -> Array (S r1) sh e
hintSmall = Array r1 sh e -> Array (S r1) sh e
forall r1 sh e. Array r1 sh e -> Array (S r1) sh e
ASmall
deriving instance Show (Array r1 sh e)
=> Show (Array (S r1) sh e)
deriving instance Read (Array r1 sh e)
=> Read (Array (S r1) sh e)
instance ( Shape sh, Load r1 sh e)
=> Load (S r1) sh e where
loadP :: forall r2. Target r2 e => Array (S r1) sh e -> MVec r2 e -> IO ()
loadP (ASmall Array r1 sh e
arr) MVec r2 e
marr
= Array r1 sh e -> MVec r2 e -> IO ()
forall r2. Target r2 e => Array r1 sh e -> MVec r2 e -> IO ()
forall r1 sh e r2.
(Load r1 sh e, Target r2 e) =>
Array r1 sh e -> MVec r2 e -> IO ()
loadS Array r1 sh e
arr MVec r2 e
marr
{-# INLINE loadP #-}
loadS :: forall r2. Target r2 e => Array (S r1) sh e -> MVec r2 e -> IO ()
loadS (ASmall Array r1 sh e
arr) MVec r2 e
marr
= Array r1 sh e -> MVec r2 e -> IO ()
forall r2. Target r2 e => Array r1 sh e -> MVec r2 e -> IO ()
forall r1 sh e r2.
(Load r1 sh e, Target r2 e) =>
Array r1 sh e -> MVec r2 e -> IO ()
loadS Array r1 sh e
arr MVec r2 e
marr
{-# INLINE loadS #-}
instance ( Shape sh, LoadRange r1 sh e)
=> LoadRange (S r1) sh e where
loadRangeP :: forall r2.
Target r2 e =>
Array (S r1) sh e -> MVec r2 e -> sh -> sh -> IO ()
loadRangeP (ASmall Array r1 sh e
arr) MVec r2 e
marr sh
ix1 sh
ix2
= Array r1 sh e -> MVec r2 e -> sh -> sh -> IO ()
forall r2.
Target r2 e =>
Array r1 sh e -> MVec r2 e -> sh -> sh -> IO ()
forall r1 sh e r2.
(LoadRange r1 sh e, Target r2 e) =>
Array r1 sh e -> MVec r2 e -> sh -> sh -> IO ()
loadRangeS Array r1 sh e
arr MVec r2 e
marr sh
ix1 sh
ix2
{-# INLINE loadRangeP #-}
loadRangeS :: forall r2.
Target r2 e =>
Array (S r1) sh e -> MVec r2 e -> sh -> sh -> IO ()
loadRangeS (ASmall Array r1 sh e
arr) MVec r2 e
marr sh
ix1 sh
ix2
= Array r1 sh e -> MVec r2 e -> sh -> sh -> IO ()
forall r2.
Target r2 e =>
Array r1 sh e -> MVec r2 e -> sh -> sh -> IO ()
forall r1 sh e r2.
(LoadRange r1 sh e, Target r2 e) =>
Array r1 sh e -> MVec r2 e -> sh -> sh -> IO ()
loadRangeS Array r1 sh e
arr MVec r2 e
marr sh
ix1 sh
ix2
{-# INLINE loadRangeS #-}