@@ -65,10 +65,14 @@ for (left_f, right_f) in zip(
6565 return reverse (adjoint .(MAK. initialize_output ($ left_f!, adjoint (t), _adjoint (alg))))
6666 end
6767
68- @eval MAK.$ left_f! (t:: AdjointTensorMap , F, alg:: AbstractAlgorithm ) =
69- $ right_f! (adjoint (t), reverse (adjoint .(F)), _adjoint (alg))
70- @eval MAK.$ right_f! (t:: AdjointTensorMap , F, alg:: AbstractAlgorithm ) =
71- $ left_f! (adjoint (t), reverse (adjoint .(F)), _adjoint (alg))
68+ @eval function MAK. $left_f! (t:: AdjointTensorMap , F, alg:: AbstractAlgorithm )
69+ F′ = $ right_f! (adjoint (t), reverse (adjoint .(F)), _adjoint (alg))
70+ return reverse (adjoint .(F′))
71+ end
72+ @eval function MAK. $right_f! (t:: AdjointTensorMap , F, alg:: AbstractAlgorithm )
73+ F′ = $ left_f! (adjoint (t), reverse (adjoint .(F)), _adjoint (alg))
74+ return reverse (adjoint .(F′))
75+ end
7276end
7377
7478# 3-arg functions
@@ -83,8 +87,8 @@ for f! in (:svd_full!, :svd_compact!, :svd_trunc!)
8387 return reverse (adjoint .(MAK. initialize_output ($ f!, adjoint (t), _adjoint (alg))))
8488 end
8589 @eval function MAK. $f! (t:: AdjointTensorMap , F, alg:: AbstractAlgorithm )
86- $ f! (adjoint (t), reverse (adjoint .(F)), _adjoint (alg))
87- return F
90+ F′ = $ f! (adjoint (t), reverse (adjoint .(F)), _adjoint (alg))
91+ return reverse ( adjoint .(F′))
8892 end
8993
9094 # disambiguate by prohibition
0 commit comments