{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Numeric.Rounded.Hardware.Vector.Unboxed
( roundedSum
, zipWith_roundedAdd
, zipWith_roundedSub
, zipWith_roundedMul
, zipWith3_roundedFusedMultiplyAdd
, zipWith_roundedDiv
, map_roundedSqrt
, sum
, zipWith_add
, zipWith_sub
, zipWith_mul
, zipWith3_fusedMultiplyAdd
, zipWith_div
, map_sqrt
) where
import Data.Coerce
import Data.Proxy
import qualified Data.Vector.Unboxed as VU
import Numeric.Rounded.Hardware.Internal
import Prelude hiding (sum)
sum :: forall r a. (Rounding r, VU.Unbox a, RoundedRing_Vector VU.Vector a) => VU.Vector (Rounded r a) -> Rounded r a
sum :: Vector (Rounded r a) -> Rounded r a
sum = (Vector a -> a) -> Vector (Rounded r a) -> Rounded r a
coerce (RoundingMode -> Vector a -> a
forall (vector :: * -> *) a.
RoundedRing_Vector vector a =>
RoundingMode -> vector a -> a
roundedSum RoundingMode
r :: VU.Vector a -> a)
where r :: RoundingMode
r = Proxy r -> RoundingMode
forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding (Proxy r
forall k (t :: k). Proxy t
Proxy :: Proxy r)
{-# INLINE sum #-}
zipWith_add :: forall r a. (Rounding r, VU.Unbox a, RoundedRing_Vector VU.Vector a) => VU.Vector (Rounded r a) -> VU.Vector (Rounded r a) -> VU.Vector (Rounded r a)
zipWith_add :: Vector (Rounded r a)
-> Vector (Rounded r a) -> Vector (Rounded r a)
zipWith_add = (Vector a -> Vector a -> Vector a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
coerce (RoundingMode -> Vector a -> Vector a -> Vector a
forall (vector :: * -> *) a.
RoundedRing_Vector vector a =>
RoundingMode -> vector a -> vector a -> vector a
zipWith_roundedAdd RoundingMode
r :: VU.Vector a -> VU.Vector a -> VU.Vector a)
where r :: RoundingMode
r = Proxy r -> RoundingMode
forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding (Proxy r
forall k (t :: k). Proxy t
Proxy :: Proxy r)
{-# INLINE zipWith_add #-}
zipWith_sub :: forall r a. (Rounding r, VU.Unbox a, RoundedRing_Vector VU.Vector a) => VU.Vector (Rounded r a) -> VU.Vector (Rounded r a) -> VU.Vector (Rounded r a)
zipWith_sub :: Vector (Rounded r a)
-> Vector (Rounded r a) -> Vector (Rounded r a)
zipWith_sub = (Vector a -> Vector a -> Vector a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
coerce (RoundingMode -> Vector a -> Vector a -> Vector a
forall (vector :: * -> *) a.
RoundedRing_Vector vector a =>
RoundingMode -> vector a -> vector a -> vector a
zipWith_roundedSub RoundingMode
r :: VU.Vector a -> VU.Vector a -> VU.Vector a)
where r :: RoundingMode
r = Proxy r -> RoundingMode
forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding (Proxy r
forall k (t :: k). Proxy t
Proxy :: Proxy r)
{-# INLINE zipWith_sub #-}
zipWith_mul :: forall r a. (Rounding r, VU.Unbox a, RoundedRing_Vector VU.Vector a) => VU.Vector (Rounded r a) -> VU.Vector (Rounded r a) -> VU.Vector (Rounded r a)
zipWith_mul :: Vector (Rounded r a)
-> Vector (Rounded r a) -> Vector (Rounded r a)
zipWith_mul = (Vector a -> Vector a -> Vector a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
coerce (RoundingMode -> Vector a -> Vector a -> Vector a
forall (vector :: * -> *) a.
RoundedRing_Vector vector a =>
RoundingMode -> vector a -> vector a -> vector a
zipWith_roundedMul RoundingMode
r :: VU.Vector a -> VU.Vector a -> VU.Vector a)
where r :: RoundingMode
r = Proxy r -> RoundingMode
forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding (Proxy r
forall k (t :: k). Proxy t
Proxy :: Proxy r)
{-# INLINE zipWith_mul #-}
zipWith3_fusedMultiplyAdd :: forall r a. (Rounding r, VU.Unbox a, RoundedRing_Vector VU.Vector a) => VU.Vector (Rounded r a) -> VU.Vector (Rounded r a) -> VU.Vector (Rounded r a) -> VU.Vector (Rounded r a)
zipWith3_fusedMultiplyAdd :: Vector (Rounded r a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
zipWith3_fusedMultiplyAdd = (Vector a -> Vector a -> Vector a -> Vector a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
coerce (RoundingMode -> Vector a -> Vector a -> Vector a -> Vector a
forall (vector :: * -> *) a.
RoundedRing_Vector vector a =>
RoundingMode -> vector a -> vector a -> vector a -> vector a
zipWith3_roundedFusedMultiplyAdd RoundingMode
r :: VU.Vector a -> VU.Vector a -> VU.Vector a -> VU.Vector a)
where r :: RoundingMode
r = Proxy r -> RoundingMode
forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding (Proxy r
forall k (t :: k). Proxy t
Proxy :: Proxy r)
{-# INLINE zipWith3_fusedMultiplyAdd #-}
zipWith_div :: forall r a. (Rounding r, VU.Unbox a, RoundedFractional_Vector VU.Vector a) => VU.Vector (Rounded r a) -> VU.Vector (Rounded r a) -> VU.Vector (Rounded r a)
zipWith_div :: Vector (Rounded r a)
-> Vector (Rounded r a) -> Vector (Rounded r a)
zipWith_div = (Vector a -> Vector a -> Vector a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
-> Vector (Rounded r a)
coerce (RoundingMode -> Vector a -> Vector a -> Vector a
forall (vector :: * -> *) a.
RoundedFractional_Vector vector a =>
RoundingMode -> vector a -> vector a -> vector a
zipWith_roundedDiv RoundingMode
r :: VU.Vector a -> VU.Vector a -> VU.Vector a)
where r :: RoundingMode
r = Proxy r -> RoundingMode
forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding (Proxy r
forall k (t :: k). Proxy t
Proxy :: Proxy r)
{-# INLINE zipWith_div #-}
map_sqrt :: forall r a. (Rounding r, VU.Unbox a, RoundedSqrt_Vector VU.Vector a) => VU.Vector (Rounded r a) -> VU.Vector (Rounded r a)
map_sqrt :: Vector (Rounded r a) -> Vector (Rounded r a)
map_sqrt = (Vector a -> Vector a)
-> Vector (Rounded r a) -> Vector (Rounded r a)
coerce (RoundingMode -> Vector a -> Vector a
forall (vector :: * -> *) a.
RoundedSqrt_Vector vector a =>
RoundingMode -> vector a -> vector a
map_roundedSqrt RoundingMode
r :: VU.Vector a -> VU.Vector a)
where r :: RoundingMode
r = Proxy r -> RoundingMode
forall (r :: RoundingMode) (proxy :: RoundingMode -> *).
Rounding r =>
proxy r -> RoundingMode
rounding (Proxy r
forall k (t :: k). Proxy t
Proxy :: Proxy r)
{-# INLINE map_sqrt #-}