|
15 | 15 | """ |
16 | 16 | test_enzyme_project_hermitian(T, sz; rng, atol, rtol) |
17 | 17 |
|
18 | | -Test the Enzyme reverse-mode AD rule for `project_hermitian` and its in-place variant. |
| 18 | +Test the Enzyme forward- and reverse-mode AD rule for `project_hermitian` and its in-place variant. |
19 | 19 | """ |
20 | 20 | function test_enzyme_project_hermitian( |
21 | 21 | T, sz; |
22 | 22 | rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T), |
23 | 23 | fdm = enzyme_fdm(T) |
24 | 24 | ) |
25 | | - return @testset "project_hermitian reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,) |
| 25 | + return @testset "project_hermitian: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,) |
26 | 26 | A = instantiate_matrix(T, sz) |
27 | 27 | B = instantiate_matrix(T, sz) |
28 | 28 | alg = MatrixAlgebraKit.select_algorithm(project_hermitian, A) |
29 | 29 | test_reverse(project_hermitian, RT, (A, TA), (alg, Const); atol, rtol, fdm) |
30 | 30 | test_reverse(project_hermitian!, RT, (A, TA), (B, TA), (alg, Const); atol, rtol, fdm) |
31 | 31 | test_reverse(project_hermitian_inplace!, RT, (A, TA), (alg, Const); atol, rtol, fdm) |
| 32 | + test_forward(project_hermitian, RT, (A, TA), (alg, Const); atol, rtol, fdm) |
| 33 | + test_forward(project_hermitian!, RT, (A, TA), (B, TA), (alg, Const); atol, rtol, fdm) |
| 34 | + test_forward(project_hermitian_inplace!, RT, (A, TA), (alg, Const); atol, rtol, fdm) |
32 | 35 | end |
33 | 36 | end |
34 | 37 |
|
35 | 38 | """ |
36 | 39 | test_enzyme_project_antihermitian(T, sz; rng, atol, rtol) |
37 | 40 |
|
38 | | -Test the Enzyme reverse-mode AD rule for `project_antihermitian` and its in-place variant. |
| 41 | +Test the Enzyme forward- and reverse-mode AD rule for `project_antihermitian` and its in-place variant. |
39 | 42 | """ |
40 | 43 | function test_enzyme_project_antihermitian( |
41 | 44 | T, sz; |
42 | 45 | rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T), |
43 | 46 | fdm = enzyme_fdm(T) |
44 | 47 | ) |
45 | | - return @testset "project_antihermitian reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,) |
| 48 | + return @testset "project_antihermitian: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,) |
46 | 49 | A = instantiate_matrix(T, sz) |
47 | 50 | B = instantiate_matrix(T, sz) |
48 | 51 | alg = MatrixAlgebraKit.select_algorithm(project_hermitian, A) |
49 | 52 | test_reverse(project_antihermitian, RT, (A, TA), (alg, Const); atol, rtol, fdm) |
50 | 53 | test_reverse(project_antihermitian!, RT, (A, TA), (B, TA), (alg, Const); atol, rtol, fdm) |
51 | 54 | test_reverse(project_antihermitian_inplace!, RT, (A, TA), (alg, Const); atol, rtol, fdm) |
| 55 | + test_forward(project_antihermitian, RT, (A, TA), (alg, Const); atol, rtol, fdm) |
| 56 | + test_forward(project_antihermitian!, RT, (A, TA), (B, TA), (alg, Const); atol, rtol, fdm) |
| 57 | + test_forward(project_antihermitian_inplace!, RT, (A, TA), (alg, Const); atol, rtol, fdm) |
52 | 58 | end |
53 | 59 | end |
0 commit comments