-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back missing randomMPS constructors
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@eval module $(gensym()) | ||
using ITensors.ITensorMPS: MPS, maxlinkdim, randomMPS, siteinds | ||
using LinearAlgebra: norm | ||
using Test: @test, @testset | ||
@testset "randomMPS" begin | ||
sites = siteinds("S=1/2", 4) | ||
state = j -> isodd(j) ? "↑" : "↓" | ||
linkdims = 2 | ||
# Deprecated linkdims syntax | ||
for mps in [ | ||
randomMPS(Float64, sites, state; linkdims), | ||
randomMPS(Float64, sites; linkdims), | ||
randomMPS(sites, state; linkdims), | ||
randomMPS(sites, linkdims), | ||
# Deprecated linkdims syntax | ||
randomMPS(Float64, sites, state, linkdims), | ||
randomMPS(Float64, sites, linkdims), | ||
randomMPS(sites, state, linkdims), | ||
randomMPS(sites, linkdims), | ||
] | ||
@test mps isa MPS | ||
@test length(mps) == 4 | ||
@test maxlinkdim(mps) == 2 | ||
@test norm(mps) > 0 | ||
end | ||
end | ||
end |