diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2024-05-20 16:42:25 +0200 | 
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2024-05-20 16:52:20 +0200 | 
| commit | 16e52d87e9955628a016946c10515c39ce4ef1d0 (patch) | |
| tree | f85b1440467a074e552505a854722a72c8be0baa /src/Data/Array/Nested | |
| parent | 6d624d24871ee30e36c73c890c8f4a7cdae54c1c (diff) | |
constant -> replicate
Diffstat (limited to 'src/Data/Array/Nested')
| -rw-r--r-- | src/Data/Array/Nested/Internal.hs | 32 | 
1 files changed, 16 insertions, 16 deletions
| diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs index 3863556..99c4a46 100644 --- a/src/Data/Array/Nested/Internal.hs +++ b/src/Data/Array/Nested/Internal.hs @@ -900,12 +900,12 @@ mtoList = map munScalar . mtoList1  munScalar :: Elt a => Mixed '[] a -> a  munScalar arr = mindex arr ZIX -mconstantP :: forall sh a. Storable a => IShX sh -> a -> Mixed sh (Primitive a) -mconstantP sh x = M_Primitive sh (X.constant sh x) +mreplicateP :: forall sh a. Storable a => IShX sh -> a -> Mixed sh (Primitive a) +mreplicateP sh x = M_Primitive sh (X.replicate sh x) -mconstant :: forall sh a. (Storable a, PrimElt a) +mreplicate :: forall sh a. (Storable a, PrimElt a)            => IShX sh -> a -> Mixed sh a -mconstant sh x = fromPrimitive (mconstantP sh x) +mreplicate sh x = fromPrimitive (mreplicateP sh x)  mslice :: Elt a => SNat i -> SNat n -> Mixed (Just (i + n + k) : sh) a -> Mixed (Just n : sh) a  mslice i n arr = @@ -954,7 +954,7 @@ instance (Storable a, Num a, PrimElt a) => Num (Mixed sh a) where    negate = mliftPrim negate    abs = mliftPrim abs    signum = mliftPrim signum -  fromInteger _ = error "Data.Array.Nested.fromIntegral: No singletons available, use explicit mconstant" +  fromInteger _ = error "Data.Array.Nested.fromIntegral: No singletons available, use explicit mreplicate"  mtoRanked :: forall sh a. Elt a => Mixed sh a -> Ranked (X.Rank sh) a  mtoRanked arr @@ -1238,7 +1238,7 @@ instance (Storable a, Num a, PrimElt a) => Num (Ranked n a) where    negate = arithPromoteRanked negate    abs = arithPromoteRanked abs    signum = arithPromoteRanked signum -  fromInteger _ = error "Data.Array.Nested.fromIntegral: No singletons available, use explicit mconstant" +  fromInteger _ = error "Data.Array.Nested.fromIntegral: No singletons available, use explicit mreplicate"  zeroIxR :: SNat n -> IIxR n  zeroIxR SZ = ZIR @@ -1389,14 +1389,14 @@ rtoList1 = map runScalar . rtoList  runScalar :: Elt a => Ranked 0 a -> a  runScalar arr = rindex arr ZIR -rconstantP :: forall n a. Storable a => IShR n -> a -> Ranked n (Primitive a) -rconstantP sh x +rreplicateP :: forall n a. Storable a => IShR n -> a -> Ranked n (Primitive a) +rreplicateP sh x    | Dict <- lemKnownReplicate (snatFromShR sh) -  = Ranked (mconstantP (shCvtRX sh) x) +  = Ranked (mreplicateP (shCvtRX sh) x) -rconstant :: forall n a. (Storable a, PrimElt a) +rreplicate :: forall n a. (Storable a, PrimElt a)            => IShR n -> a -> Ranked n a -rconstant sh x = coerce fromPrimitive (rconstantP sh x) +rreplicate sh x = coerce fromPrimitive (rreplicateP sh x)  rslice :: forall n a. Elt a => Int -> Int -> Ranked (n + 1) a -> Ranked (n + 1) a  rslice i n arr @@ -1458,7 +1458,7 @@ instance (Storable a, Num a, PrimElt a) => Num (Shaped sh a) where    negate = arithPromoteShaped negate    abs = arithPromoteShaped abs    signum = arithPromoteShaped signum -  fromInteger _ = error "Data.Array.Nested.fromIntegral: No singletons available, use explicit mconstant" +  fromInteger _ = error "Data.Array.Nested.fromIntegral: No singletons available, use explicit mreplicate"  zeroIxS :: ShS sh -> IIxS sh  zeroIxS ZSS = ZIS @@ -1619,11 +1619,11 @@ stoList1 = map sunScalar . stoList  sunScalar :: Elt a => Shaped '[] a -> a  sunScalar arr = sindex arr ZIS -sconstantP :: forall sh a. Storable a => ShS sh -> a -> Shaped sh (Primitive a) -sconstantP sh x = Shaped (mconstantP (shCvtSX sh) x) +sreplicateP :: forall sh a. Storable a => ShS sh -> a -> Shaped sh (Primitive a) +sreplicateP sh x = Shaped (mreplicateP (shCvtSX sh) x) -sconstant :: (Storable a, PrimElt a) => ShS sh -> a -> Shaped sh a -sconstant sh x = coerce fromPrimitive (sconstantP sh x) +sreplicate :: (Storable a, PrimElt a) => ShS sh -> a -> Shaped sh a +sreplicate sh x = coerce fromPrimitive (sreplicateP sh x)  sslice :: Elt a => SNat i -> SNat n -> Shaped (i + n + k : sh) a -> Shaped (n : sh) a  sslice i n@SNat arr = | 
