diff --git a/src/Deprecated.jl b/src/Deprecated.jl index c0fc43a..35c775b 100644 --- a/src/Deprecated.jl +++ b/src/Deprecated.jl @@ -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...) diff --git a/src/abstractmps.jl b/src/abstractmps.jl index b3db530..4670be5 100644 --- a/src/abstractmps.jl +++ b/src/abstractmps.jl @@ -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 diff --git a/src/backup/Deprecated.jl b/src/backup/Deprecated.jl deleted file mode 100644 index d56b368..0000000 --- a/src/backup/Deprecated.jl +++ /dev/null @@ -1,3 +0,0 @@ -module Deprecated -using ITensors.ITensorMPS: dmrg -end diff --git a/src/backup/ITensorMPS.jl b/src/backup/ITensorMPS.jl deleted file mode 100644 index b0a7e13..0000000 --- a/src/backup/ITensorMPS.jl +++ /dev/null @@ -1,178 +0,0 @@ -module ITensorMPS -using Reexport: @reexport -@reexport using ITensorTDVP: TimeDependentSum, dmrg_x, expand, linsolve, tdvp, to_vec -# Not re-exported, but this makes these types and functions accessible -# as `ITensorMPS.x`. -using ITensors.ITensorMPS: - AbstractProjMPO, AbstractSum, ProjMPS, makeL!, makeR!, set_terms, sortmergeterms, terms -include("Experimental.jl") -using .Experimental: Experimental -include("Deprecated.jl") -using .Deprecated: Deprecated, dmrg -export dmrg -# `ops` is defined in `ITensors.SiteTypes`. -# TODO: Maybe reexport from there. -@reexport using ITensors: contract, ops -@reexport using ITensors.ITensorMPS: - @OpName_str, - @SiteType_str, - @StateName_str, - @TagType_str, - @ValName_str, - @preserve_ortho, - @visualize, - @visualize!, - @visualize_noeval, - @visualize_noeval!, - @visualize_sequence, - @visualize_sequence_noeval, - AbstractMPS, - AbstractObserver, - Apply, - AutoMPO, - DMRGMeasurement, - DMRGObserver, - Lattice, - LatticeBond, - MPO, - MPS, - NoObserver, - Op, - OpName, - OpSum, - Ops, - Prod, - ProjMPO, - ProjMPOSum, - ProjMPO_MPS, - Scaled, - SiteType, - Spectrum, - StateName, - Sum, - Sweeps, - TagType, # deprecate - Trotter, - ValName, - add, - add!, - apply, - applyMPO, - applympo, - argsdict, - checkdone!, # remove export - coefficient, - common_siteind, - common_siteinds, - convert_leaf_eltype, # remove export - correlation_matrix, - cutoff, - cutoff!, # deprecate - disk, - dot, # remove export - eigs, # deprecate - energies, # deprecate - entropy, # deprecate - errorMPOprod, # deprecate - error_contract, - error_mpoprod, # deprecate - error_mul, # deprecate - expect, - findfirstsiteind, # deprecate - findfirstsiteinds, # deprecate - findsite, # deprecate - findsites, # deprecate - firstsiteind, # deprecate - firstsiteinds, # deprecate - get_cutoffs, # deprecate - get_maxdims, # deprecate - get_mindims, # deprecate - get_noises, # deprecate - has_fermion_string, # remove export - hassameinds, - inner, - isortho, - linkdim, - linkdims, - linkind, - linkindex, - linkinds, - logdot, - loginner, - lognorm, - lproj, - maxdim, - maxdim!, - maxlinkdim, - measure!, - measurements, - mindim, - mindim!, - movesite, - movesites, - mul, # deprecate - multMPO, - multmpo, - noise, - noise!, - noiseterm, - nsite, - nsweep, - op, - orthoCenter, - ortho_lims, - orthocenter, - orthogonalize, - orthogonalize!, - outer, - position!, - product, - primelinks!, - productMPS, - projector, - promote_itensor_eltype, - randomMPO, - randomMPS, - random_mpo, - random_mps, - replace_siteinds, - replace_siteinds!, - replacebond, - replacebond!, - replaceprime, - replacesites!, - reset_ortho_lims!, - rproj, - sample, - sample!, - set_leftlim!, - set_ortho_lims!, - set_rightlim!, - setcutoff!, - setmaxdim!, - setmindim!, - setnoise!, - simlinks!, - siteind, - siteindex, - siteinds, - splitblocks, - square_lattice, - state, - sum, - swapbondsites, - sweepnext, - tensors, - toMPO, - totalqn, - tr, - triangular_lattice, - truncate, - truncate!, - truncerror, - truncerrors, - unique_siteind, - unique_siteinds, - val, - ⋅ -end diff --git a/src/exports.jl b/src/exports.jl index bf581e7..e16086b 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -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 @@ -21,7 +59,6 @@ export lognorm, movesite, movesites, - normalize, ortho_lims, orthocenter, promote_itensor_eltype, @@ -31,6 +68,7 @@ export sim!, # autompo/ AutoMPO, + OpSum, add!, # mpo.jl # Types @@ -61,6 +99,7 @@ export linkdims, linkind, linkinds, + op, productMPS, random_mps, replacebond, @@ -69,6 +108,7 @@ export sample!, siteind, siteinds, + state, replace_siteinds!, replace_siteinds, swapbondsites, @@ -86,7 +126,6 @@ export measurements, truncerrors, # projmpo.jl - checkflux, disk, ProjMPO, lproj, diff --git a/src/mpo.jl b/src/mpo.jl index 647ca1b..9acd561 100644 --- a/src/mpo.jl +++ b/src/mpo.jl @@ -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 diff --git a/src/mps.jl b/src/mps.jl index ef462a8..567319d 100644 --- a/src/mps.jl +++ b/src/mps.jl @@ -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 diff --git a/src/opsum_to_mpo/opsum_to_mpo_generic.jl b/src/opsum_to_mpo/opsum_to_mpo_generic.jl index e21806b..915fd0e 100644 --- a/src/opsum_to_mpo/opsum_to_mpo_generic.jl +++ b/src/opsum_to_mpo/opsum_to_mpo_generic.jl @@ -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 diff --git a/test/base/test_examples.jl b/test/base/test_examples.jl index 5267f2d..ead536e 100644 --- a/test/base/test_examples.jl +++ b/test/base/test_examples.jl @@ -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 @@ -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 diff --git a/test/base/test_exports.jl b/test/base/test_exports.jl index 32efaa0..5b84483 100644 --- a/test/base/test_exports.jl +++ b/test/base/test_exports.jl @@ -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 diff --git a/test/base/test_readme.jl b/test/base/test_readme.jl index 73563a6..e3b8b94 100644 --- a/test/base/test_readme.jl +++ b/test/base/test_readme.jl @@ -1,4 +1,4 @@ -using ITensors, Test +using ITensorMPS, ITensors, Test @testset "README Examples" begin @testset "ITensor Basics" begin diff --git a/test/base/test_solvers/test_tdvp.jl b/test/base/test_solvers/test_tdvp.jl index a135742..bf57e4d 100644 --- a/test/base/test_solvers/test_tdvp.jl +++ b/test/base/test_solvers/test_tdvp.jl @@ -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 diff --git a/test/base/test_solvers/test_tdvp_time_dependent.jl b/test/base/test_solvers/test_tdvp_time_dependent.jl index 63213f2..5fcc972 100644 --- a/test/base/test_solvers/test_tdvp_time_dependent.jl +++ b/test/base/test_solvers/test_tdvp_time_dependent.jl @@ -1,6 +1,16 @@ @eval module $(gensym()) using ITensors: ITensors, Index, QN, contract, scalartype -using ITensorMPS: ITensorMPS, MPO, MPS, ProjMPO, ProjMPOSum, TimeDependentSum, position!, random_mps, siteinds, tdvp +using ITensorMPS: + ITensorMPS, + MPO, + MPS, + ProjMPO, + ProjMPOSum, + TimeDependentSum, + position!, + random_mps, + siteinds, + tdvp using LinearAlgebra: norm using StableRNGs: StableRNG using Test: @test, @test_skip, @testset diff --git a/test/base/utils/TestITensorMPSExportedNames.jl b/test/base/utils/TestITensorMPSExportedNames.jl index 7993079..ba05f9a 100644 --- a/test/base/utils/TestITensorMPSExportedNames.jl +++ b/test/base/utils/TestITensorMPSExportedNames.jl @@ -6,12 +6,6 @@ const ITENSORMPS_EXPORTED_NAMES = [ Symbol("@TagType_str"), Symbol("@ValName_str"), Symbol("@preserve_ortho"), - Symbol("@visualize"), - Symbol("@visualize!"), - Symbol("@visualize_noeval"), - Symbol("@visualize_noeval!"), - Symbol("@visualize_sequence"), - Symbol("@visualize_sequence_noeval"), :AbstractMPS, :AbstractObserver, :Apply, @@ -39,6 +33,7 @@ const ITENSORMPS_EXPORTED_NAMES = [ :Sum, :TagType, :Sweeps, + :TimeDependentSum, :Trotter, :ValName, :add, @@ -58,6 +53,7 @@ const ITENSORMPS_EXPORTED_NAMES = [ :cutoff!, :disk, :dmrg, + :dmrg_x, :dot, :eigs, :energies, @@ -66,6 +62,7 @@ const ITENSORMPS_EXPORTED_NAMES = [ :error_contract, :error_mpoprod, :error_mul, + :expand, :expect, :findfirstsiteind, :findfirstsiteinds, @@ -86,6 +83,7 @@ const ITENSORMPS_EXPORTED_NAMES = [ :linkind, :linkindex, :linkinds, + :linsolve, :logdot, :loginner, :lognorm, @@ -142,6 +140,7 @@ const ITENSORMPS_EXPORTED_NAMES = [ :setmaxdim!, :setmindim!, :setnoise!, + :sim!, :simlinks!, :siteind, :siteindex, @@ -152,7 +151,9 @@ const ITENSORMPS_EXPORTED_NAMES = [ :sum, :swapbondsites, :sweepnext, + :tdvp, :tensors, + :to_vec, :toMPO, :totalqn, :tr,