Skip to content

Commit 68beac7

Browse files
committed
remove more implementations to fix code
1 parent e8de3f5 commit 68beac7

2 files changed

Lines changed: 16 additions & 19 deletions

File tree

src/factorizations/adjoint.jl

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ _adjoint(alg::AbstractAlgorithm) = alg
1111

1212
for f in
1313
[
14-
:svd_compact, :svd_full, :svd_trunc, :svd_vals, :qr_compact, :qr_full, :qr_null,
15-
:lq_compact, :lq_full, :lq_null, :eig_full, :eig_trunc, :eig_vals, :eigh_full,
16-
:eigh_trunc, :eigh_vals, :left_polar, :right_polar,
14+
:svd_compact, :svd_full, :svd_vals,
15+
:qr_compact, :qr_full, :qr_null,
16+
:lq_compact, :lq_full, :lq_null,
17+
:eig_full, :eig_vals, :eigh_full, :eigh_trunc, :eigh_vals,
18+
:left_polar, :right_polar,
1719
:project_hermitian, :project_antihermitian, :project_isometric,
1820
]
1921
f! = Symbol(f, :!)
@@ -76,16 +78,18 @@ for (left_f, right_f) in zip(
7678
end
7779

7880
# 3-arg functions
79-
for f! in (:svd_full!, :svd_compact!, :svd_trunc!)
80-
@eval function MAK.copy_input(::typeof($f!), t::AdjointTensorMap)
81-
return adjoint(MAK.copy_input($f!, adjoint(t)))
81+
for f in (:svd_full, :svd_compact)
82+
f! = Symbol(f, :!)
83+
@eval function MAK.copy_input(::typeof($f), t::AdjointTensorMap)
84+
return adjoint(MAK.copy_input($f, adjoint(t)))
8285
end
8386

8487
@eval function MAK.initialize_output(
8588
::typeof($f!), t::AdjointTensorMap, alg::AbstractAlgorithm
8689
)
8790
return reverse(adjoint.(MAK.initialize_output($f!, adjoint(t), _adjoint(alg))))
8891
end
92+
8993
@eval function MAK.$f!(t::AdjointTensorMap, F, alg::AbstractAlgorithm)
9094
F′ = $f!(adjoint(t), reverse(adjoint.(F)), _adjoint(alg))
9195
return reverse(adjoint.(F′))
@@ -98,17 +102,8 @@ for f! in (:svd_full!, :svd_compact!, :svd_trunc!)
98102
throw(MethodError($f!, (t, alg)))
99103
end
100104
end
105+
101106
# avoid amgiguity
102-
function MAK.initialize_output(
103-
::typeof(svd_trunc!), t::AdjointTensorMap, alg::TruncatedAlgorithm
104-
)
105-
return MAK.initialize_output(svd_compact!, t, alg.alg)
106-
end
107-
# to fix ambiguity
108-
function MAK.svd_trunc!(t::AdjointTensorMap, USVᴴ, alg::TruncatedAlgorithm)
109-
USVᴴ′ = svd_compact!(t, USVᴴ, alg.alg)
110-
return MAK.truncate(svd_trunc!, USVᴴ′, alg.trunc)
111-
end
112107
function MAK.svd_compact!(t::AdjointTensorMap, F, alg::DiagonalAlgorithm)
113108
F′ = svd_compact!(adjoint(t), reverse(adjoint.(F)), _adjoint(alg))
114109
return reverse(adjoint.(F′))

src/factorizations/matrixalgebrakit.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
# -------------------
33
for f in
44
[
5-
:svd_compact, :svd_full, :svd_trunc, :svd_vals, :qr_compact, :qr_full, :qr_null,
6-
:lq_compact, :lq_full, :lq_null, :eig_full, :eig_trunc, :eig_vals, :eigh_full,
7-
:eigh_trunc, :eigh_vals, :left_polar, :right_polar,
5+
:svd_compact, :svd_full, :svd_vals,
6+
:qr_compact, :qr_full, :qr_null,
7+
:lq_compact, :lq_full, :lq_null,
8+
:eig_full, :eig_vals, :eigh_full, :eigh_vals,
9+
:left_polar, :right_polar,
810
:project_hermitian, :project_antihermitian, :project_isometric,
911
]
1012
f! = Symbol(f, :!)

0 commit comments

Comments
 (0)