-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathtest.jl
More file actions
70 lines (61 loc) · 1.89 KB
/
test.jl
File metadata and controls
70 lines (61 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using Pkg
Pkg.add("FiniteDiff")
using DifferentiationInterface, DifferentiationInterfaceTest
using DifferentiationInterface: DenseSparsityDetector
using FiniteDiff: FiniteDiff
using SparseMatrixColorings
using Test
using ExplicitImports
check_no_implicit_imports(DifferentiationInterface)
LOGGING = get(ENV, "CI", "false") == "false"
for backend in [AutoFiniteDiff()]
@test check_available(backend)
@test check_inplace(backend)
@test DifferentiationInterface.inner_preparation_behavior(backend) isa
DifferentiationInterface.PrepareInnerSimple
end
@testset "Dense" begin
test_differentiation(
AutoFiniteDiff(),
default_scenarios(;
include_constantified=true, include_cachified=true, use_tuples=true
);
excluded=[:second_derivative, :hvp],
logging=LOGGING,
)
test_differentiation(
SecondOrder(AutoFiniteDiff(; relstep=1e-5, absstep=1e-5), AutoFiniteDiff()),
default_scenarios();
logging=LOGGING,
rtol=1e-2,
)
test_differentiation(
[
AutoFiniteDiff(; relstep=cbrt(eps(Float64))),
AutoFiniteDiff(; relstep=cbrt(eps(Float64)), absstep=cbrt(eps(Float64))),
AutoFiniteDiff(; dir=0.5),
];
excluded=[:second_derivative, :hvp],
logging=LOGGING,
)
end
@testset "Sparse" begin
test_differentiation(
MyAutoSparse(AutoFiniteDiff()),
sparse_scenarios();
excluded=SECOND_ORDER,
logging=LOGGING,
)
end
@testset "Complex" begin
test_differentiation(AutoFiniteDiff(), complex_scenarios(); logging=LOGGING)
test_differentiation(
AutoSparse(
AutoFiniteDiff();
sparsity_detector=DenseSparsityDetector(AutoFiniteDiff(); atol=1e-5),
coloring_algorithm=GreedyColoringAlgorithm(),
),
complex_sparse_scenarios();
logging=LOGGING,
)
end;