Skip to content

Commit 97abceb

Browse files
committed
Fix
1 parent 2290b5f commit 97abceb

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

test/testsuite/ad_utils.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,22 @@ end
165165

166166
is_cpu(A) = typeof(parent(A)) <: Array
167167

168+
"""
169+
project_hermitian_inplace!(A, alg)
170+
171+
Wrapper for `project_hermitian!(A, A, alg)`, invoked this way
172+
to avoid Enzyme's finite differences comparison getting confused.
173+
"""
174+
project_hermitian_inplace!(A, alg) = project_hermitian!(A, A, alg)
175+
176+
"""
177+
project_antihermitian_inplace!(A, alg)
178+
179+
Wrapper for `project_hermitian!(A, A, alg)`, invoked this way
180+
to avoid Enzyme's finite differences comparison getting confused.
181+
"""
182+
project_antihermitian_inplace!(A, alg) = project_antihermitian!(A, A, alg)
183+
168184

169185
enzyme_fdm(T) = eltype(T) <: Union{Float32, ComplexF32} ? EnzymeTestUtils.FiniteDifferences.central_fdm(5, 1, max_range = 1.0e-2) : EnzymeTestUtils.FiniteDifferences.central_fdm(5, 1)
170186

test/testsuite/enzyme/projections.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ function test_enzyme_project_hermitian(
2727
B = instantiate_matrix(T, sz)
2828
alg = MatrixAlgebraKit.select_algorithm(project_hermitian, A)
2929
test_reverse(project_hermitian, RT, (A, TA), (alg, Const); atol, rtol, fdm)
30-
#test_reverse(project_hermitian!, RT, (A, TA), (A, TA), (alg, Const); atol, rtol, fdm)
3130
test_reverse(project_hermitian!, RT, (A, TA), (B, TA), (alg, Const); atol, rtol, fdm)
31+
test_reverse(project_hermitian_inplace!, RT, (A, TA), (alg, Const); atol, rtol, fdm)
3232
end
3333
end
3434

@@ -47,7 +47,7 @@ function test_enzyme_project_antihermitian(
4747
B = instantiate_matrix(T, sz)
4848
alg = MatrixAlgebraKit.select_algorithm(project_hermitian, A)
4949
test_reverse(project_antihermitian, RT, (A, TA), (alg, Const); atol, rtol, fdm)
50-
#test_reverse(project_antihermitian!, RT, (A, TA), (A, TA), (alg, Const); atol, rtol, fdm)
5150
test_reverse(project_antihermitian!, RT, (A, TA), (B, TA), (alg, Const); atol, rtol, fdm)
51+
test_reverse(project_antihermitian_inplace!, RT, (A, TA), (alg, Const); atol, rtol, fdm)
5252
end
5353
end

0 commit comments

Comments
 (0)