Skip to content

Commit 278ae98

Browse files
committed
Add compat in Project and applympo SDV extension
1 parent c4a4bf2 commit 278ae98

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

Project.toml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name = "MPSDynamics"
22
uuid = "8fc8f346-e1eb-498f-94db-02ffe92d8134"
3-
authors = ["angus-dunnett <angus.dunnett@gmail.com>", "Thibaut Lacroix <thibaut.lacroix@proton.me>"]
3+
authors = ["Angus Dunnett", "Thibaut Lacroix", "Brieuc Le Dé", "Angela Riva"]
4+
maintainers = ["ShareLOQS <shareloqs@framagroupes.org>"]
45
version = "1.1.0"
56

67
[deps]
@@ -25,6 +26,23 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2526
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
2627

2728
[compat]
29+
Dates = "1.1.0 - 1.11"
30+
DelimitedFiles = "1.1.0 - 1.9"
31+
Distributed = "1.1.0 - 1.11"
32+
GraphRecipes = "0.4, 0.5"
33+
HDF5 = "0.17.2"
2834
ITensors = "0.6"
35+
Interpolations = "0.11, 0.15"
36+
JLD = "0.13.5"
37+
Jacobi = "0.7.0"
38+
KrylovKit = "0.8.3"
39+
LinearAlgebra = "1.0.0 - 1.11"
40+
Logging = "1.5.0 - 1.11"
41+
Plots = "1.35.0 - 1.40"
42+
Preferences = "1.0.0 - 1.4"
43+
Printf = "1.0.0 - 1.11"
44+
QuadGK = "2.0.0 - 2.11"
45+
Random = "1.0.0 - 1.11"
46+
SpecialFunctions = "2.4.0"
2947
TensorOperations = "4.0.7"
30-
julia = "1.7"
48+
julia = "1.7 - 1.11"

src/mpsBasics.jl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,12 +540,12 @@ Apply an operator O on the MPS A. O is acting on only one site ::Int. The result
540540
apply1siteoperator!(A, O, site::Int) = apply1siteoperator!(A, O, [site])
541541

542542
"""
543-
applympo!(A, H)
543+
applympo!(A, H; SVD=false, kwargs...)
544544
545-
Apply an MPO H on the MPS A. H must have the same number of site than A. The resulting MPS A is the MPS modified by the MPO H.
545+
Apply an MPO H on the MPS A. H must have the same number of site than A. The resulting MPS A is the MPS modified by the MPO H. The argument SVD can be set to true if one wants the MPS to recover the same dimensions after having applied the MPO H. Further parameters for the SVD truncation can be added with the kwargs.
546546
547547
"""
548-
function applympo!(A, H)
548+
function applympo!(A, H ; SVD=false, kwargs...)
549549
N = length(H)
550550
N == length(A) || throw(ArgumentError("MPO has $N site while MPS has $(length(A)) sites"))
551551
for i=1:N
@@ -554,6 +554,17 @@ function applympo!(A, H)
554554
@tensor X[a',a,b',b,s] := H[i][a',b',s,s'] * A[i][a,b,s']
555555
A[i] = reshape(X, Al*Hl, Ar*Hr, d)
556556
end
557+
if SVD
558+
for i in 2:N
559+
Dl, Dr, d = size(A[i-1])
560+
U, S, Vt = svdtrunc(reshape(permutedims(A[i-1], [1,3,2]), Dl*d, Dr); kwargs...)
561+
Dnew = size(S,1)
562+
A[i-1] = permutedims(reshape(U, Dl, d, Dnew), [1,3,2])
563+
R = Diagonal(S)*Vt
564+
@tensor AC[:] := R[-1,1] * A[i][1,-2,-3]
565+
A[i] = AC
566+
end
567+
end
557568
end
558569

559570
"""

0 commit comments

Comments
 (0)