module Data.Array.Repa.Repr.Hint
(S, Array (..), hintSmall)
where
import Data.Array.Repa.Base
import Data.Array.Repa.Eval.Fill
import Data.Array.Repa.Shape
data S r1
data instance Array (S r1) sh e
= ASmall !(Array r1 sh e)
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)
deriving instance Eq (Array r1 sh e)
=> Eq (Array (S r1) sh e)
hintSmall :: Array r1 sh e -> Array (S r1) sh e
hintSmall = ASmall
instance Repr r1 a => Repr (S r1) a where
extent (ASmall arr)
= extent arr
index (ASmall arr) ix
= index arr ix
unsafeIndex (ASmall arr) ix
= unsafeIndex arr ix
linearIndex (ASmall arr) ix
= linearIndex arr ix
unsafeLinearIndex (ASmall arr) ix
= unsafeLinearIndex arr ix
deepSeqArray (ASmall arr) x
= deepSeqArray arr x
instance ( Shape sh, Fill r1 r2 sh e)
=> Fill (S r1) r2 sh e where
fillP (ASmall arr) marr
= fillS arr marr
fillS (ASmall arr) marr
= fillS arr marr
instance ( Shape sh, FillRange r1 r2 sh e)
=> FillRange (S r1) r2 sh e where
fillRangeP (ASmall arr) marr ix1 ix2
= fillRangeS arr marr ix1 ix2
fillRangeS (ASmall arr) marr ix1 ix2
= fillRangeS arr marr ix1 ix2