Skip to content

Commit

Permalink
Namespace and export fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Oct 23, 2024
1 parent 6452bfe commit 6ec477c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/ITensorMPS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ include("deprecated.jl")
include("defaults.jl")
include("update_observer.jl")
include("lattices/lattices.jl")
export Lattice, LatticeBond, square_lattice, triangular_lattice
export TimeDependentSum, dmrg_x, expand, linsolve, tdvp, to_vec
include("solvers/ITensorsExtensions.jl")
using .ITensorsExtensions: to_vec
include("solvers/applyexp.jl")
Expand Down
14 changes: 14 additions & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ export
truncerror,
val,

# lattices.jl
Lattice,
LatticeBond,
square_lattice,
triangular_lattice,

# solvers
TimeDependentSum,
dmrg_x,
expand,
linsolve,
tdvp,
to_vec,

# dmrg.jl
dmrg,
# abstractmps.jl
Expand Down
16 changes: 16 additions & 0 deletions src/imports.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Primarily used to import names into the `ITensorMPS`
# module from submodules or from `ITensors` so they can
# be reexported.
using ITensors.SiteTypes:
@OpName_str,
@SiteType_str,
@StateName_str,
@TagType_str,
@ValName_str,
OpName,
SiteType,
StateName,
TagType,
ValName
using ITensors.Ops: Trotter

import Base:
# types
Array,
Expand Down
11 changes: 8 additions & 3 deletions test/base/test_exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ using Test: @test, @test_broken, @testset
@test issetequal(
names(ITensorMPS), TestITensorMPSExportedNames.ITENSORMPS_EXPORTED_NAMES
)
# Test the names are actually defined, if not we might need to import them
# from ITensors.jl.
for name in TestITensorMPSExportedNames.ITENSORMPS_EXPORTED_NAMES
@test isdefined(ITensorMPS, name)
end
end
@testset "Not exported" begin
for f in
for name in
[:AbstractProjMPO, :ProjMPS, :makeL!, :makeR!, :set_terms, :sortmergeterms, :terms]
@test isdefined(ITensorMPS, f)
@test !Base.isexported(ITensorMPS, f)
@test isdefined(ITensorMPS, name)
@test !Base.isexported(ITensorMPS, name)
end
end
end
Expand Down
7 changes: 5 additions & 2 deletions test/base/test_fermions.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using ITensors, Test
import ITensors: Out, In
@eval module $(gensym())
using ITensorMPS
using ITensors
using Test

@testset "AutoFermion MPS, MPO, and OpSum" begin
ITensors.enable_auto_fermion()
Expand Down Expand Up @@ -285,3 +287,4 @@ import ITensors: Out, In

ITensors.disable_auto_fermion()
end
end
4 changes: 2 additions & 2 deletions test/base/test_mps.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@eval module $(gensym())
using Combinatorics
using ITensorMPS
using ITensors
using ITensors: ITensorMPS
using Random
using LinearAlgebra: diag
using Random
using Test

Random.seed!(1234)
Expand Down

0 comments on commit 6ec477c

Please sign in to comment.