Skip to content

Commit

Permalink
Fix exports and namespace issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Oct 23, 2024
1 parent e9d0dc0 commit 6452bfe
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 230 deletions.
1 change: 1 addition & 0 deletions src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@deprecate mul(A::AbstractMPS, B::AbstractMPS; kwargs...) contract(A, B; kwargs...)

# mps/mpo.jl
@deprecate toMPO(args...; kwargs...) MPO(args...; kwargs...)
@deprecate MPO(A::MPS; kwargs...) outer(A', A; kwargs...)
@deprecate randomMPO(args...; kwargs...) random_mpo(args...; kwargs...)

Expand Down
2 changes: 1 addition & 1 deletion src/abstractmps.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using IsApprox: Approx, IsApprox
using ITensors: ITensors
using NDTensors: NDTensors, using_auto_fermion, scalartype, tensor
# TODO: Just load from `ITensors`, not from submodules.
using ITensors.Ops: Prod
using ITensors.QuantumNumbers: QuantumNumbers, removeqn
using ITensors.SiteTypes: SiteTypes, siteinds
using ITensors.TagSets: TagSets
Expand Down
3 changes: 0 additions & 3 deletions src/backup/Deprecated.jl

This file was deleted.

178 changes: 0 additions & 178 deletions src/backup/ITensorMPS.jl

This file was deleted.

43 changes: 41 additions & 2 deletions src/exports.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
using LinearAlgebra:
export
# Exports that were removed from ITensors.jl
# when ITensors.ITensorMPS was moved to ITensorMPS.jl.
@OpName_str,
@SiteType_str,
@StateName_str,
@TagType_str,
@ValName_str,
Apply,
Op,
OpName,
Ops,
Prod,
Scaled,
SiteType,
Spectrum,
StateName,
Sum,
TagType,
Trotter,
ValName,
apply,
argsdict,
coefficient,
contract,
convert_leaf_eltype,
eigs,
entropy,
has_fermion_string,
hassameinds,
linkindex,
ops,
replaceprime,
siteindex,
splitblocks,
tr,
truncerror,
val,

# dmrg.jl
dmrg,
# abstractmps.jl
Expand All @@ -21,7 +59,6 @@ export
lognorm,
movesite,
movesites,
normalize,
ortho_lims,
orthocenter,
promote_itensor_eltype,
Expand All @@ -31,6 +68,7 @@ export
sim!,
# autompo/
AutoMPO,
OpSum,
add!,
# mpo.jl
# Types
Expand Down Expand Up @@ -61,6 +99,7 @@ export
linkdims,
linkind,
linkinds,
op,
productMPS,
random_mps,
replacebond,
Expand All @@ -69,6 +108,7 @@ export
sample!,
siteind,
siteinds,
state,
replace_siteinds!,
replace_siteinds,
swapbondsites,
Expand All @@ -86,7 +126,6 @@ export
measurements,
truncerrors,
# projmpo.jl
checkflux,
disk,
ProjMPO,
lproj,
Expand Down
3 changes: 2 additions & 1 deletion src/mpo.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using Adapt: adapt
using LinearAlgebra: dot
using Random: Random
using ..SiteTypes: SiteTypes, siteind, siteinds
using ITensors.Ops: OpSum
using ITensors.SiteTypes: SiteTypes, siteind, siteinds

"""
MPO
Expand Down
2 changes: 1 addition & 1 deletion src/mps.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Adapt: adapt
using NDTensors: using_auto_fermion
using Random: Random
using ..SiteTypes: SiteTypes, siteind, siteinds
using ITensors.SiteTypes: SiteTypes, siteind, siteinds, state

"""
MPS
Expand Down
3 changes: 2 additions & 1 deletion src/opsum_to_mpo/opsum_to_mpo_generic.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using NDTensors: using_auto_fermion
using ..Ops: Op
using ITensors.Ops: Ops, Op, OpSum, Scaled, Sum, coefficient
using ITensors.SiteTypes: has_fermion_string, op

# TODO: Deprecate.
const AutoMPO = OpSum
Expand Down
12 changes: 5 additions & 7 deletions test/base/test_examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ using Test: @test_nowarn, @testset
@test_nowarn begin
@capture_out begin
include(
joinpath(
pkgdir(ITensorMPS),
"examples",
"dmrg",
"1d_ising_with_observer.jl",
),
joinpath(pkgdir(ITensorMPS), "examples", "dmrg", "1d_ising_with_observer.jl")
)
end
end
Expand All @@ -22,7 +17,10 @@ using Test: @test_nowarn, @testset
@capture_out begin
include(
joinpath(
pkgdir(ITensorMPS), "ext", "ITensorMPSPackageCompilerExt", "precompile_itensormps.jl"
pkgdir(ITensorMPS),
"ext",
"ITensorMPSPackageCompilerExt",
"precompile_itensormps.jl",
),
)
end
Expand Down
23 changes: 5 additions & 18 deletions test/base/test_exports.jl
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
@eval module $(gensym())
using ITensorMPS: ITensorMPS
using ITensors: ITensors
include("utils/TestITensorMPSExportedNames.jl")
using Test: @test, @test_broken, @testset
@testset "Exports and aliases" begin
@testset "Exports" begin
# @show setdiff(names(ITensorMPS), TestITensorMPSExportedNames.ITENSORMPS_EXPORTED_NAMES)
# @show setdiff(TestITensorMPSExportedNames.ITENSORMPS_EXPORTED_NAMES, names(ITensorMPS))
@test issetequal(
names(ITensorMPS),
[
[:ITensorMPS]
# ITensorTDVP reexports
[:TimeDependentSum, :dmrg_x, :expand, :linsolve, :tdvp, :to_vec]
# ITensors and ITensors.ITensorMPS reexports
TestITensorMPSExportedNames.ITENSORMPS_EXPORTED_NAMES
],
names(ITensorMPS), TestITensorMPSExportedNames.ITENSORMPS_EXPORTED_NAMES
)
end
@testset "Not exported" begin
for f in [
:AbstractProjMPO,
:ProjMPS,
:makeL!,
:makeR!,
:set_terms,
:sortmergeterms,
:terms,
]
for f in
[:AbstractProjMPO, :ProjMPS, :makeL!, :makeR!, :set_terms, :sortmergeterms, :terms]
@test isdefined(ITensorMPS, f)
@test !Base.isexported(ITensorMPS, f)
end
Expand Down
2 changes: 1 addition & 1 deletion test/base/test_readme.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors, Test
using ITensorMPS, ITensors, Test

@testset "README Examples" begin
@testset "ITensor Basics" begin
Expand Down
11 changes: 1 addition & 10 deletions test/base/test_solvers/test_tdvp.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
@eval module $(gensym())
using ITensorMPS:
AbstractObserver,
MPO,
MPS,
OpSum,
apply,
expect,
inner,
random_mps,
siteinds,
tdvp
AbstractObserver, MPO, MPS, OpSum, apply, expect, inner, random_mps, siteinds, tdvp
using ITensors: ITensors, ITensor, dag, noprime, op, prime, scalar
using KrylovKit: exponentiate
using LinearAlgebra: norm
Expand Down
Loading

0 comments on commit 6452bfe

Please sign in to comment.