From 4e76b10aff63b1c91c326501e12e872028916f0e Mon Sep 17 00:00:00 2001 From: Benedikt Kloss Date: Mon, 22 Jan 2024 13:31:49 -0500 Subject: [PATCH] Format. --- src/models.jl | 2 +- src/treetensornetworks/opsum_to_ttn.jl | 2 +- test/test_opsum_to_ttn.jl | 14 +++++++------- .../test_solvers/test_dmrg.jl | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/models.jl b/src/models.jl index 8472c800..e33e16fb 100644 --- a/src/models.jl +++ b/src/models.jl @@ -3,7 +3,7 @@ _maybe_fill(x::Number, n) = fill(x, n) function nth_nearest_neighbors(g, v, n::Int) #ToDo: Add test for this. isone(n) && return neighborhood(g, v, 1) - return setdiff( neighborhood(g, v, n), neighborhood(g, v, n - 1) ) + return setdiff(neighborhood(g, v, n), neighborhood(g, v, n - 1)) end next_nearest_neighbors(g, v) = nth_nearest_neighbors(g, v, 2) diff --git a/src/treetensornetworks/opsum_to_ttn.jl b/src/treetensornetworks/opsum_to_ttn.jl index d635598f..a3cc0234 100644 --- a/src/treetensornetworks/opsum_to_ttn.jl +++ b/src/treetensornetworks/opsum_to_ttn.jl @@ -58,7 +58,7 @@ function ttn_svd( # which causes problems when using the autofermion sign with non-fermionic QNIndex # ToDo: remove conditional when this is addressed linkdir_ref = ITensors.using_auto_fermion() ? ITensors.In : ITensors.In - + sites = deepcopy(sites0) # deepcopy because of inplace modification to handle internal indices edgetype_sites = edgetype(sites) vertextype_sites = vertextype(sites) diff --git a/test/test_opsum_to_ttn.jl b/test/test_opsum_to_ttn.jl index 90379d11..1cec936a 100644 --- a/test/test_opsum_to_ttn.jl +++ b/test/test_opsum_to_ttn.jl @@ -6,18 +6,18 @@ using Random using LinearAlgebra: eigvals using Test -function _to_matrices_with_same_inds(t::ITensor,s::ITensor) +function _to_matrices_with_same_inds(t::ITensor, s::ITensor) c = combiner(inds(t; plev=0)) tc = (t * c) * dag(c') c2 = combiner(inds(s; plev=0)) sc = (s * c2) * dag(c2') - + cind = combinedind(c) cind2 = combinedind(c2) - sc=replaceinds(sc,(cind2,cind2'),(cind,cind')) - - tm=matrix(tc, cind', cind) - sm=matrix(sc, cind',cind) + sc = replaceinds(sc, (cind2, cind2'), (cind, cind')) + + tm = matrix(tc, cind', cind) + sm = matrix(sc, cind', cind) return tm, sm end @@ -186,7 +186,7 @@ end @test_broken Tmpo ≈ Tttno # ToDo fix comparison for fermionic tensors # In the meantime: matricize tensors and convert to dense Matrix to compare element by element - dTmm,dTtm = _to_matrices_with_same_inds(Tmpo,Tttno) + dTmm, dTtm = _to_matrices_with_same_inds(Tmpo, Tttno) @test any(>(1e-14), dTmm - dTtm) # also compare with energies obtained from single-particle Hamiltonian diff --git a/test/test_treetensornetworks/test_solvers/test_dmrg.jl b/test/test_treetensornetworks/test_solvers/test_dmrg.jl index f73b79dc..db4886e2 100644 --- a/test/test_treetensornetworks/test_solvers/test_dmrg.jl +++ b/test/test_treetensornetworks/test_solvers/test_dmrg.jl @@ -157,7 +157,7 @@ end e2, psi2 = dmrg(Hline, psiline; nsweeps, maxdim, cutoff, outputlevel=0) @test inner(psi', H, psi) ≈ inner(psi2', Hline, psi2) atol = 1e-5 - + if !auto_fermion_enabled ITensors.disable_auto_fermion() end