Skip to content

Commit f7f7d4b

Browse files
committed
Merge branch 'master' of github.com:dmjio/haskfire
2 parents 5aa1c0a + f062329 commit f7f7d4b

File tree

2 files changed

+46
-12
lines changed

2 files changed

+46
-12
lines changed

src/ArrayFire/Arith.hs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,49 @@ tanh
12781278
-- ^ Result of calling 'tanh'
12791279
tanh = flip op1 af_tanh
12801280

1281+
-- | Execute asinh
1282+
--
1283+
-- >>> A.asinh (A.vector @Int 10 [1..])
1284+
-- ArrayFire Array
1285+
-- [10 1 1 1]
1286+
-- 0.7616 0.9640 0.9951 0.9993 0.9999 1.0000 1.0000 1.0000 1.0000 1.0000
1287+
asinh
1288+
:: AFType a
1289+
=> Array a
1290+
-- ^ Input array
1291+
-> Array a
1292+
-- ^ Result of calling 'tanh'
1293+
asinh = flip op1 af_asinh
1294+
1295+
-- | Execute acosh
1296+
--
1297+
-- >>> A.acosh (A.vector @Int 10 [1..])
1298+
-- ArrayFire Array
1299+
-- [10 1 1 1]
1300+
-- 0.7616 0.9640 0.9951 0.9993 0.9999 1.0000 1.0000 1.0000 1.0000 1.0000
1301+
acosh
1302+
:: AFType a
1303+
=> Array a
1304+
-- ^ Input array
1305+
-> Array a
1306+
-- ^ Result of calling 'tanh'
1307+
acosh = flip op1 af_acosh
1308+
1309+
-- | Execute atanh
1310+
--
1311+
-- >>> A.atanh (A.vector @Int 10 [1..])
1312+
-- ArrayFire Array
1313+
-- [10 1 1 1]
1314+
-- 0.7616 0.9640 0.9951 0.9993 0.9999 1.0000 1.0000 1.0000 1.0000 1.0000
1315+
atanh
1316+
:: AFType a
1317+
=> Array a
1318+
-- ^ Input array
1319+
-> Array a
1320+
-- ^ Result of calling 'tanh'
1321+
atanh = flip op1 af_atanh
1322+
1323+
12811324
-- | Execute root
12821325
--
12831326
-- >>> A.root (A.vector @Double 10 [1..]) (A.vector @Double 10 [1..])

src/ArrayFire/Orphans.hs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@ instance forall a . (Ord a, AFType a, Fractional a) => Floating (Array a) where
6666
atan = A.atan @a
6767
sinh = A.sinh @a
6868
cosh = A.cosh @a
69-
acosh x =
70-
A.log (x + (x+1.0) * A.sqrt ((x-1.0)/(x+1.0)))
71-
atanh x =
72-
0.5 * A.log ((1.0+x) / (1.0-x))
73-
asinh x
74-
| x > huge = A.log 2 + A.log x
75-
| x < 0 = -asinh (-x)
76-
| otherwise = A.log (x + A.sqrt (1 + x*x))
77-
where
78-
huge = 1e20
79-
80-
69+
acosh = A.acosh @a
70+
atanh = A.atanh @a
71+
asinh = A.asinh @a

0 commit comments

Comments
 (0)