Skip to content

Commit beed105

Browse files
Restore support for parameters as vectors (#263)
Co-authored-by: Matt Fishman <mtfishman@users.noreply.github.com>
1 parent 6357bee commit beed105

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorNetworks"
22
uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7"
33
authors = ["Matthew Fishman <mfishman@flatironinstitute.org>, Joseph Tindall <jtindall@flatironinstitute.org> and contributors"]
4-
version = "0.15.3"
4+
version = "0.15.4"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

src/solvers/insert.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ function insert!(region_iter, local_tensor; normalize = false, set_orthogonal_re
1212
indsTe = inds(psi[first(region)])
1313
tags = ITensors.tags(psi, e)
1414

15+
trunc_kwargs = truncation_parameters(region_iter.which_sweep; region_kwargs(factorize, region_iter)...)
1516
U, C, spectrum = factorize(
16-
local_tensor, indsTe; tags, region_kwargs(factorize, region_iter)...
17+
local_tensor, indsTe; tags, trunc_kwargs...
1718
)
1819

1920
@preserve_graph psi[first(region)] = U

src/solvers/subspace/densitymatrix.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ function subspace_expand!(
2929
isnothing(a) && return region_iter, local_state
3030
basis_size = prod(dim.(uniqueinds(A, C)))
3131

32+
trunc_kwargs = truncation_parameters(region_iter.which_sweep; eigen_kwargs...)
3233
expanded_maxdim = compute_expansion(
33-
dim(a), basis_size; expansion_factor, maxexpand, eigen_kwargs.maxdim
34+
dim(a), basis_size; expansion_factor, maxexpand, trunc_kwargs.maxdim
3435
)
3536
expanded_maxdim <= 0 && return region_iter, local_state
3637

@@ -48,7 +49,7 @@ function subspace_expand!(
4849
sqrt_rho = conj_proj_A(sqrt_rho)
4950
end
5051
rho = sqrt_rho * dag(noprime(sqrt_rho))
51-
D, U = eigen(rho; eigen_kwargs..., ishermitian = true)
52+
D, U = eigen(rho; trunc_kwargs..., ishermitian = true)
5253

5354
Uproj(T) = (T - prime(A, a) * (dag(prime(A, a)) * T))
5455
for _ in 1:north_pass

test/solvers/test_eigsolve.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,22 @@ include("utilities/tree_graphs.jl")
5353

5454
#
5555
# Test 1-site DMRG with subspace expansion
56+
# and cutoff and maxdim as vectors of values
5657
#
5758
nsites = 1
5859
nsweeps = 5
60+
factorize_kwargs = (; cutoff = [1.0e-5, 1.0e-6], maxdim = [8, 16, 32])
5961
extract!_kwargs = (; subspace_algorithm = "densitymatrix")
6062
E, psi = dmrg(H, psi0; extract!_kwargs, factorize_kwargs, nsites, nsweeps, outputlevel)
6163
(outputlevel >= 1) && println("1-site+subspace DMRG energy = ", E)
6264
@test E Ex atol = 1.0e-5
65+
66+
#
67+
# Test passing cutoff and maxdim as a vector of values
68+
#
69+
nsites = 2
70+
factorize_kwargs = (; cutoff = [1.0e-5, 1.0e-6], maxdim = [8, 16, 32])
71+
E, psi = dmrg(H, psi0; factorize_kwargs, nsites, nsweeps, outputlevel)
72+
(outputlevel >= 1) && println("2-site DMRG energy = ", E)
73+
@test E Ex atol = 1.0e-5
6374
end

0 commit comments

Comments
 (0)