2828--------------------------------------------------------------------------------
2929module ArrayFire.Arith where
3030
31- import Prelude (Bool (.. ), ($) , (.) , flip , fromEnum , fromIntegral , Real , RealFrac )
31+ import Prelude (Bool (.. ), ($) , (.) , flip , fromEnum , fromIntegral , Real , RealFloat )
3232
3333import Data.Coerce
3434import Data.Proxy
@@ -1315,12 +1315,12 @@ atan2Batched x y (fromIntegral . fromEnum -> batch) = do
13151315-- (9.0000,9.0000)
13161316-- (10.0000,10.0000)
13171317cplx2
1318- :: AFType a
1318+ :: ( RealFloat a , AFType a , AFType ( Complex a ))
13191319 => Array a
1320- -- ^ First input
1321- -> Array a
1322- -- ^ Second input
1320+ -- ^ First input (real part)
13231321 -> Array a
1322+ -- ^ Second input (imaginary part)
1323+ -> Array (Complex a )
13241324 -- ^ Result of cplx2
13251325cplx2 x y =
13261326 x `op2` y $ \ arr arr1 arr2 ->
@@ -1342,14 +1342,14 @@ cplx2 x y =
13421342-- (9.0000,9.0000)
13431343-- (10.0000,10.0000)
13441344cplx2Batched
1345- :: AFType a
1345+ :: ( RealFloat a , AFType a , AFType ( Complex a ))
13461346 => Array a
1347- -- ^ First input
1347+ -- ^ First input (real part)
13481348 -> Array a
1349- -- ^ Second input
1349+ -- ^ Second input (imaginary part)
13501350 -> Bool
13511351 -- ^ Use batch
1352- -> Array a
1352+ -> Array ( Complex a )
13531353 -- ^ Result of cplx2
13541354cplx2Batched x y (fromIntegral . fromEnum -> batch) = do
13551355 x `op2` y $ \ arr arr1 arr2 ->
@@ -1371,11 +1371,11 @@ cplx2Batched x y (fromIntegral . fromEnum -> batch) = do
13711371-- (9.0000,0.0000)
13721372-- (10.0000,0.0000)
13731373cplx
1374- :: AFType a
1374+ :: ( RealFloat a , AFType a , AFType ( Complex a ))
13751375 => Array a
13761376 -- ^ Input array
1377- -> Array a
1378- -- ^ Result of calling 'atan'
1377+ -> Array ( Complex a )
1378+ -- ^ Complex array with input as real part and zero imaginary part
13791379cplx = flip op1 af_cplx
13801380
13811381-- | Execute real
@@ -1385,11 +1385,11 @@ cplx = flip op1 af_cplx
13851385-- [1 1 1 1]
13861386-- 10.0000
13871387real
1388- :: (AFType a , AFType (Complex b ), RealFrac a , RealFrac b )
1389- => Array (Complex b )
1388+ :: (RealFloat a , AFType a , AFType (Complex a ) )
1389+ => Array (Complex a )
13901390 -- ^ Input array
13911391 -> Array a
1392- -- ^ Result of calling 'real'
1392+ -- ^ Real part of each element
13931393real = flip op1 af_real
13941394
13951395-- | Execute imag
@@ -1399,11 +1399,11 @@ real = flip op1 af_real
13991399-- [1 1 1 1]
14001400-- 11.0000
14011401imag
1402- :: (AFType a , AFType (Complex b ), RealFrac a , RealFrac b )
1403- => Array (Complex b )
1402+ :: (RealFloat a , AFType a , AFType (Complex a ) )
1403+ => Array (Complex a )
14041404 -- ^ Input array
14051405 -> Array a
1406- -- ^ Result of calling 'imag'
1406+ -- ^ Imaginary part of each element
14071407imag = flip op1 af_imag
14081408
14091409-- | Execute conjg
@@ -2043,7 +2043,7 @@ isZero
20432043 :: AFType a
20442044 => Array a
20452045 -- ^ Input array
2046- -> Array a
2046+ -> Array CBool
20472047 -- ^ Result of calling 'isZero'
20482048isZero = (`op1` af_iszero)
20492049
@@ -2066,7 +2066,7 @@ isInf
20662066 :: (Real a , AFType a )
20672067 => Array a
20682068 -- ^ Input array
2069- -> Array a
2069+ -> Array CBool
20702070 -- ^ will contain 1's where input is Inf or -Inf, and 0 otherwise.
20712071isInf = (`op1` af_isinf)
20722072
@@ -2086,9 +2086,9 @@ isInf = (`op1` af_isinf)
20862086-- 1
20872087-- 1
20882088isNaN
2089- :: forall a . (AFType a , Real a )
2089+ :: (AFType a , Real a )
20902090 => Array a
20912091 -- ^ Input array
2092- -> Array a
2092+ -> Array CBool
20932093 -- ^ Will contain 1's where input is NaN, and 0 otherwise.
20942094isNaN = (`op1` af_isnan)
0 commit comments