diff --git a/Project.toml b/Project.toml index 7cb45bd..7ea025b 100644 --- a/Project.toml +++ b/Project.toml @@ -6,6 +6,7 @@ version = "0.3.9" [deps] EllipsisNotation = "da5c29d0-fa7d-589e-88eb-ea29b0a81949" FastMPOContractions = "f6e391d2-8ffa-4d7a-98cd-7e70024481ca" +ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2" ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" SparseIR = "4fe2279e-80f0-4adb-8463-ee114ff56b7d" @@ -14,7 +15,8 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] EllipsisNotation = "1" FastMPOContractions = "^0.2.2" -ITensors = "^0.3.42, 0.4, 0.5, 0.6" +ITensorMPS = "0.3.1" +ITensors = "0.7" SparseIR = "^0.96, 0.97, 1" StaticArrays = "1" julia = "1" diff --git a/notebook/matvec.ipynb b/notebook/matvec.ipynb index 9d5944c..dd745d2 100644 --- a/notebook/matvec.ipynb +++ b/notebook/matvec.ipynb @@ -8,6 +8,7 @@ "source": [ "using Revise\n", "using ITensors\n", + "using ITensorMPS: MPS, randomMPS\n", "#using ITensorTDVP\n", "import Quantics" ] @@ -79,7 +80,7 @@ "outputs": [], "source": [ "# Remove the dummy index z\n", - "AB = MPS([AB_ext[2n-1] * AB_ext[2n] * onehot(sitesz[n]=>1) for n in 1:R])" + "AB = MPS([AB_ext[2n-1] * AB_ext[2n] * onehot(sitesz[n] => 1) for n in 1:R])" ] }, { @@ -99,15 +100,15 @@ ], "metadata": { "kernelspec": { - "display_name": "Julia 1.8.5", + "display_name": "Julia 1.11.1", "language": "julia", - "name": "julia-1.8" + "name": "julia-1.11" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.8.5" + "version": "1.11.1" }, "orig_nbformat": 4 }, diff --git a/notebook/mul.ipynb b/notebook/mul.ipynb index 17b2af7..fc2abe4 100644 --- a/notebook/mul.ipynb +++ b/notebook/mul.ipynb @@ -8,6 +8,8 @@ "source": [ "using Revise\n", "using ITensors\n", + "using ITensors.SiteTypes: siteinds\n", + "using ITensorMPS: randomMPS\n", "using Quantics" ] }, @@ -79,15 +81,15 @@ ], "metadata": { "kernelspec": { - "display_name": "Julia 1.8.5", + "display_name": "Julia 1.11.1", "language": "julia", - "name": "julia-1.8" + "name": "julia-1.11" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", - "version": "1.8.5" + "version": "1.11.1" }, "orig_nbformat": 4 }, diff --git a/src/Quantics.jl b/src/Quantics.jl index 40f30ed..50e6939 100644 --- a/src/Quantics.jl +++ b/src/Quantics.jl @@ -1,4 +1,4 @@ -#__precompile__(false) +#__precompile__(false) module Quantics @@ -10,7 +10,10 @@ module Quantics using ITensors import ITensors +using ITensors.SiteTypes: siteinds import ITensors.NDTensors: Tensor, BlockSparseTensor, blockview +using ITensorMPS: MPS, MPO, AbstractMPS +using ITensorMPS: findsite, linkinds, linkind import SparseIR: Fermionic, Bosonic, Statistics import LinearAlgebra: I diff --git a/src/transformer.jl b/src/transformer.jl index 1335990..438ec40 100644 --- a/src/transformer.jl +++ b/src/transformer.jl @@ -137,7 +137,7 @@ function _phase_rotation_mpo(sites::AbstractVector{Index{T}}, θ::Float64)::MPO R = length(sites) tensors = [ITensor(true) for _ in 1:R] for n in 1:R - tensors[n] = op("Phase", sites[n]; ϕ=θ * 2^(R - n)) + tensors[n] = ITensors.SiteTypes.op("Phase", sites[n]; ϕ=θ * 2^(R - n)) end links = [Index(1, "Link,l=$l") for l in 1:(R - 1)] tensors[1] = ITensor( diff --git a/test/test_with_aqua.jl b/test/aqua_tests.jl similarity index 68% rename from test/test_with_aqua.jl rename to test/aqua_tests.jl index 0a8888c..370317d 100644 --- a/test/test_with_aqua.jl +++ b/test/aqua_tests.jl @@ -1,4 +1,5 @@ -@testitem begin +@testitem "code quality test" begin + using Test using Aqua import Quantics diff --git a/test/binaryop_tests.jl b/test/binaryop_tests.jl index 7444819..9be359d 100644 --- a/test/binaryop_tests.jl +++ b/test/binaryop_tests.jl @@ -1,6 +1,7 @@ @testitem "binaryop_tests.jl/_binaryop" begin using Test using ITensors + using ITensorMPS: randomMPS ITensors.disable_warn_order() using Quantics import Random @@ -64,6 +65,7 @@ end @testitem "binaryop_tests.jl/affinetransform" begin using Test using ITensors + using ITensorMPS: randomMPS ITensors.disable_warn_order() using Quantics import Random @@ -126,6 +128,7 @@ end @testitem "binaryop_tests.jl/affinetransform_three_vars" begin using Test using ITensors + using ITensorMPS: randomMPS ITensors.disable_warn_order() using Quantics import Random @@ -248,6 +251,7 @@ end @testitem "binaryop_tests.jl/shiftop" begin using Test using ITensors + using ITensorMPS: randomMPS ITensors.disable_warn_order() using Quantics import Random diff --git a/test/fouriertransform_tests.jl b/test/fouriertransform_tests.jl index f988338..f094df3 100644 --- a/test/fouriertransform_tests.jl +++ b/test/fouriertransform_tests.jl @@ -3,7 +3,8 @@ using Test using Quantics using ITensors - + using ITensorMPS: randomMPS, MPO + using ITensors.SiteTypes: siteinds # A brute-force implementation of _qft (only for tests) function _qft_ref(sites; cutoff::Float64=1e-14, sign::Int=1) abs(sign) == 1 || error("sign must either 1 or -1") @@ -41,6 +42,7 @@ end using Test using Quantics using ITensors + using ITensorMPS: randomMPS function _ft_1d_ref(X, sign, originx, origink) N = length(X) diff --git a/test/imaginarytime_tests.jl b/test/imaginarytime_tests.jl index 1356d72..48d783a 100644 --- a/test/imaginarytime_tests.jl +++ b/test/imaginarytime_tests.jl @@ -1,7 +1,8 @@ @testitem "imaginarytime_tests.jl/imaginarytime" begin using Test using Quantics - import ITensors: siteinds, Index + using ITensors: siteinds, Index + using ITensors.SiteTypes: op import ITensors import SparseIR: Fermionic, Bosonic, FermionicFreq, valueim diff --git a/test/mps_tests.jl b/test/mps_tests.jl index 39ee4df..964acf9 100644 --- a/test/mps_tests.jl +++ b/test/mps_tests.jl @@ -2,6 +2,7 @@ using Test import Quantics using ITensors + using ITensors.SiteTypes: siteinds @testset "onemps" begin nbit = 3 sites = siteinds("Qubit", nbit) @@ -14,6 +15,7 @@ end using Test import Quantics using ITensors + using ITensors.SiteTypes: siteinds @testset "expqtt" begin R = 10 sites = siteinds("Qubit", 10) diff --git a/test/mul_tests.jl b/test/mul_tests.jl index 742724e..c7328dc 100644 --- a/test/mul_tests.jl +++ b/test/mul_tests.jl @@ -2,6 +2,7 @@ using Test import Quantics using ITensors + using ITensorMPS: randomMPS, MPO @testset "_preprocess_matmul" begin N = 2 @@ -53,6 +54,7 @@ end using Test import Quantics using ITensors + using ITensorMPS: randomMPS @testset "matmul" for T in [Float64, ComplexF64] N = 3 @@ -120,6 +122,8 @@ end using Test import Quantics using ITensors + using ITensors.SiteTypes: siteinds + using ITensorMPS: randomMPS """ Reconstruct 3D matrix diff --git a/test/transformer_tests.jl b/test/transformer_tests.jl index cbc8e19..cd525c2 100644 --- a/test/transformer_tests.jl +++ b/test/transformer_tests.jl @@ -3,6 +3,8 @@ using Test import Quantics using ITensors + using ITensors.SiteTypes: siteinds + using ITensorMPS: randomMPS using LinearAlgebra @testset "upper_lower_triangle" for upper_or_lower in [:upper, :lower] @@ -59,6 +61,7 @@ end using Test import Quantics using ITensors + using ITensorMPS: randomMPS using LinearAlgebra @testset "reverseaxis" for bc in [1], nbit in 2:2, rev_carrydirec in [true, false] @@ -192,6 +195,7 @@ end using Test import Quantics using ITensors + using ITensorMPS: randomMPS using LinearAlgebra @testset "phase_rotation" begin @@ -215,6 +219,7 @@ end using Test import Quantics using ITensors + using ITensorMPS: randomMPS using LinearAlgebra @testset "shiftaxis" for R in [3], bc in [1, -1], rev_carrydirec in [true, false] diff --git a/test/util_tests.jl b/test/util_tests.jl index 6dc5325..eef0797 100644 --- a/test/util_tests.jl +++ b/test/util_tests.jl @@ -2,6 +2,8 @@ using Test import Quantics using ITensors + using ITensors.SiteTypes: siteinds + using ITensorMPS: randomMPS, randomMPO, random_mps, MPO @testset "_replace_mpo_siteinds!" begin nbit = 3