module Data.Array.Parallel.Prelude.Double
( Double
, (==), (/=), (<), (<=), (>), (>=), min, max
, maximumP, minimumP
, maxIndexP, minIndexP
, (+), (), (*), (/)
, negate, abs
, sumP, productP
, pi
, sqrt
, exp, (**)
, log, logBase
, sin, tan, cos
, asin, atan, acos
, sinh, tanh, cosh
, asinh, atanh, acosh
, fromInt)
where
import Data.Array.Parallel.Prim ()
import Data.Array.Parallel.Prelude.Base (Bool, Int, Double, Eq, Ord, Num)
import Data.Array.Parallel.PArr
import Data.Array.Parallel.PArray
import Data.Array.Parallel.Lifted ((:->)(..))
import qualified Data.Array.Parallel.Lifted as L
import qualified Data.Array.Parallel.PArray.Scalar as SC
import qualified Prelude as P
infixl 7 *, /
infixl 6 +,
infix 4 ==, /=, <, <=, >, >=
(==), (/=), (<), (<=), (>), (>=) :: Double -> Double -> Bool
(==) = (P.==)
(/=) = (P./=)
(<=) = (P.<=)
(<) = (P.<)
(>=) = (P.>=)
(>) = (P.>)
min, max :: Double -> Double -> Double
min = P.min
max = P.max
minimumP, maximumP :: PArr Double -> Double
minimumP arr = headPArr arr
maximumP arr = headPArr arr
minimumPP, maximumPP :: PArray Double :-> Double
minimumPP = L.closure1' (SC.fold1 P.min) (SC.fold1s P.min)
maximumPP = L.closure1' (SC.fold1 P.max) (SC.fold1s P.max)
minIndexP :: PArr Double -> Int
minIndexP !_ = 0
minIndexPP :: PArray Double :-> Int
minIndexPP = L.closure1' (SC.fold1Index min') (SC.fold1sIndex min')
min' :: P.Ord b => (a, b) -> (a, b) -> (a, b)
min' (i,x) (j,y) | x P.<= y = (i,x)
| P.otherwise = (j,y)
maxIndexP :: PArr Double -> Int
maxIndexP _ = 0
maxIndexPP :: PArray Double :-> Int
maxIndexPP = L.closure1' (SC.fold1Index max') (SC.fold1sIndex max')
max' :: P.Ord b => (a, b) -> (a, b) -> (a, b)
max' (i,x) (j,y) | x P.>= y = (i,x)
| P.otherwise = (j,y)
(+), (), (*), (/) :: Double -> Double -> Double
(+) = (P.+)
() = (P.-)
(*) = (P.*)
(/) = (P./)
negate, abs :: Double -> Double
negate = P.negate
abs = P.abs
sumP, productP :: PArr Double -> Double
sumP arr = headPArr arr
productP arr = headPArr arr
sumPP, productPP :: PArray Double :-> Double
sumPP = L.closure1' (SC.fold (+) 0) (SC.folds (+) 0)
productPP = L.closure1' (SC.fold (*) 1) (SC.folds (*) 1)
pi :: Double
pi = P.pi
sqrt, exp, log,
sin, tan, cos,
asin, atan, acos,
sinh, tanh, cosh,
asinh, atanh, acosh :: Double -> Double
exp = P.exp
sqrt = P.sqrt
log = P.log
sin = P.sin
tan = P.tan
cos = P.cos
asin = P.asin
atan = P.atan
acos = P.acos
sinh = P.sinh
tanh = P.tanh
cosh = P.cosh
asinh = P.asinh
atanh = P.atanh
acosh = P.acosh
(**), logBase :: Double -> Double -> Double
(**) = (P.**)
logBase = P.logBase
fromInt :: Int -> Double
fromInt = P.fromIntegral