From 0cdf6f2e55061a7f629ff2273c9557fefc8b345a Mon Sep 17 00:00:00 2001 From: mtfishman Date: Sat, 11 May 2024 13:29:50 -0400 Subject: [PATCH 1/3] [ITensors] Don't export ITensorMPS --- Project.toml | 6 +----- src/ITensors.jl | 15 ++++++++++++--- src/exports.jl | 3 ++- src/lib/ITensorMPS/src/exports.jl | 1 + src/lib/ITensorMPS/src/mpo.jl | 1 + src/lib/ITensorMPS/test/base/Project.toml | 1 + src/usings.jl | 1 - .../TestITensorsExportedNames.jl | 1 - 8 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Project.toml b/Project.toml index 5420e6128a..093f9defe0 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensors" uuid = "9136182c-28ba-11e9-034c-db9fb085ebd5" authors = ["Matthew Fishman ", "Miles Stoudenmire "] -version = "0.6.1" +version = "0.6.2" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" @@ -20,7 +20,6 @@ PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" Requires = "ae029012-a4dd-5104-9daa-d747884805df" SerializedElementArrays = "d3ce8812-9567-47e9-a7b5-65a6d70a3065" SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" @@ -31,7 +30,6 @@ TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6" Zeros = "bd1ec220-6eb4-527a-9b49-e79c3db6233b" [weakdeps] -# ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d" @@ -39,7 +37,6 @@ VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8" ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444" [extensions] -# ITensorsChainRulesCoreExt = "ChainRulesCore" ITensorsHDF5Ext = "HDF5" ITensorsObserversExt = "Observers" ITensorsPackageCompilerExt = "PackageCompiler" @@ -65,7 +62,6 @@ PackageExtensionCompat = "1" Pkg = "1.6" Printf = "1.6" Random = "1.6" -Reexport = "1" Requires = "1.1" SerializedElementArrays = "0.1" SimpleTraits = "0.9.4" diff --git a/src/ITensors.jl b/src/ITensors.jl index 2ea74b5a9e..4d83ac52b6 100644 --- a/src/ITensors.jl +++ b/src/ITensors.jl @@ -158,9 +158,18 @@ include("lib/ITensorsOpsExt/src/ITensorsOpsExt.jl") include("fermions/fermions.jl") export fparity, isfermionic include("lib/ITensorMPS/src/ITensorMPS.jl") -# TODO: `using .ITensorMPS: ITensorMPS, ...` and -# explicit export list. -@reexport using .ITensorMPS +using .ITensorMPS: ITensorMPS +# Reexport everything exported by `ITensors.ITensorMPS` +# except for `ITensorMPS` itself. Ideally we would use +# `Reexport.jl` but that is not supported right now: +# https://github.com/simonster/Reexport.jl/issues/27 +# https://github.com/simonster/Reexport.jl/issues/39 +for name in names(ITensorMPS) + if name ≠ :ITensorMPS + @eval using .ITensorMPS: $name + @eval export $name + end +end include("lib/ITensorsNamedDimsArraysExt/src/ITensorsNamedDimsArraysExt.jl") using .ITensorsNamedDimsArraysExt: ITensorsNamedDimsArraysExt include("../ext/ITensorsChainRulesCoreExt/ITensorsChainRulesCoreExt.jl") diff --git a/src/exports.jl b/src/exports.jl index d0e2d57dae..4cc85c1f65 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -1,3 +1,5 @@ +using LinearAlgebra: ⋅ +export ⋅ export # From external modules # LinearAlgebra @@ -124,7 +126,6 @@ export diagitensor, diagITensor, directsum, - dot, eachnzblock, firstind, filterinds, diff --git a/src/lib/ITensorMPS/src/exports.jl b/src/lib/ITensorMPS/src/exports.jl index 2f5f142f3c..29a9826951 100644 --- a/src/lib/ITensorMPS/src/exports.jl +++ b/src/lib/ITensorMPS/src/exports.jl @@ -51,6 +51,7 @@ export MPS, # Methods ⋅, + dot, correlation_matrix, expect, inner, diff --git a/src/lib/ITensorMPS/src/mpo.jl b/src/lib/ITensorMPS/src/mpo.jl index a829577457..4758a468df 100644 --- a/src/lib/ITensorMPS/src/mpo.jl +++ b/src/lib/ITensorMPS/src/mpo.jl @@ -1,4 +1,5 @@ using Adapt: adapt +using LinearAlgebra: dot using Random: Random using ..SiteTypes: SiteTypes, siteind, siteinds diff --git a/src/lib/ITensorMPS/test/base/Project.toml b/src/lib/ITensorMPS/test/base/Project.toml index 4eceef30b9..895d21daab 100644 --- a/src/lib/ITensorMPS/test/base/Project.toml +++ b/src/lib/ITensorMPS/test/base/Project.toml @@ -4,3 +4,4 @@ HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" NDTensors = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf" +Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb" diff --git a/src/usings.jl b/src/usings.jl index a06d53fe5e..f01c587e17 100644 --- a/src/usings.jl +++ b/src/usings.jl @@ -16,7 +16,6 @@ using NDTensors.RankFactorization: Spectrum, eigs, entropy, truncerror using Pkg using Printf using Random -using Reexport using SerializedElementArrays using StaticArrays using TimerOutputs diff --git a/test/base/utils/TestITensorsExportedNames/TestITensorsExportedNames.jl b/test/base/utils/TestITensorsExportedNames/TestITensorsExportedNames.jl index ba63bb2972..b5d989e817 100644 --- a/test/base/utils/TestITensorsExportedNames/TestITensorsExportedNames.jl +++ b/test/base/utils/TestITensorsExportedNames/TestITensorsExportedNames.jl @@ -33,7 +33,6 @@ const ITENSORS_EXPORTED_NAMES = [ :DMRGMeasurement, :DMRGObserver, :ITensor, - :ITensorMPS, :ITensors, :Index, :IndexSet, From 9062e7dcd28c579367d9a843e290a73915a698da Mon Sep 17 00:00:00 2001 From: mtfishman Date: Sat, 11 May 2024 15:40:30 -0400 Subject: [PATCH 2/3] Don't export store from ITensors.ITensorMPS --- src/deprecated.jl | 1 - src/lib/ITensorMPS/src/deprecated.jl | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/deprecated.jl b/src/deprecated.jl index 6e2bc80472..545711bb12 100644 --- a/src/deprecated.jl +++ b/src/deprecated.jl @@ -1,4 +1,3 @@ - # global_variables.jl @deprecate disable_tblis!() ITensors.disable_tblis() @deprecate disable_warn_order!() ITensors.disable_warn_order() diff --git a/src/lib/ITensorMPS/src/deprecated.jl b/src/lib/ITensorMPS/src/deprecated.jl index e94a6bfd7c..8421a0b9db 100644 --- a/src/lib/ITensorMPS/src/deprecated.jl +++ b/src/lib/ITensorMPS/src/deprecated.jl @@ -1,6 +1,6 @@ # mps/abstractmps.jl @deprecate orthoCenter(args...; kwargs...) orthocenter(args...; kwargs...) -@deprecate store(m::AbstractMPS) data(m) +@deprecate store(m::AbstractMPS) data(m) false @deprecate replacesites!(args...; kwargs...) ITensors.replace_siteinds!(args...; kwargs...) @deprecate applyMPO(args...; kwargs...) contract(args...; kwargs...) @deprecate applympo(args...; kwargs...) contract(args...; kwargs...) From 7db54bad21b54a4f1a10c241f8808e40e95c3d64 Mon Sep 17 00:00:00 2001 From: mtfishman Date: Sun, 12 May 2024 09:48:25 -0400 Subject: [PATCH 3/3] Change namespace of cdot --- src/exports.jl | 2 -- src/lib/ITensorMPS/src/exports.jl | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/exports.jl b/src/exports.jl index 4cc85c1f65..76f6ad1843 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -1,5 +1,3 @@ -using LinearAlgebra: ⋅ -export ⋅ export # From external modules # LinearAlgebra diff --git a/src/lib/ITensorMPS/src/exports.jl b/src/lib/ITensorMPS/src/exports.jl index 29a9826951..4dae77014c 100644 --- a/src/lib/ITensorMPS/src/exports.jl +++ b/src/lib/ITensorMPS/src/exports.jl @@ -1,3 +1,4 @@ +using LinearAlgebra: ⋅ export # dmrg.jl dmrg,