Skip to content

Commit

Permalink
Format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Kloss committed Jan 22, 2024
1 parent e0ea0f4 commit 4e76b10
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/treetensornetworks/opsum_to_ttn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions test/test_opsum_to_ttn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_treetensornetworks/test_solvers/test_dmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4e76b10

Please sign in to comment.