Skip to content

Commit ea26fcd

Browse files
authored
Update references from ITensors to ITensorMPS in documentation and code examples (#143)
1 parent 996375b commit ea26fcd

File tree

12 files changed

+29
-29
lines changed

12 files changed

+29
-29
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorMPS"
22
uuid = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2"
33
authors = ["Matthew Fishman <[email protected]>", "Miles Stoudenmire <[email protected]>"]
4-
version = "0.3.17"
4+
version = "0.3.18"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

docs/src/Observer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ end
8484
```
8585

8686
(Recall that in order to properly overload the default behavior,
87-
the `checkdone!` method has to be imported from the ITensors module
88-
or preceded with `ITensors.`)
87+
the `checkdone!` method has to be imported from the ITensorMPS module
88+
or preceded with `ITensorsMPS.`)
8989

9090

9191
### Overloading the `measure!` method

docs/src/examples/DMRG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ some helper functions which
193193
return an array of bonds. Each bond object has an
194194
"s1" field and an "s2" field which are the integers numbering
195195
the two sites the bond connects.
196-
(You can view the source for these functions at [this link](https://github.com/ITensor/ITensors.jl/blob/main/src/lib/ITensorMPS/src/lattices/lattices.jl).)
196+
(You can view the source for these functions at [this link](https://github.com/ITensor/ITensorMPS.jl/blob/main/src/lattices/lattices.jl).)
197197

198198
The two provided functions currently are `square_lattice` and
199199
`triangular_lattice`. It is not hard to write your own similar lattice
200-
functions as all they have to do is define an array of `ITensors.LatticeBond`
200+
functions as all they have to do is define an array of `ITensorMPS.LatticeBond`
201201
structs or even a custom struct type you wish to define. We welcome any
202202
user contributions of other lattices that ITensor does not currently offer.
203203

examples/autodiff/mps_autodiff.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ J = 1.0
3030
h = 0.5
3131

3232
# Loss function only works with `Vector{ITensor}`,
33-
# extract with `ITensors.data`.
34-
ψ0 = ITensors.data(random_mps(s; linkdims=10))
35-
H = ITensors.data(MPO(ising(n; J, h), s))
33+
# extract with `ITensorMPS.data`.
34+
ψ0 = ITensorMPS.data(random_mps(s; linkdims=10))
35+
H = ITensorMPS.data(MPO(ising(n; J, h), s))
3636

3737
loss(ψ) = loss(H, ψ)
3838

@@ -46,4 +46,4 @@ Edmrg, ψdmrg = dmrg(MPO(H), MPS(ψ0); nsweeps=10, cutoff=1e-8)
4646

4747
@show loss(ψ0), norm(loss'(ψ0))
4848
@show loss(ψ), norm(loss'(ψ))
49-
@show loss(ITensors.data(ψdmrg)), norm(loss'(ITensors.data(ψdmrg)))
49+
@show loss(ITensorMPS.data(ψdmrg)), norm(loss'(ITensorMPS.data(ψdmrg)))

ext/ITensorMPSChainRulesCoreExt/abstractmps.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function ChainRulesCore.rrule(
179179
x::Union{MPS,MPO};
180180
set_limits::Bool=true,
181181
)
182-
y_data, pullback_data = rrule_via_ad(config, map, f, ITensors.data(x))
182+
y_data, pullback_data = rrule_via_ad(config, map, f, ITensorMPS.data(x))
183183
function map_pullback(ȳ)
184184
dmap, df, dx_data = pullback_data(ȳ)
185185
return dmap, df, MPS(dx_data)

src/abstractmps.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function convert_leaf_eltype(eltype::Type, ψ::AbstractMPS)
7878
end
7979

8080
"""
81-
ITensors.data(::MPS/MPO)
81+
ITensorMPS.data(::MPS/MPO)
8282
8383
Returns a view of the Vector storage of an MPS/MPO.
8484
@@ -127,7 +127,7 @@ function ortho_lims(ψ::AbstractMPS)
127127
end
128128

129129
"""
130-
ITensors.set_ortho_lims!(::MPS/MPO, r::UnitRange{Int})
130+
ITensorMPS.set_ortho_lims!(::MPS/MPO, r::UnitRange{Int})
131131
132132
Sets the range of sites of the orthogonality center of the MPS/MPO.
133133
@@ -378,14 +378,14 @@ end
378378
#
379379

380380
"""
381-
ITensors.defaultlinktags(b::Integer)
381+
ITensorMPS.defaultlinktags(b::Integer)
382382
383383
Default link tags for link index connecting sites `b` to `b+1`.
384384
"""
385385
defaultlinktags(b::Integer) = TagSet("Link,l=$b")
386386

387387
"""
388-
ITensors.hasdefaultlinktags(ψ::MPS/MPO)
388+
ITensorMPS.hasdefaultlinktags(ψ::MPS/MPO)
389389
390390
Return true if the MPS/MPO has default link tags.
391391
"""
@@ -400,21 +400,21 @@ function hasdefaultlinktags(ψ::AbstractMPS)
400400
end
401401

402402
"""
403-
ITensors.eachlinkinds(ψ::MPS/MPO)
403+
ITensorMPS.eachlinkinds(ψ::MPS/MPO)
404404
405405
Return an iterator over each of the sets of link indices of the MPS/MPO.
406406
"""
407407
eachlinkinds::AbstractMPS) = (linkinds(ψ, n) for n in eachindex(ψ)[1:(end - 1)])
408408

409409
"""
410-
ITensors.eachsiteinds(ψ::MPS/MPO)
410+
ITensorMPS.eachsiteinds(ψ::MPS/MPO)
411411
412412
Return an iterator over each of the sets of site indices of the MPS/MPO.
413413
"""
414414
eachsiteinds::AbstractMPS) = (siteinds(ψ, n) for n in eachindex(ψ))
415415

416416
"""
417-
ITensors.hasnolinkinds(ψ::MPS/MPO)
417+
ITensorMPS.hasnolinkinds(ψ::MPS/MPO)
418418
419419
Return true if the MPS/MPO has no link indices.
420420
"""
@@ -428,7 +428,7 @@ function hasnolinkinds(ψ::AbstractMPS)
428428
end
429429

430430
"""
431-
ITensors.insertlinkinds(ψ::MPS/MPO)
431+
ITensorMPS.insertlinkinds(ψ::MPS/MPO)
432432
433433
If any link indices are missing, insert default ones.
434434
"""
@@ -1827,7 +1827,7 @@ from decomposing `A` into an MPS or MPO.
18271827
18281828
The MPS or MPO must be orthogonalized such that
18291829
```
1830-
firstsite ≤ ITensors.orthocenter(ψ) ≤ lastsite
1830+
firstsite ≤ ITensorMPS.orthocenter(ψ) ≤ lastsite
18311831
```
18321832
18331833
Choose the new orthogonality center with `orthocenter`, which

src/deprecated.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@deprecate multmpo(args...; kwargs...) contract(args...; kwargs...)
1313
@deprecate set_leftlim!(args...; kwargs...) ITensors.setleftlim!(args...; kwargs...)
1414
@deprecate set_rightlim!(args...; kwargs...) ITensors.setrightlim!(args...; kwargs...)
15-
@deprecate tensors(args...; kwargs...) ITensors.data(args...; kwargs...)
15+
@deprecate tensors(args...; kwargs...) ITensorMPS.data(args...; kwargs...)
1616
@deprecate primelinks!(args...; kwargs...) ITensors.prime_linkinds!(args...; kwargs...)
1717
@deprecate simlinks!(args...; kwargs...) ITensors.sim_linkinds!(args...; kwargs...)
1818
@deprecate mul(A::AbstractMPS, B::AbstractMPS; kwargs...) contract(A, B; kwargs...)

src/dmrg.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Optional keyword arguments:
150150
151151
[^krylovkit]:
152152
153-
The `dmrg` function in `ITensors.jl` currently uses the `eigsolve`
153+
The `dmrg` function in `ITensorMPS.jl` currently uses the `eigsolve`
154154
function in `KrylovKit.jl` as the internal the eigensolver.
155155
See the `KrylovKit.jl` documention on the `eigsolve` function for more details:
156156
[KrylovKit.eigsolve](https://jutho.github.io/KrylovKit.jl/stable/man/eig/#KrylovKit.eigsolve).

test/base/test_mpo.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ end
5151
@test hasind(P[1], prime(sites[1]))
5252
# test constructor from Vector{ITensor}
5353
K = random_mpo(sites)
54-
@test ITensors.data(MPO(copy(ITensors.data(K)))) == ITensors.data(K)
54+
@test ITensorMPS.data(MPO(copy(ITensorMPS.data(K)))) == ITensorMPS.data(K)
5555

5656
@testset "orthogonalize!" begin
5757
phi = random_mps(sites)
@@ -546,7 +546,7 @@ end
546546
ψ0 = random_mpo(s)
547547

548548
ψ = orthogonalize(ψ0, 2)
549-
A = prod(ITensors.data(ψ)[2:(N - 1)])
549+
A = prod(ITensorMPS.data(ψ)[2:(N - 1)])
550550
randn!(A)
551551
ϕ = MPO(A, s[2:(N - 1)]; orthocenter=1)
552552
ψ[2:(N - 1)] = ϕ
@@ -555,12 +555,12 @@ end
555555
@test ITensorMPS.orthocenter(ψ) == 2
556556

557557
ψ = orthogonalize(ψ0, 1)
558-
A = prod(ITensors.data(ψ)[2:(N - 1)])
558+
A = prod(ITensorMPS.data(ψ)[2:(N - 1)])
559559
randn!(A)
560560
@test_throws AssertionError ψ[2:(N - 1)] = A
561561

562562
ψ = orthogonalize(ψ0, 2)
563-
A = prod(ITensors.data(ψ)[2:(N - 1)])
563+
A = prod(ITensorMPS.data(ψ)[2:(N - 1)])
564564
randn!(A)
565565
ψ[2:(N - 1), orthocenter = 3] = A
566566
@test prod(ψ) ψ[1] * A * ψ[N]

test/base/test_qnmpo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ end
5252
L[N] = random_itensor(QN(), dag(sites[N]), sites[N]', dag(links[N - 1]))
5353

5454
@test length(K) == N
55-
@test ITensors.data(MPO(copy(ITensors.data(K)))) == ITensors.data(K)
55+
@test ITensorMPS.data(MPO(copy(ITensorMPS.data(K)))) == ITensorMPS.data(K)
5656

5757
phi = MPS(N)
5858
phi[1] = random_itensor(QN(-1), sites[1], links[1])

0 commit comments

Comments
 (0)