diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-03-13 09:32:47 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-03-13 09:32:47 +0100 |
commit | a67e8554cba70c54d6e10890ad54852b5d806c2b (patch) | |
tree | 5196b5de43fc4533fc0dcdb416f193f577ffb836 /src/Data/Array/Nested/Internal/Shaped.hs | |
parent | a87c80b1fbaa826142605d0846479c94d6ee2bcc (diff) |
Rename arithPromote* to lift* (unrelated to arith ops, really)
Diffstat (limited to 'src/Data/Array/Nested/Internal/Shaped.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Shaped.hs | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs index 03631b0..35628db 100644 --- a/src/Data/Array/Nested/Internal/Shaped.hs +++ b/src/Data/Array/Nested/Internal/Shaped.hs @@ -186,60 +186,60 @@ instance (KnownShS sh, KnownElt a) => KnownElt (Shaped sh a) where = MV_Shaped <$> mvecsNewEmpty (Proxy @(Mixed (MapJust sh) a)) -arithPromoteShaped :: forall sh a b. - (Mixed (MapJust sh) a -> Mixed (MapJust sh) b) - -> Shaped sh a -> Shaped sh b -arithPromoteShaped = coerce +liftShaped1 :: forall sh a b. + (Mixed (MapJust sh) a -> Mixed (MapJust sh) b) + -> Shaped sh a -> Shaped sh b +liftShaped1 = coerce -arithPromoteShaped2 :: forall sh a b c. - (Mixed (MapJust sh) a -> Mixed (MapJust sh) b -> Mixed (MapJust sh) c) - -> Shaped sh a -> Shaped sh b -> Shaped sh c -arithPromoteShaped2 = coerce +liftShaped2 :: forall sh a b c. + (Mixed (MapJust sh) a -> Mixed (MapJust sh) b -> Mixed (MapJust sh) c) + -> Shaped sh a -> Shaped sh b -> Shaped sh c +liftShaped2 = coerce instance (NumElt a, PrimElt a) => Num (Shaped sh a) where - (+) = arithPromoteShaped2 (+) - (-) = arithPromoteShaped2 (-) - (*) = arithPromoteShaped2 (*) - negate = arithPromoteShaped negate - abs = arithPromoteShaped abs - signum = arithPromoteShaped signum + (+) = liftShaped2 (+) + (-) = liftShaped2 (-) + (*) = liftShaped2 (*) + negate = liftShaped1 negate + abs = liftShaped1 abs + signum = liftShaped1 signum fromInteger = error "Data.Array.Nested.fromInteger: No singletons available, use explicit sreplicateScal" instance (FloatElt a, PrimElt a) => Fractional (Shaped sh a) where fromRational = error "Data.Array.Nested.fromRational: No singletons available, use explicit sreplicateScal" - recip = arithPromoteShaped recip - (/) = arithPromoteShaped2 (/) + recip = liftShaped1 recip + (/) = liftShaped2 (/) instance (FloatElt a, PrimElt a) => Floating (Shaped sh a) where pi = error "Data.Array.Nested.pi: No singletons available, use explicit sreplicateScal" - exp = arithPromoteShaped exp - log = arithPromoteShaped log - sqrt = arithPromoteShaped sqrt - (**) = arithPromoteShaped2 (**) - logBase = arithPromoteShaped2 logBase - sin = arithPromoteShaped sin - cos = arithPromoteShaped cos - tan = arithPromoteShaped tan - asin = arithPromoteShaped asin - acos = arithPromoteShaped acos - atan = arithPromoteShaped atan - sinh = arithPromoteShaped sinh - cosh = arithPromoteShaped cosh - tanh = arithPromoteShaped tanh - asinh = arithPromoteShaped asinh - acosh = arithPromoteShaped acosh - atanh = arithPromoteShaped atanh - log1p = arithPromoteShaped GHC.Float.log1p - expm1 = arithPromoteShaped GHC.Float.expm1 - log1pexp = arithPromoteShaped GHC.Float.log1pexp - log1mexp = arithPromoteShaped GHC.Float.log1mexp + exp = liftShaped1 exp + log = liftShaped1 log + sqrt = liftShaped1 sqrt + (**) = liftShaped2 (**) + logBase = liftShaped2 logBase + sin = liftShaped1 sin + cos = liftShaped1 cos + tan = liftShaped1 tan + asin = liftShaped1 asin + acos = liftShaped1 acos + atan = liftShaped1 atan + sinh = liftShaped1 sinh + cosh = liftShaped1 cosh + tanh = liftShaped1 tanh + asinh = liftShaped1 asinh + acosh = liftShaped1 acosh + atanh = liftShaped1 atanh + log1p = liftShaped1 GHC.Float.log1p + expm1 = liftShaped1 GHC.Float.expm1 + log1pexp = liftShaped1 GHC.Float.log1pexp + log1mexp = liftShaped1 GHC.Float.log1mexp squotArray, sremArray :: (IntElt a, PrimElt a) => Shaped sh a -> Shaped sh a -> Shaped sh a -squotArray = arithPromoteShaped2 mquotArray -sremArray = arithPromoteShaped2 mremArray +squotArray = liftShaped2 mquotArray +sremArray = liftShaped2 mremArray satan2Array :: (FloatElt a, PrimElt a) => Shaped sh a -> Shaped sh a -> Shaped sh a -satan2Array = arithPromoteShaped2 matan2Array +satan2Array = liftShaped2 matan2Array semptyArray :: KnownElt a => ShS sh -> Shaped (0 : sh) a |