@@ -11,9 +11,11 @@ _adjoint(alg::AbstractAlgorithm) = alg
1111
1212for 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(
7678end
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
100104end
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
112107function MAK. svd_compact! (t:: AdjointTensorMap , F, alg:: DiagonalAlgorithm )
113108 F′ = svd_compact! (adjoint (t), reverse (adjoint .(F)), _adjoint (alg))
114109 return reverse (adjoint .(F′))
0 commit comments