Skip to content

Commit 7d3220c

Browse files
m-bossartChrisRackauckas
authored andcommitted
tests for enzyme fastpow rule
1 parent e6983d3 commit 7d3220c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/fastpow.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using DiffEqBase: fastlog2, _exp2, fastpow
2+
using Enzyme, EnzymeTestUtils
23
using Test
34

45
@testset "Fast log2" begin
@@ -19,3 +20,23 @@ end
1920
errors = [abs(^(x, y) - fastpow(x, y)) for x in 0.001:0.001:1, y in 0.08:0.001:0.5]
2021
@test maximum(errors) < 1e-4
2122
end
23+
24+
@testset "Fast pow - Enzyme forward rule" begin
25+
@testset for RT in (Duplicated, DuplicatedNoNeed),
26+
Tx in (Const, Duplicated),
27+
Ty in (Const, Duplicated)
28+
x = 3.0
29+
y = 2.0
30+
test_forward(fastpow, RT, (x, Tx), (y, Ty), atol=0.1, rtol=0.1)
31+
end
32+
end
33+
34+
@testset "Fast pow - Enzyme reverse rule" begin
35+
@testset for RT in (Active,),
36+
Tx in (Active,),
37+
Ty in (Active,)
38+
x = 2.0
39+
y = 3.0
40+
test_reverse(fastpow, RT, (x, Tx), (y, Ty))
41+
end
42+
end

0 commit comments

Comments
 (0)