Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use random_itensor and random_mps #311

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
ChainRulesCore = "1.10"
DataFrames = "1.6"
HDF5 = "0.13.1, 0.14, 0.15, 0.16"
ITensors = "0.3.20"
ITensors = "0.6.8"
JLD2 = "0.4.14"
Observers = "0.2"
Optimisers = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ H = MPO(os, hilbert)
nsweeps = 10
maxdim = [10, 20, 30, 50, 100]
cutoff = 1e-10
Edmrg, Φ = dmrg(H, randomMPS(hilbert); outputlevel=0, nsweeps, maxdim, cutoff);
Edmrg, Φ = dmrg(H, random_mps(hilbert); outputlevel=0, nsweeps, maxdim, cutoff);
@printf("\nGround state energy from DMRG: %.10f\n\n", Edmrg)

# layer of single-qubit Ry gates
Expand Down
2 changes: 1 addition & 1 deletion examples/05_finitetemperature.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ H = MPO(ampo, sites)
# Density-matrix renormalization group
dmrg_iter = 5 # DMRG steps
dmrg_cutoff = 1E-10 # Cutoff
Ψ0 = randomMPS(sites) # Initial state
Ψ0 = random_mps(sites) # Initial state
sweeps = Sweeps(dmrg_iter)
maxdim!(sweeps, 10, 20, 30, 40, 50, 100)
cutoff!(sweeps, dmrg_cutoff)
Expand Down
2 changes: 1 addition & 1 deletion examples/09_qst_ising.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ H = MPO(ampo, sites)
# Run DMRG
dmrg_iter = 5 # DMRG steps
dmrg_cutoff = 1E-10 # Cutoff
Ψ0 = randomMPS(sites) # Initial state
Ψ0 = random_mps(sites) # Initial state
sweeps = Sweeps(dmrg_iter)
maxdim!(sweeps, 10, 20, 30, 40, 50, 100)
cutoff!(sweeps, dmrg_cutoff)
Expand Down
2 changes: 1 addition & 1 deletion examples/10_vqe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ H = MPO(os, hilbert)
nsweeps = 10
maxdim = [10, 20, 30, 50, 100]
cutoff = 1e-10
Edmrg, Φ = dmrg(H, randomMPS(hilbert); outputlevel=0, nsweeps, maxdim, cutoff);
Edmrg, Φ = dmrg(H, random_mps(hilbert); outputlevel=0, nsweeps, maxdim, cutoff);
@printf("\nGround state energy from DMRG: %.10f\n\n", Edmrg)

# layer of single-qubit Ry gates
Expand Down
4 changes: 2 additions & 2 deletions src/randomstates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function randomstate(ElT::Type{<:Number}, T::Type, sites::Vector{<:Index}; kwarg
if T == MPS
# Build MPS by random parameter initialization
alg == "rand" && (M = random_mps(ElT, sites, χ, σ))
alg == "circuit" && (M = randomMPS(ElT, sites; linkdims=χ))
alg == "circuit" && (M = random_mps(ElT, sites; linkdims=χ))
elseif T == MPO
error("initialization of random MPO density matrix not yet implemented.")
elseif T == LPDO
Expand Down Expand Up @@ -358,7 +358,7 @@ function randomprocess(ElT::Type{<:Number}, T::Type, sites::Vector{<:Index}; kwa
if alg == "rand"
M = random_mpo(ElT, sites, χ, σ; processtags=processtags)
else
error("randomMPO with circuit initialization not implemented yet")
error("random_mpo with circuit initialization not implemented yet")
end
elseif T == LPDO
M = random_choi(ElT, sites, χ, ξ, σ; purifier_tags=purifier_tags)
Expand Down
2 changes: 1 addition & 1 deletion test/chainrulestestutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ end

function ChainRulesTestUtils.rand_tangent(rng::AbstractRNG, A::ITensor)
# TODO: generalize to sparse tensors
return isempty(inds(A)) ? ITensor(randn(eltype(A))) : randomITensor(eltype(A), inds(A))
return isempty(inds(A)) ? ITensor(randn(eltype(A))) : random_itensor(eltype(A), inds(A))
end

function ChainRulesTestUtils.rand_tangent(rng::AbstractRNG, x::Index)
Expand Down
Loading