@@ -10,8 +10,6 @@ using MatrixAlgebraKit: remove_qr_gauge_dependence!, remove_qr_null_gauge_depend
1010using Enzyme, EnzymeTestUtils
1111using Random
1212
13- is_ci = get (ENV , " CI" , " false" ) == " true"
14-
1513spacelist = ad_spacelist (fast_tests)
1614eltypes = (Float64, ComplexF64)
1715
@@ -20,20 +18,18 @@ eltypes = (Float64, ComplexF64)
2018 rtol = default_tol (T)
2119
2220 @testset " SVD" begin
23- if ! is_ci
24- S = svd_vals (t)
25- EnzymeTestUtils. test_reverse (svd_vals, Duplicated, (t, Duplicated); atol, rtol)
21+ S = svd_vals (t)
22+ EnzymeTestUtils. test_reverse (svd_vals, Duplicated, (t, Duplicated); atol, rtol)
2623
27- USVᴴ = svd_full (t)
28- ΔUSVᴴ = EnzymeTestUtils. rand_tangent (USVᴴ)
29- remove_svd_gauge_dependence! (ΔUSVᴴ[1 ], ΔUSVᴴ[3 ], USVᴴ... )
30- EnzymeTestUtils. test_reverse (svd_full, Duplicated, (t, Duplicated); output_tangent = ΔUSVᴴ, atol, rtol)
24+ USVᴴ = svd_full (t)
25+ ΔUSVᴴ = EnzymeTestUtils. rand_tangent (USVᴴ)
26+ remove_svd_gauge_dependence! (ΔUSVᴴ[1 ], ΔUSVᴴ[3 ], USVᴴ... )
27+ EnzymeTestUtils. test_reverse (svd_full, Duplicated, (t, Duplicated); output_tangent = ΔUSVᴴ, atol, rtol)
3128
32- USVᴴ = svd_compact (t)
33- ΔUSVᴴ = EnzymeTestUtils. rand_tangent (USVᴴ)
34- remove_svd_gauge_dependence! (ΔUSVᴴ[1 ], ΔUSVᴴ[3 ], USVᴴ... )
35- EnzymeTestUtils. test_reverse (svd_compact, Duplicated, (t, Duplicated); output_tangent = ΔUSVᴴ, atol, rtol)
36- end
29+ USVᴴ = svd_compact (t)
30+ ΔUSVᴴ = EnzymeTestUtils. rand_tangent (USVᴴ)
31+ remove_svd_gauge_dependence! (ΔUSVᴴ[1 ], ΔUSVᴴ[3 ], USVᴴ... )
32+ EnzymeTestUtils. test_reverse (svd_compact, Duplicated, (t, Duplicated); output_tangent = ΔUSVᴴ, atol, rtol)
3733
3834 V_trunc = spacetype (t)(c => min (size (b)... ) ÷ 2 for (c, b) in blocks (t))
3935 trunc = truncspace (V_trunc)
@@ -47,56 +43,48 @@ eltypes = (Float64, ComplexF64)
4743 @testset " LQ" begin
4844 EnzymeTestUtils. test_reverse (lq_compact, Duplicated, (t, Duplicated); atol, rtol)
4945
50- if ! is_ci
51- # lq_full/lq_null requires being careful with gauges
52- LQ = lq_full (t)
53- ΔLQ = EnzymeTestUtils. rand_tangent (LQ)
54- remove_lq_gauge_dependence! (ΔLQ... , t, LQ... )
55- EnzymeTestUtils. test_reverse (lq_full, Duplicated, (t, Duplicated); output_tangent = ΔLQ, atol, rtol)
56-
57- Nᴴ = lq_null (t)
58- Q = lq_compact (t)[2 ]
59- ΔNᴴ = EnzymeTestUtils. rand_tangent (Nᴴ)
60- remove_lq_null_gauge_dependence! (ΔNᴴ, Q, Nᴴ)
61- EnzymeTestUtils. test_reverse (lq_null, Duplicated, (t, Duplicated); output_tangent = ΔNᴴ, atol, rtol)
62- end
46+ # lq_full/lq_null requires being careful with gauges
47+ LQ = lq_full (t)
48+ ΔLQ = EnzymeTestUtils. rand_tangent (LQ)
49+ remove_lq_gauge_dependence! (ΔLQ... , t, LQ... )
50+ EnzymeTestUtils. test_reverse (lq_full, Duplicated, (t, Duplicated); output_tangent = ΔLQ, atol, rtol)
51+
52+ Nᴴ = lq_null (t)
53+ Q = lq_compact (t)[2 ]
54+ ΔNᴴ = EnzymeTestUtils. rand_tangent (Nᴴ)
55+ remove_lq_null_gauge_dependence! (ΔNᴴ, Q, Nᴴ)
56+ EnzymeTestUtils. test_reverse (lq_null, Duplicated, (t, Duplicated); output_tangent = ΔNᴴ, atol, rtol)
6357 end
6458
6559 @testset " QR" begin
6660 EnzymeTestUtils. test_reverse (qr_compact, Duplicated, (t, Duplicated); atol, rtol)
6761
68- if ! is_ci
69- # qr_full/qr_null requires being careful with gauges
70- QR = qr_full (t)
71- ΔQR = EnzymeTestUtils. rand_tangent (QR)
72- remove_qr_gauge_dependence! (ΔQR... , t, QR... )
73- EnzymeTestUtils. test_reverse (qr_full, Duplicated, (t, Duplicated); output_tangent = ΔQR, atol, rtol)
74-
75- N = qr_null (t)
76- Q = qr_compact (t)[1 ]
77- ΔN = EnzymeTestUtils. rand_tangent (N)
78- remove_qr_null_gauge_dependence! (ΔN, t, N)
79- EnzymeTestUtils. test_reverse (qr_null, Duplicated, (t, Duplicated); atol, rtol, output_tangent = ΔN)
80- end
62+ # qr_full/qr_null requires being careful with gauges
63+ QR = qr_full (t)
64+ ΔQR = EnzymeTestUtils. rand_tangent (QR)
65+ remove_qr_gauge_dependence! (ΔQR... , t, QR... )
66+ EnzymeTestUtils. test_reverse (qr_full, Duplicated, (t, Duplicated); output_tangent = ΔQR, atol, rtol)
67+
68+ N = qr_null (t)
69+ Q = qr_compact (t)[1 ]
70+ ΔN = EnzymeTestUtils. rand_tangent (N)
71+ remove_qr_null_gauge_dependence! (ΔN, t, N)
72+ EnzymeTestUtils. test_reverse (qr_null, Duplicated, (t, Duplicated); atol, rtol, output_tangent = ΔN)
8173 end
82- TensorKit. empty_globalcaches! ()
83- GC. gc (true )
8474end
8575
8676@timedtestset " Enzyme - Factorizations (EIGH/EIG): $(TensorKit. type_repr (sectortype (eltype (V)))) ($T )" for V in spacelist, T in eltypes, t in (randn (T, V[1 ] ← V[1 ]), rand (T, V[1 ] ⊗ V[2 ] ← V[1 ] ⊗ V[2 ]))
8777 atol = default_tol (T)
8878 rtol = default_tol (T)
8979
9080 @testset " EIG" begin
91- if ! is_ci
92- DV = eig_full (t)
93- ΔDV = EnzymeTestUtils. rand_tangent (DV)
94- remove_eig_gauge_dependence! (ΔDV[2 ], DV... )
95- EnzymeTestUtils. test_reverse (eig_full, Duplicated, (t, Duplicated); output_tangent = ΔDV, atol, rtol)
81+ DV = eig_full (t)
82+ ΔDV = EnzymeTestUtils. rand_tangent (DV)
83+ remove_eig_gauge_dependence! (ΔDV[2 ], DV... )
84+ EnzymeTestUtils. test_reverse (eig_full, Duplicated, (t, Duplicated); output_tangent = ΔDV, atol, rtol)
9685
97- D = eig_vals (t)
98- EnzymeTestUtils. test_reverse (eig_vals, Duplicated, (t, Duplicated); atol, rtol)
99- end
86+ D = eig_vals (t)
87+ EnzymeTestUtils. test_reverse (eig_vals, Duplicated, (t, Duplicated); atol, rtol)
10088
10189 V_trunc = spacetype (t)(c => min (size (b)... ) ÷ 2 for (c, b) in blocks (t))
10290 trunc = truncspace (V_trunc)
10997
11098 @testset " EIGH" begin
11199 th = project_hermitian (t)
112- if ! is_ci
113- DV = eigh_full (th)
114- ΔDV = EnzymeTestUtils. rand_tangent (DV)
115- remove_eigh_gauge_dependence! (ΔDV[2 ], DV... )
116- proj_eigh_full (t) = eigh_full (project_hermitian (t))
117- EnzymeTestUtils. test_reverse (proj_eigh_full, Duplicated, (th, Duplicated); output_tangent = ΔDV, atol, rtol)
100+ DV = eigh_full (th)
101+ ΔDV = EnzymeTestUtils. rand_tangent (DV)
102+ remove_eigh_gauge_dependence! (ΔDV[2 ], DV... )
103+ proj_eigh_full (t) = eigh_full (project_hermitian (t))
104+ EnzymeTestUtils. test_reverse (proj_eigh_full, Duplicated, (th, Duplicated); output_tangent = ΔDV, atol, rtol)
118105
119- D = eigh_vals (th)
120- EnzymeTestUtils. test_reverse (eigh_vals ∘ project_hermitian, Duplicated, (th, Duplicated); atol, rtol)
121- end
106+ D = eigh_vals (th)
107+ EnzymeTestUtils. test_reverse (eigh_vals ∘ project_hermitian, Duplicated, (th, Duplicated); atol, rtol)
122108
123109 V_trunc = spacetype (th)(c => min (size (b)... ) ÷ 2 for (c, b) in blocks (t))
124110 trunc = truncspace (V_trunc)
136122 EnzymeTestUtils. test_reverse (project_hermitian!, Duplicated, (t, Duplicated); atol, rtol)
137123 EnzymeTestUtils. test_reverse (project_antihermitian!, Duplicated, (t, Duplicated); atol, rtol)
138124 end
139- TensorKit. empty_globalcaches! ()
140- GC. gc (true )
141125end
0 commit comments