|
1 | 1 | {-# LANGUAGE TypeApplications #-}
|
| 2 | +{-# LANGUAGE FlexibleContexts #-} |
2 | 3 | {-# LANGUAGE ScopedTypeVariables #-}
|
3 | 4 | {-# LANGUAGE ViewPatterns #-}
|
4 | 5 | --------------------------------------------------------------------------------
|
|
24 | 25 | --------------------------------------------------------------------------------
|
25 | 26 | module ArrayFire.Arith where
|
26 | 27 |
|
27 |
| -import Prelude (Bool(..), ($), (.), flip, fromEnum, fromIntegral, Real) |
| 28 | +import Prelude (Bool(..), ($), (.), flip, fromEnum, fromIntegral, Real, RealFrac) |
28 | 29 |
|
29 | 30 | import Data.Coerce
|
30 | 31 | import Data.Proxy
|
| 32 | +import Data.Complex |
31 | 33 |
|
32 | 34 | import ArrayFire.FFI
|
33 | 35 | import ArrayFire.Internal.Arith
|
@@ -1195,31 +1197,31 @@ cplx = flip op1 af_cplx
|
1195 | 1197 |
|
1196 | 1198 | -- | Execute real
|
1197 | 1199 | --
|
1198 |
| --- >>> A.real (A.vector @Double 10 [1..]) |
| 1200 | +-- >>> A.real (A.scalar @(Complex Double) (10 :+ 11)) :: Array Double |
1199 | 1201 | -- ArrayFire Array
|
1200 | 1202 | -- [10 1 1 1]
|
1201 |
| --- 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000 10.0000 |
| 1203 | +-- 10.0000 |
1202 | 1204 | real
|
1203 |
| - :: AFType a |
1204 |
| - => Array a |
| 1205 | + :: (AFType a, AFType (Complex b), RealFrac a, RealFrac b) |
| 1206 | + => Array (Complex b) |
1205 | 1207 | -- ^ Input array
|
1206 | 1208 | -> Array a
|
1207 | 1209 | -- ^ Result of calling 'real'
|
1208 |
| -real = flip op1 af_real |
| 1210 | +real = flip op1d af_real |
1209 | 1211 |
|
1210 | 1212 | -- | Execute imag
|
1211 | 1213 | --
|
1212 |
| --- >>> A.imag (A.vector @Double 10 [1..]) |
| 1214 | +-- >>> A.imag (A.scalar @(Complex Double) (10 :+ 11)) :: Array Double |
1213 | 1215 | -- ArrayFire Array
|
1214 | 1216 | -- [10 1 1 1]
|
1215 |
| --- 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 |
| 1217 | +-- 11.0000 |
1216 | 1218 | imag
|
1217 |
| - :: AFType a |
1218 |
| - => Array a |
| 1219 | + :: (AFType a, AFType (Complex b), RealFrac a, RealFrac b) |
| 1220 | + => Array (Complex b) |
1219 | 1221 | -- ^ Input array
|
1220 | 1222 | -> Array a
|
1221 | 1223 | -- ^ Result of calling 'imag'
|
1222 |
| -imag = flip op1 af_imag |
| 1224 | +imag = flip op1d af_imag |
1223 | 1225 |
|
1224 | 1226 | -- | Execute conjg
|
1225 | 1227 | --
|
|
0 commit comments