Skip to content

Commit a7d6e9a

Browse files
committed
add matrix_contract specialization
1 parent 7d31ac8 commit a7d6e9a

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

src/MPSKit.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ using Compat: @compat
6060
# -------
6161
using TensorKit
6262
using TensorKit: BraidingTensor
63+
using TensorKit: TupleTools as TT
6364
using MatrixAlgebraKit
6465
using MatrixAlgebraKit: TruncationStrategy, PolarViaSVD, LAPACK_SVDAlgorithm
6566
using BlockTensorKit

src/utility/utility.jl

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ function _transpose_as(t1::AbstractTensorMap, t2::AbstractTensorMap; copy::Bool
88
return repartition(t1, numout(t2), numin(t2); copy)
99
end
1010

11-
_mul_front(C, A) = _transpose_front(C * _transpose_tail(A))
12-
_mul_tail(A, C) = A * C
11+
_mul_front(C, A) = matrix_contract(A, C, 1; transpose = true) # _transpose_front(C * _transpose_tail(A))
12+
_mul_tail(A, C) = matrix_contract(A, C, numind(A)) # A * C
1313

1414
function _similar_tail(A::AbstractTensorMap)
1515
cod = _firstspace(A)
@@ -149,31 +149,3 @@ function check_unambiguous_braiding(V::VectorSpace)
149149
return check_unambiguous_braiding(Bool, V) ||
150150
throw(ArgumentError("cannot unambiguously braid $V"))
151151
end
152-
153-
# temporary workaround for the fact that left_orth and right_orth are poorly designed:
154-
function _left_orth!(t; alg::MatrixAlgebraKit.AbstractAlgorithm, trunc::MatrixAlgebraKit.TruncationStrategy = notrunc())
155-
if alg isa LAPACK_HouseholderQR
156-
return left_orth!(t; kind = :qr, alg_qr = alg, trunc)
157-
elseif alg isa LAPACK_HouseholderLQ
158-
return left_orth!(t; kind = :qr, alg_qr = LAPACK_HouseholderQR(; alg.kwargs...), trunc)
159-
elseif alg isa PolarViaSVD
160-
return left_orth!(t; kind = :polar, alg_polar = alg, trunc)
161-
elseif alg isa LAPACK_SVDAlgorithm
162-
return left_orth!(t; kind = :svd, alg_svd = alg, trunc)
163-
else
164-
error(lazy"unkown algorithm $alg")
165-
end
166-
end
167-
function _right_orth!(t; alg::MatrixAlgebraKit.AbstractAlgorithm, trunc::TruncationStrategy = notrunc())
168-
if alg isa LAPACK_HouseholderLQ
169-
return right_orth!(t; kind = :lq, alg_lq = alg, trunc)
170-
elseif alg isa LAPACK_HouseholderQR
171-
return right_orth!(t; kind = :lq, alg_lq = LAPACK_HouseholderLQ(; alg.kwargs...), trunc)
172-
elseif alg isa PolarViaSVD
173-
return right_orth!(t; kind = :polar, alg_polar = alg, trunc)
174-
elseif alg isa LAPACK_SVDAlgorithm
175-
return right_orth!(t; kind = :svd, alg_svd = alg, trunc)
176-
else
177-
error(lazy"unkown algorithm $alg")
178-
end
179-
end

0 commit comments

Comments
 (0)