diff --git a/PauliStrings.jl-1.5/LICENSE b/PauliStrings.jl-1.5/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9048d535895dbcf05aa678a2f5a0d0d2f9302f04 --- /dev/null +++ b/PauliStrings.jl-1.5/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Nicolas Loizeau <nicolas.loizeau@nbi.ku.dk> and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/PauliStrings.jl-1.5/Project.toml b/PauliStrings.jl-1.5/Project.toml new file mode 100644 index 0000000000000000000000000000000000000000..9511ff966bfe4a231339cffe19fb3006486910c4 --- /dev/null +++ b/PauliStrings.jl-1.5/Project.toml @@ -0,0 +1,25 @@ +name = "PauliStrings" +uuid = "f07625cc-80e4-4099-a362-36a3484d9bcc" +authors = ["Nicolas Loizeau <nicolas.loizeau@nbi.ku.dk> and contributors"] +version = "1.5.0" + +[deps] +Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + +[compat] +Dictionaries = "0.4" +Documenter = "1.6" +ProgressBars = "1.5" +SparseArrays = "1.6.0" +julia = "1.6.7" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/PauliStrings.jl-1.5/README.md b/PauliStrings.jl-1.5/README.md new file mode 120000 index 0000000000000000000000000000000000000000..8785db193efea5e355d1bb2800d28ca683261dd3 --- /dev/null +++ b/PauliStrings.jl-1.5/README.md @@ -0,0 +1 @@ +docs/src/index.md \ No newline at end of file diff --git a/PauliStrings.jl-1.5/docs/Manifest.toml b/PauliStrings.jl-1.5/docs/Manifest.toml new file mode 100644 index 0000000000000000000000000000000000000000..d918864d817f33922483615ed48df53e752369d0 --- /dev/null +++ b/PauliStrings.jl-1.5/docs/Manifest.toml @@ -0,0 +1,1186 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.11.2" +manifest_format = "2.0" +project_hash = "e26c63e84830e77f7ff923069470d73868f84cfd" + +[[deps.ANSIColoredPrinters]] +git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" +uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9" +version = "0.0.1" + +[[deps.AbstractTrees]] +git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177" +uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" +version = "0.4.5" + +[[deps.AliasTables]] +deps = ["PtrArrays", "Random"] +git-tree-sha1 = "9876e1e164b144ca45e9e3198d0b689cadfed9ff" +uuid = "66dad0bd-aa9a-41b7-9441-69ab47430ed8" +version = "1.1.3" + +[[deps.ArgTools]] +uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" +version = "1.1.2" + +[[deps.Artifacts]] +uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +version = "1.11.0" + +[[deps.Base64]] +uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +version = "1.11.0" + +[[deps.BitFlags]] +git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d" +uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35" +version = "0.1.9" + +[[deps.Bzip2_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "8873e196c2eb87962a2048b3b8e08946535864a1" +uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0" +version = "1.0.8+4" + +[[deps.Cairo_jll]] +deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"] +git-tree-sha1 = "009060c9a6168704143100f36ab08f06c2af4642" +uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a" +version = "1.18.2+1" + +[[deps.CodecZlib]] +deps = ["TranscodingStreams", "Zlib_jll"] +git-tree-sha1 = "bce6804e5e6044c6daab27bb533d1295e4a2e759" +uuid = "944b1d66-785c-5afd-91f1-9de20f533193" +version = "0.7.6" + +[[deps.ColorSchemes]] +deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] +git-tree-sha1 = "26ec26c98ae1453c692efded2b17e15125a5bea1" +uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" +version = "3.28.0" + +[[deps.ColorTypes]] +deps = ["FixedPointNumbers", "Random"] +git-tree-sha1 = "c7acce7a7e1078a20a285211dd73cd3941a871d6" +uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" +version = "0.12.0" +weakdeps = ["StyledStrings"] + + [deps.ColorTypes.extensions] + StyledStringsExt = "StyledStrings" + +[[deps.ColorVectorSpace]] +deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"] +git-tree-sha1 = "8b3b6f87ce8f65a2b4f857528fd8d70086cd72b1" +uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" +version = "0.11.0" + + [deps.ColorVectorSpace.extensions] + SpecialFunctionsExt = "SpecialFunctions" + + [deps.ColorVectorSpace.weakdeps] + SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" + +[[deps.Colors]] +deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] +git-tree-sha1 = "64e15186f0aa277e174aa81798f7eb8598e0157e" +uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" +version = "0.13.0" + +[[deps.Compat]] +deps = ["TOML", "UUIDs"] +git-tree-sha1 = "8ae8d32e09f0dcf42a36b90d4e17f5dd2e4c4215" +uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" +version = "4.16.0" +weakdeps = ["Dates", "LinearAlgebra"] + + [deps.Compat.extensions] + CompatLinearAlgebraExt = "LinearAlgebra" + +[[deps.CompilerSupportLibraries_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "1.1.1+0" + +[[deps.ConcurrentUtilities]] +deps = ["Serialization", "Sockets"] +git-tree-sha1 = "f36e5e8fdffcb5646ea5da81495a5a7566005127" +uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb" +version = "2.4.3" + +[[deps.Contour]] +git-tree-sha1 = "439e35b0b36e2e5881738abc8857bd92ad6ff9a8" +uuid = "d38c429a-6771-53c6-b99e-75d170b6e991" +version = "0.6.3" + +[[deps.DataAPI]] +git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe" +uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" +version = "1.16.0" + +[[deps.DataStructures]] +deps = ["Compat", "InteractiveUtils", "OrderedCollections"] +git-tree-sha1 = "1d0a14036acb104d9e89698bd408f63ab58cdc82" +uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" +version = "0.18.20" + +[[deps.Dates]] +deps = ["Printf"] +uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +version = "1.11.0" + +[[deps.Dbus_jll]] +deps = ["Artifacts", "Expat_jll", "JLLWrappers", "Libdl"] +git-tree-sha1 = "fc173b380865f70627d7dd1190dc2fce6cc105af" +uuid = "ee1fde0b-3d02-5ea6-8484-8dfef6360eab" +version = "1.14.10+0" + +[[deps.DelimitedFiles]] +deps = ["Mmap"] +git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae" +uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" +version = "1.9.1" + +[[deps.DocStringExtensions]] +deps = ["LibGit2"] +git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" +uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" +version = "0.9.3" + +[[deps.Documenter]] +deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "CodecZlib", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "TOML", "Test", "Unicode"] +git-tree-sha1 = "d0ea2c044963ed6f37703cead7e29f70cba13d7e" +uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +version = "1.8.0" + +[[deps.Downloads]] +deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] +uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +version = "1.6.0" + +[[deps.EpollShim_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "8a4be429317c42cfae6a7fc03c31bad1970c310d" +uuid = "2702e6a9-849d-5ed8-8c21-79e8b8f9ee43" +version = "0.0.20230411+1" + +[[deps.ExceptionUnwrapping]] +deps = ["Test"] +git-tree-sha1 = "d36f682e590a83d63d1c7dbd287573764682d12a" +uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4" +version = "0.1.11" + +[[deps.Expat_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "e51db81749b0777b2147fbe7b783ee79045b8e99" +uuid = "2e619515-83b5-522b-bb60-26c02a35a201" +version = "2.6.4+3" + +[[deps.FFMPEG]] +deps = ["FFMPEG_jll"] +git-tree-sha1 = "53ebe7511fa11d33bec688a9178fac4e49eeee00" +uuid = "c87230d0-a227-11e9-1b43-d7ebe4e7570a" +version = "0.4.2" + +[[deps.FFMPEG_jll]] +deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "PCRE2_jll", "Zlib_jll", "libaom_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"] +git-tree-sha1 = "466d45dc38e15794ec7d5d63ec03d776a9aff36e" +uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5" +version = "4.4.4+1" + +[[deps.FileWatching]] +uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" +version = "1.11.0" + +[[deps.FixedPointNumbers]] +deps = ["Statistics"] +git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172" +uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" +version = "0.8.5" + +[[deps.Fontconfig_jll]] +deps = ["Artifacts", "Bzip2_jll", "Expat_jll", "FreeType2_jll", "JLLWrappers", "Libdl", "Libuuid_jll", "Zlib_jll"] +git-tree-sha1 = "21fac3c77d7b5a9fc03b0ec503aa1a6392c34d2b" +uuid = "a3f928ae-7b40-5064-980b-68af3947d34b" +version = "2.15.0+0" + +[[deps.Format]] +git-tree-sha1 = "9c68794ef81b08086aeb32eeaf33531668d5f5fc" +uuid = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8" +version = "1.3.7" + +[[deps.FreeType2_jll]] +deps = ["Artifacts", "Bzip2_jll", "JLLWrappers", "Libdl", "Zlib_jll"] +git-tree-sha1 = "786e968a8d2fb167f2e4880baba62e0e26bd8e4e" +uuid = "d7e528f0-a631-5988-bf34-fe36492bcfd7" +version = "2.13.3+1" + +[[deps.FriBidi_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "846f7026a9decf3679419122b49f8a1fdb48d2d5" +uuid = "559328eb-81f9-559d-9380-de523a88c83c" +version = "1.0.16+0" + +[[deps.GLFW_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Libglvnd_jll", "Xorg_libXcursor_jll", "Xorg_libXi_jll", "Xorg_libXinerama_jll", "Xorg_libXrandr_jll", "libdecor_jll", "xkbcommon_jll"] +git-tree-sha1 = "fcb0584ff34e25155876418979d4c8971243bb89" +uuid = "0656b61e-2033-5cc2-a64a-77c0f6c09b89" +version = "3.4.0+2" + +[[deps.GR]] +deps = ["Artifacts", "Base64", "DelimitedFiles", "Downloads", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Preferences", "Printf", "Qt6Wayland_jll", "Random", "Serialization", "Sockets", "TOML", "Tar", "Test", "p7zip_jll"] +git-tree-sha1 = "9bf00ba4c45867c86251a7fd4cb646dcbeb41bf0" +uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" +version = "0.73.12" + +[[deps.GR_jll]] +deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "FreeType2_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Qt6Base_jll", "Zlib_jll", "libpng_jll"] +git-tree-sha1 = "36d5430819123553bf31dfdceb3653ca7d9e62d7" +uuid = "d2c73de3-f751-5644-a686-071e5b155ba9" +version = "0.73.12+0" + +[[deps.Gettext_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"] +git-tree-sha1 = "9b02998aba7bf074d14de89f9d37ca24a1a0b046" +uuid = "78b55507-aeef-58d4-861c-77aaff3498b1" +version = "0.21.0+0" + +[[deps.Git]] +deps = ["Git_jll"] +git-tree-sha1 = "04eff47b1354d702c3a85e8ab23d539bb7d5957e" +uuid = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2" +version = "1.3.1" + +[[deps.Git_jll]] +deps = ["Artifacts", "Expat_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "PCRE2_jll", "Zlib_jll"] +git-tree-sha1 = "399f4a308c804b446ae4c91eeafadb2fe2c54ff9" +uuid = "f8c6e375-362e-5223-8a59-34ff63f689eb" +version = "2.47.1+0" + +[[deps.Glib_jll]] +deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"] +git-tree-sha1 = "b0036b392358c80d2d2124746c2bf3d48d457938" +uuid = "7746bdde-850d-59dc-9ae8-88ece973131d" +version = "2.82.4+0" + +[[deps.Graphite2_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "01979f9b37367603e2848ea225918a3b3861b606" +uuid = "3b182d85-2403-5c21-9c21-1e1f0cc25472" +version = "1.3.14+1" + +[[deps.Grisu]] +git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2" +uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe" +version = "1.0.2" + +[[deps.HTTP]] +deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "PrecompileTools", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] +git-tree-sha1 = "c67b33b085f6e2faf8bf79a61962e7339a81129c" +uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" +version = "1.10.15" + +[[deps.HarfBuzz_jll]] +deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll"] +git-tree-sha1 = "55c53be97790242c29031e5cd45e8ac296dadda3" +uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566" +version = "8.5.0+0" + +[[deps.IOCapture]] +deps = ["Logging", "Random"] +git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770" +uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" +version = "0.2.5" + +[[deps.InteractiveUtils]] +deps = ["Markdown"] +uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +version = "1.11.0" + +[[deps.IrrationalConstants]] +git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" +uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" +version = "0.2.2" + +[[deps.JLFzf]] +deps = ["Pipe", "REPL", "Random", "fzf_jll"] +git-tree-sha1 = "71b48d857e86bf7a1838c4736545699974ce79a2" +uuid = "1019f520-868f-41f5-a6de-eb00f4b6a39c" +version = "0.1.9" + +[[deps.JLLWrappers]] +deps = ["Artifacts", "Preferences"] +git-tree-sha1 = "a007feb38b422fbdab534406aeca1b86823cb4d6" +uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" +version = "1.7.0" + +[[deps.JSON]] +deps = ["Dates", "Mmap", "Parsers", "Unicode"] +git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" +uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +version = "0.21.4" + +[[deps.JpegTurbo_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "eac1206917768cb54957c65a615460d87b455fc1" +uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8" +version = "3.1.1+0" + +[[deps.LAME_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "170b660facf5df5de098d866564877e119141cbd" +uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d" +version = "3.100.2+0" + +[[deps.LERC_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "aaafe88dccbd957a8d82f7d05be9b69172e0cee3" +uuid = "88015f11-f218-50d7-93a8-a6af411a945d" +version = "4.0.1+0" + +[[deps.LLVMOpenMP_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "78211fb6cbc872f77cad3fc0b6cf647d923f4929" +uuid = "1d63c593-3942-5779-bab2-d838dc0a180e" +version = "18.1.7+0" + +[[deps.LZO_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "1c602b1127f4751facb671441ca72715cc95938a" +uuid = "dd4b983a-f0e5-5f8d-a1b7-129d4a5fb1ac" +version = "2.10.3+0" + +[[deps.LaTeXStrings]] +git-tree-sha1 = "dda21b8cbd6a6c40d9d02a73230f9d70fed6918c" +uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" +version = "1.4.0" + +[[deps.Latexify]] +deps = ["Format", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "OrderedCollections", "Requires"] +git-tree-sha1 = "ce5f5621cac23a86011836badfedf664a612cee4" +uuid = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" +version = "0.16.5" + + [deps.Latexify.extensions] + DataFramesExt = "DataFrames" + SparseArraysExt = "SparseArrays" + SymEngineExt = "SymEngine" + + [deps.Latexify.weakdeps] + DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" + SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8" + +[[deps.LazilyInitializedFields]] +git-tree-sha1 = "0f2da712350b020bc3957f269c9caad516383ee0" +uuid = "0e77f7df-68c5-4e49-93ce-4cd80f5598bf" +version = "1.3.0" + +[[deps.LibCURL]] +deps = ["LibCURL_jll", "MozillaCACerts_jll"] +uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +version = "0.6.4" + +[[deps.LibCURL_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] +uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" +version = "8.6.0+0" + +[[deps.LibGit2]] +deps = ["Base64", "LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" +version = "1.11.0" + +[[deps.LibGit2_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"] +uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" +version = "1.7.2+0" + +[[deps.LibSSH2_jll]] +deps = ["Artifacts", "Libdl", "MbedTLS_jll"] +uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" +version = "1.11.0+1" + +[[deps.Libdl]] +uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +version = "1.11.0" + +[[deps.Libffi_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "27ecae93dd25ee0909666e6835051dd684cc035e" +uuid = "e9f186c6-92d2-5b65-8a66-fee21dc1b490" +version = "3.2.2+2" + +[[deps.Libgcrypt_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgpg_error_jll"] +git-tree-sha1 = "8be878062e0ffa2c3f67bb58a595375eda5de80b" +uuid = "d4300ac3-e22c-5743-9152-c294e39db1e4" +version = "1.11.0+0" + +[[deps.Libglvnd_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll", "Xorg_libXext_jll"] +git-tree-sha1 = "ff3b4b9d35de638936a525ecd36e86a8bb919d11" +uuid = "7e76a0d4-f3c7-5321-8279-8d96eeed0f29" +version = "1.7.0+0" + +[[deps.Libgpg_error_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "df37206100d39f79b3376afb6b9cee4970041c61" +uuid = "7add5ba3-2f88-524e-9cd5-f83b8a55f7b8" +version = "1.51.1+0" + +[[deps.Libiconv_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "be484f5c92fad0bd8acfef35fe017900b0b73809" +uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531" +version = "1.18.0+0" + +[[deps.Libmount_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "89211ea35d9df5831fca5d33552c02bd33878419" +uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9" +version = "2.40.3+0" + +[[deps.Libtiff_jll]] +deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "LERC_jll", "Libdl", "XZ_jll", "Zlib_jll", "Zstd_jll"] +git-tree-sha1 = "4ab7581296671007fc33f07a721631b8855f4b1d" +uuid = "89763e89-9b03-5906-acba-b20f662cd828" +version = "4.7.1+0" + +[[deps.Libuuid_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "e888ad02ce716b319e6bdb985d2ef300e7089889" +uuid = "38a345b3-de98-5d2b-a5d3-14cd9215e700" +version = "2.40.3+0" + +[[deps.LinearAlgebra]] +deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] +uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +version = "1.11.0" + +[[deps.LogExpFunctions]] +deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] +git-tree-sha1 = "13ca9e2586b89836fd20cccf56e57e2b9ae7f38f" +uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" +version = "0.3.29" + + [deps.LogExpFunctions.extensions] + LogExpFunctionsChainRulesCoreExt = "ChainRulesCore" + LogExpFunctionsChangesOfVariablesExt = "ChangesOfVariables" + LogExpFunctionsInverseFunctionsExt = "InverseFunctions" + + [deps.LogExpFunctions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + +[[deps.Logging]] +uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +version = "1.11.0" + +[[deps.LoggingExtras]] +deps = ["Dates", "Logging"] +git-tree-sha1 = "f02b56007b064fbfddb4c9cd60161b6dd0f40df3" +uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" +version = "1.1.0" + +[[deps.MacroTools]] +git-tree-sha1 = "72aebe0b5051e5143a079a4685a46da330a40472" +uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +version = "0.5.15" + +[[deps.Markdown]] +deps = ["Base64"] +uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +version = "1.11.0" + +[[deps.MarkdownAST]] +deps = ["AbstractTrees", "Markdown"] +git-tree-sha1 = "465a70f0fc7d443a00dcdc3267a497397b8a3899" +uuid = "d0879d2d-cac2-40c8-9cee-1863dc0c7391" +version = "0.1.2" + +[[deps.MbedTLS]] +deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "NetworkOptions", "Random", "Sockets"] +git-tree-sha1 = "c067a280ddc25f196b5e7df3877c6b226d390aaf" +uuid = "739be429-bea8-5141-9913-cc70e7f3736d" +version = "1.1.9" + +[[deps.MbedTLS_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" +version = "2.28.6+0" + +[[deps.Measures]] +git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102" +uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e" +version = "0.3.2" + +[[deps.Missings]] +deps = ["DataAPI"] +git-tree-sha1 = "ec4f7fbeab05d7747bdf98eb74d130a2a2ed298d" +uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28" +version = "1.2.0" + +[[deps.Mmap]] +uuid = "a63ad114-7e13-5084-954f-fe012c677804" +version = "1.11.0" + +[[deps.MozillaCACerts_jll]] +uuid = "14a3606d-f60d-562e-9121-12d972cd8159" +version = "2023.12.12" + +[[deps.NaNMath]] +deps = ["OpenLibm_jll"] +git-tree-sha1 = "fe891aea7ccd23897520db7f16931212454e277e" +uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" +version = "1.1.1" + +[[deps.NetworkOptions]] +uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" +version = "1.2.0" + +[[deps.Ogg_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "887579a3eb005446d514ab7aeac5d1d027658b8f" +uuid = "e7412a2a-1a6e-54c0-be00-318e2571c051" +version = "1.3.5+1" + +[[deps.OpenBLAS_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] +uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" +version = "0.3.27+1" + +[[deps.OpenLibm_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "05823500-19ac-5b8b-9628-191a04bc5112" +version = "0.8.1+2" + +[[deps.OpenSSL]] +deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"] +git-tree-sha1 = "38cb508d080d21dc1128f7fb04f20387ed4c0af4" +uuid = "4d8831e6-92b7-49fb-bdf8-b643e874388c" +version = "1.4.3" + +[[deps.OpenSSL_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "7493f61f55a6cce7325f197443aa80d32554ba10" +uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" +version = "3.0.15+3" + +[[deps.Opus_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "6703a85cb3781bd5909d48730a67205f3f31a575" +uuid = "91d4177d-7536-5919-b921-800302f37372" +version = "1.3.3+0" + +[[deps.OrderedCollections]] +git-tree-sha1 = "12f1439c4f986bb868acda6ea33ebc78e19b95ad" +uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" +version = "1.7.0" + +[[deps.PCRE2_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15" +version = "10.42.0+1" + +[[deps.Pango_jll]] +deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "FriBidi_jll", "Glib_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl"] +git-tree-sha1 = "ed6834e95bd326c52d5675b4181386dfbe885afb" +uuid = "36c8627f-9965-5494-a995-c6b170f724f3" +version = "1.55.5+0" + +[[deps.Parsers]] +deps = ["Dates", "PrecompileTools", "UUIDs"] +git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" +uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" +version = "2.8.1" + +[[deps.Pipe]] +git-tree-sha1 = "6842804e7867b115ca9de748a0cf6b364523c16d" +uuid = "b98c9c47-44ae-5843-9183-064241ee97a0" +version = "1.3.0" + +[[deps.Pixman_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LLVMOpenMP_jll", "Libdl"] +git-tree-sha1 = "35621f10a7531bc8fa58f74610b1bfb70a3cfc6b" +uuid = "30392449-352a-5448-841d-b1acce4e97dc" +version = "0.43.4+0" + +[[deps.Pkg]] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"] +uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +version = "1.11.0" +weakdeps = ["REPL"] + + [deps.Pkg.extensions] + REPLExt = "REPL" + +[[deps.PlotThemes]] +deps = ["PlotUtils", "Statistics"] +git-tree-sha1 = "41031ef3a1be6f5bbbf3e8073f210556daeae5ca" +uuid = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a" +version = "3.3.0" + +[[deps.PlotUtils]] +deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "StableRNGs", "Statistics"] +git-tree-sha1 = "3ca9a356cd2e113c420f2c13bea19f8d3fb1cb18" +uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043" +version = "1.4.3" + +[[deps.Plots]] +deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "TOML", "UUIDs", "UnicodeFun", "UnitfulLatexify", "Unzip"] +git-tree-sha1 = "dae01f8c2e069a683d3a6e17bbae5070ab94786f" +uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +version = "1.40.9" + + [deps.Plots.extensions] + FileIOExt = "FileIO" + GeometryBasicsExt = "GeometryBasics" + IJuliaExt = "IJulia" + ImageInTerminalExt = "ImageInTerminal" + UnitfulExt = "Unitful" + + [deps.Plots.weakdeps] + FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" + GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" + IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" + ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254" + Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" + +[[deps.PrecompileTools]] +deps = ["Preferences"] +git-tree-sha1 = "5aa36f7049a63a1528fe8f7c3f2113413ffd4e1f" +uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +version = "1.2.1" + +[[deps.Preferences]] +deps = ["TOML"] +git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6" +uuid = "21216c6a-2e73-6563-6e65-726566657250" +version = "1.4.3" + +[[deps.Printf]] +deps = ["Unicode"] +uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" +version = "1.11.0" + +[[deps.PtrArrays]] +git-tree-sha1 = "1d36ef11a9aaf1e8b74dacc6a731dd1de8fd493d" +uuid = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d" +version = "1.3.0" + +[[deps.Qt6Base_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Fontconfig_jll", "Glib_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "OpenSSL_jll", "Vulkan_Loader_jll", "Xorg_libSM_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Xorg_libxcb_jll", "Xorg_xcb_util_cursor_jll", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_keysyms_jll", "Xorg_xcb_util_renderutil_jll", "Xorg_xcb_util_wm_jll", "Zlib_jll", "libinput_jll", "xkbcommon_jll"] +git-tree-sha1 = "492601870742dcd38f233b23c3ec629628c1d724" +uuid = "c0090381-4147-56d7-9ebc-da0b1113ec56" +version = "6.7.1+1" + +[[deps.Qt6Declarative_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Qt6Base_jll", "Qt6ShaderTools_jll"] +git-tree-sha1 = "e5dd466bf2569fe08c91a2cc29c1003f4797ac3b" +uuid = "629bc702-f1f5-5709-abd5-49b8460ea067" +version = "6.7.1+2" + +[[deps.Qt6ShaderTools_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Qt6Base_jll"] +git-tree-sha1 = "1a180aeced866700d4bebc3120ea1451201f16bc" +uuid = "ce943373-25bb-56aa-8eca-768745ed7b5a" +version = "6.7.1+1" + +[[deps.Qt6Wayland_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Qt6Base_jll", "Qt6Declarative_jll"] +git-tree-sha1 = "729927532d48cf79f49070341e1d918a65aba6b0" +uuid = "e99dba38-086e-5de3-a5b1-6e4c66e897c3" +version = "6.7.1+1" + +[[deps.REPL]] +deps = ["InteractiveUtils", "Markdown", "Sockets", "StyledStrings", "Unicode"] +uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" +version = "1.11.0" + +[[deps.Random]] +deps = ["SHA"] +uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +version = "1.11.0" + +[[deps.RecipesBase]] +deps = ["PrecompileTools"] +git-tree-sha1 = "5c3d09cc4f31f5fc6af001c250bf1278733100ff" +uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" +version = "1.3.4" + +[[deps.RecipesPipeline]] +deps = ["Dates", "NaNMath", "PlotUtils", "PrecompileTools", "RecipesBase"] +git-tree-sha1 = "45cf9fd0ca5839d06ef333c8201714e888486342" +uuid = "01d81517-befc-4cb6-b9ec-a95719d0359c" +version = "0.6.12" + +[[deps.Reexport]] +git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" +uuid = "189a3867-3050-52da-a836-e630ba90ab69" +version = "1.2.2" + +[[deps.RegistryInstances]] +deps = ["LazilyInitializedFields", "Pkg", "TOML", "Tar"] +git-tree-sha1 = "ffd19052caf598b8653b99404058fce14828be51" +uuid = "2792f1a3-b283-48e8-9a74-f99dce5104f3" +version = "0.1.0" + +[[deps.RelocatableFolders]] +deps = ["SHA", "Scratch"] +git-tree-sha1 = "ffdaf70d81cf6ff22c2b6e733c900c3321cab864" +uuid = "05181044-ff0b-4ac5-8273-598c1e38db00" +version = "1.0.1" + +[[deps.Requires]] +deps = ["UUIDs"] +git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" +uuid = "ae029012-a4dd-5104-9daa-d747884805df" +version = "1.3.0" + +[[deps.SHA]] +uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" +version = "0.7.0" + +[[deps.Scratch]] +deps = ["Dates"] +git-tree-sha1 = "3bac05bc7e74a75fd9cba4295cde4045d9fe2386" +uuid = "6c6a2e73-6563-6170-7368-637461726353" +version = "1.2.1" + +[[deps.Serialization]] +uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +version = "1.11.0" + +[[deps.Showoff]] +deps = ["Dates", "Grisu"] +git-tree-sha1 = "91eddf657aca81df9ae6ceb20b959ae5653ad1de" +uuid = "992d4aef-0814-514b-bc4d-f2e9a6c4116f" +version = "1.0.3" + +[[deps.SimpleBufferStream]] +git-tree-sha1 = "f305871d2f381d21527c770d4788c06c097c9bc1" +uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7" +version = "1.2.0" + +[[deps.Sockets]] +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" +version = "1.11.0" + +[[deps.SortingAlgorithms]] +deps = ["DataStructures"] +git-tree-sha1 = "66e0a8e672a0bdfca2c3f5937efb8538b9ddc085" +uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" +version = "1.2.1" + +[[deps.SparseArrays]] +deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] +uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +version = "1.11.0" + +[[deps.StableRNGs]] +deps = ["Random"] +git-tree-sha1 = "83e6cce8324d49dfaf9ef059227f91ed4441a8e5" +uuid = "860ef19b-820b-49d6-a774-d7a799459cd3" +version = "1.0.2" + +[[deps.Statistics]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0" +uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +version = "1.11.1" +weakdeps = ["SparseArrays"] + + [deps.Statistics.extensions] + SparseArraysExt = ["SparseArrays"] + +[[deps.StatsAPI]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "1ff449ad350c9c4cbc756624d6f8a8c3ef56d3ed" +uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" +version = "1.7.0" + +[[deps.StatsBase]] +deps = ["AliasTables", "DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] +git-tree-sha1 = "29321314c920c26684834965ec2ce0dacc9cf8e5" +uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +version = "0.34.4" + +[[deps.StyledStrings]] +uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" +version = "1.11.0" + +[[deps.SuiteSparse_jll]] +deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] +uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" +version = "7.7.0+0" + +[[deps.TOML]] +deps = ["Dates"] +uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" +version = "1.0.3" + +[[deps.Tar]] +deps = ["ArgTools", "SHA"] +uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" +version = "1.10.0" + +[[deps.TensorCore]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "1feb45f88d133a655e001435632f019a9a1bcdb6" +uuid = "62fd8b95-f654-4bbd-a8a5-9c27f68ccd50" +version = "0.1.1" + +[[deps.Test]] +deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] +uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +version = "1.11.0" + +[[deps.TranscodingStreams]] +git-tree-sha1 = "0c45878dcfdcfa8480052b6ab162cdd138781742" +uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" +version = "0.11.3" + +[[deps.URIs]] +git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b" +uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" +version = "1.5.1" + +[[deps.UUIDs]] +deps = ["Random", "SHA"] +uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +version = "1.11.0" + +[[deps.Unicode]] +uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +version = "1.11.0" + +[[deps.UnicodeFun]] +deps = ["REPL"] +git-tree-sha1 = "53915e50200959667e78a92a418594b428dffddf" +uuid = "1cfade01-22cf-5700-b092-accc4b62d6e1" +version = "0.4.1" + +[[deps.Unitful]] +deps = ["Dates", "LinearAlgebra", "Random"] +git-tree-sha1 = "c0667a8e676c53d390a09dc6870b3d8d6650e2bf" +uuid = "1986cc42-f94f-5a68-af5c-568840ba703d" +version = "1.22.0" + + [deps.Unitful.extensions] + ConstructionBaseUnitfulExt = "ConstructionBase" + InverseFunctionsUnitfulExt = "InverseFunctions" + + [deps.Unitful.weakdeps] + ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + +[[deps.UnitfulLatexify]] +deps = ["LaTeXStrings", "Latexify", "Unitful"] +git-tree-sha1 = "975c354fcd5f7e1ddcc1f1a23e6e091d99e99bc8" +uuid = "45397f5d-5981-4c77-b2b3-fc36d6e9b728" +version = "1.6.4" + +[[deps.Unzip]] +git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78" +uuid = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d" +version = "0.2.0" + +[[deps.Vulkan_Loader_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Wayland_jll", "Xorg_libX11_jll", "Xorg_libXrandr_jll", "xkbcommon_jll"] +git-tree-sha1 = "2f0486047a07670caad3a81a075d2e518acc5c59" +uuid = "a44049a8-05dd-5a78-86c9-5fde0876e88c" +version = "1.3.243+0" + +[[deps.Wayland_jll]] +deps = ["Artifacts", "EpollShim_jll", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg", "XML2_jll"] +git-tree-sha1 = "85c7811eddec9e7f22615371c3cc81a504c508ee" +uuid = "a2964d1f-97da-50d4-b82a-358c7fce9d89" +version = "1.21.0+2" + +[[deps.Wayland_protocols_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "5db3e9d307d32baba7067b13fc7b5aa6edd4a19a" +uuid = "2381bf8a-dfd0-557d-9999-79630e7b1b91" +version = "1.36.0+0" + +[[deps.XML2_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"] +git-tree-sha1 = "a2fccc6559132927d4c5dc183e3e01048c6dcbd6" +uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a" +version = "2.13.5+0" + +[[deps.XSLT_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgcrypt_jll", "Libgpg_error_jll", "Libiconv_jll", "XML2_jll", "Zlib_jll"] +git-tree-sha1 = "7d1671acbe47ac88e981868a078bd6b4e27c5191" +uuid = "aed1982a-8fda-507f-9586-7b0439959a61" +version = "1.1.42+0" + +[[deps.XZ_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "56c6604ec8b2d82cc4cfe01aa03b00426aac7e1f" +uuid = "ffd25f8a-64ca-5728-b0f7-c24cf3aae800" +version = "5.6.4+1" + +[[deps.Xorg_libICE_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "326b4fea307b0b39892b3e85fa451692eda8d46c" +uuid = "f67eecfb-183a-506d-b269-f58e52b52d7c" +version = "1.1.1+0" + +[[deps.Xorg_libSM_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libICE_jll"] +git-tree-sha1 = "3796722887072218eabafb494a13c963209754ce" +uuid = "c834827a-8449-5923-a945-d239c165b7dd" +version = "1.2.4+0" + +[[deps.Xorg_libX11_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxcb_jll", "Xorg_xtrans_jll"] +git-tree-sha1 = "9dafcee1d24c4f024e7edc92603cedba72118283" +uuid = "4f6342f7-b3d2-589e-9d20-edeb45f2b2bc" +version = "1.8.6+3" + +[[deps.Xorg_libXau_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "e9216fdcd8514b7072b43653874fd688e4c6c003" +uuid = "0c0b7dd1-d40b-584c-a123-a41640f87eec" +version = "1.0.12+0" + +[[deps.Xorg_libXcursor_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libXfixes_jll", "Xorg_libXrender_jll"] +git-tree-sha1 = "807c226eaf3651e7b2c468f687ac788291f9a89b" +uuid = "935fb764-8cf2-53bf-bb30-45bb1f8bf724" +version = "1.2.3+0" + +[[deps.Xorg_libXdmcp_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "89799ae67c17caa5b3b5a19b8469eeee474377db" +uuid = "a3789734-cfe1-5b06-b2d0-1dd0d9d62d05" +version = "1.1.5+0" + +[[deps.Xorg_libXext_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"] +git-tree-sha1 = "d7155fea91a4123ef59f42c4afb5ab3b4ca95058" +uuid = "1082639a-0dae-5f34-9b06-72781eeb8cb3" +version = "1.3.6+3" + +[[deps.Xorg_libXfixes_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"] +git-tree-sha1 = "6fcc21d5aea1a0b7cce6cab3e62246abd1949b86" +uuid = "d091e8ba-531a-589c-9de9-94069b037ed8" +version = "6.0.0+0" + +[[deps.Xorg_libXi_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libXext_jll", "Xorg_libXfixes_jll"] +git-tree-sha1 = "984b313b049c89739075b8e2a94407076de17449" +uuid = "a51aa0fd-4e3c-5386-b890-e753decda492" +version = "1.8.2+0" + +[[deps.Xorg_libXinerama_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libXext_jll"] +git-tree-sha1 = "a1a7eaf6c3b5b05cb903e35e8372049b107ac729" +uuid = "d1454406-59df-5ea1-beac-c340f2130bc3" +version = "1.1.5+0" + +[[deps.Xorg_libXrandr_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libXext_jll", "Xorg_libXrender_jll"] +git-tree-sha1 = "b6f664b7b2f6a39689d822a6300b14df4668f0f4" +uuid = "ec84b674-ba8e-5d96-8ba1-2a689ba10484" +version = "1.5.4+0" + +[[deps.Xorg_libXrender_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"] +git-tree-sha1 = "a490c6212a0e90d2d55111ac956f7c4fa9c277a6" +uuid = "ea2f1a96-1ddc-540d-b46f-429655e07cfa" +version = "0.9.11+1" + +[[deps.Xorg_libpthread_stubs_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "c57201109a9e4c0585b208bb408bc41d205ac4e9" +uuid = "14d82f49-176c-5ed1-bb49-ad3f5cbd8c74" +version = "0.1.2+0" + +[[deps.Xorg_libxcb_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "XSLT_jll", "Xorg_libXau_jll", "Xorg_libXdmcp_jll", "Xorg_libpthread_stubs_jll"] +git-tree-sha1 = "1a74296303b6524a0472a8cb12d3d87a78eb3612" +uuid = "c7cfdc94-dc32-55de-ac96-5a1b8d977c5b" +version = "1.17.0+3" + +[[deps.Xorg_libxkbfile_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"] +git-tree-sha1 = "dbc53e4cf7701c6c7047c51e17d6e64df55dca94" +uuid = "cc61e674-0454-545c-8b26-ed2c68acab7a" +version = "1.1.2+1" + +[[deps.Xorg_xcb_util_cursor_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_jll", "Xorg_xcb_util_renderutil_jll"] +git-tree-sha1 = "04341cb870f29dcd5e39055f895c39d016e18ccd" +uuid = "e920d4aa-a673-5f3a-b3d7-f755a4d47c43" +version = "0.1.4+0" + +[[deps.Xorg_xcb_util_image_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"] +git-tree-sha1 = "0fab0a40349ba1cba2c1da699243396ff8e94b97" +uuid = "12413925-8142-5f55-bb0e-6d7ca50bb09b" +version = "0.4.0+1" + +[[deps.Xorg_xcb_util_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libxcb_jll"] +git-tree-sha1 = "e7fd7b2881fa2eaa72717420894d3938177862d1" +uuid = "2def613f-5ad1-5310-b15b-b15d46f528f5" +version = "0.4.0+1" + +[[deps.Xorg_xcb_util_keysyms_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"] +git-tree-sha1 = "d1151e2c45a544f32441a567d1690e701ec89b00" +uuid = "975044d2-76e6-5fbe-bf08-97ce7c6574c7" +version = "0.4.0+1" + +[[deps.Xorg_xcb_util_renderutil_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"] +git-tree-sha1 = "dfd7a8f38d4613b6a575253b3174dd991ca6183e" +uuid = "0d47668e-0667-5a69-a72c-f761630bfb7e" +version = "0.3.9+1" + +[[deps.Xorg_xcb_util_wm_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"] +git-tree-sha1 = "e78d10aab01a4a154142c5006ed44fd9e8e31b67" +uuid = "c22f9ab0-d5fe-5066-847c-f4bb1cd4e361" +version = "0.4.1+1" + +[[deps.Xorg_xkbcomp_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxkbfile_jll"] +git-tree-sha1 = "ab2221d309eda71020cdda67a973aa582aa85d69" +uuid = "35661453-b289-5fab-8a00-3d9160c6a3a4" +version = "1.4.6+1" + +[[deps.Xorg_xkeyboard_config_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_xkbcomp_jll"] +git-tree-sha1 = "691634e5453ad362044e2ad653e79f3ee3bb98c3" +uuid = "33bec58e-1273-512f-9401-5d533626f822" +version = "2.39.0+0" + +[[deps.Xorg_xtrans_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "6dba04dbfb72ae3ebe5418ba33d087ba8aa8cb00" +uuid = "c5fb5394-a638-5e4d-96e5-b29de1b5cf10" +version = "1.5.1+0" + +[[deps.Zlib_jll]] +deps = ["Libdl"] +uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.13+1" + +[[deps.Zstd_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "622cf78670d067c738667aaa96c553430b65e269" +uuid = "3161d3a3-bdf6-5164-811a-617609db77b4" +version = "1.5.7+0" + +[[deps.eudev_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "gperf_jll"] +git-tree-sha1 = "431b678a28ebb559d224c0b6b6d01afce87c51ba" +uuid = "35ca27e7-8b34-5b7f-bca9-bdc33f59eb06" +version = "3.2.9+0" + +[[deps.fzf_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "6e50f145003024df4f5cb96c7fce79466741d601" +uuid = "214eeab7-80f7-51ab-84ad-2988db7cef09" +version = "0.56.3+0" + +[[deps.gperf_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "0ba42241cb6809f1a278d0bcb976e0483c3f1f2d" +uuid = "1a1c6b14-54f6-533d-8383-74cd7377aa70" +version = "3.1.1+1" + +[[deps.libaom_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "522c1df09d05a71785765d19c9524661234738e9" +uuid = "a4ae2306-e953-59d6-aa16-d00cac43593b" +version = "3.11.0+0" + +[[deps.libass_jll]] +deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl", "Zlib_jll"] +git-tree-sha1 = "e17c115d55c5fbb7e52ebedb427a0dca79d4484e" +uuid = "0ac62f75-1d6f-5e53-bd7c-93b484bb37c0" +version = "0.15.2+0" + +[[deps.libblastrampoline_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" +version = "5.11.0+0" + +[[deps.libdecor_jll]] +deps = ["Artifacts", "Dbus_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "Pango_jll", "Wayland_jll", "xkbcommon_jll"] +git-tree-sha1 = "9bf7903af251d2050b467f76bdbe57ce541f7f4f" +uuid = "1183f4f0-6f2a-5f1a-908b-139f9cdfea6f" +version = "0.2.2+0" + +[[deps.libevdev_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "141fe65dc3efabb0b1d5ba74e91f6ad26f84cc22" +uuid = "2db6ffa8-e38f-5e21-84af-90c45d0032cc" +version = "1.11.0+0" + +[[deps.libfdk_aac_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "8a22cf860a7d27e4f3498a0fe0811a7957badb38" +uuid = "f638f0a6-7fb0-5443-88ba-1cc74229b280" +version = "2.0.3+0" + +[[deps.libinput_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "eudev_jll", "libevdev_jll", "mtdev_jll"] +git-tree-sha1 = "ad50e5b90f222cfe78aa3d5183a20a12de1322ce" +uuid = "36db933b-70db-51c0-b978-0f229ee0e533" +version = "1.18.0+0" + +[[deps.libpng_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"] +git-tree-sha1 = "d7b5bbf1efbafb5eca466700949625e07533aff2" +uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f" +version = "1.6.45+1" + +[[deps.libvorbis_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Ogg_jll", "Pkg"] +git-tree-sha1 = "490376214c4721cdaca654041f635213c6165cb3" +uuid = "f27f6e37-5d2b-51aa-960f-b287f2bc3b7a" +version = "1.3.7+2" + +[[deps.mtdev_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "814e154bdb7be91d78b6802843f76b6ece642f11" +uuid = "009596ad-96f7-51b1-9f1b-5ce2d5e8a71e" +version = "1.1.6+0" + +[[deps.nghttp2_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" +version = "1.59.0+0" + +[[deps.p7zip_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" +version = "17.4.0+2" + +[[deps.x264_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "4fea590b89e6ec504593146bf8b988b2c00922b2" +uuid = "1270edf5-f2f9-52d2-97e9-ab00b5d0237a" +version = "2021.5.5+0" + +[[deps.x265_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "ee567a171cce03570d77ad3a43e90218e38937a9" +uuid = "dfaa095f-4041-5dcd-9319-2fabd8486b76" +version = "3.5.0+0" + +[[deps.xkbcommon_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Wayland_jll", "Wayland_protocols_jll", "Xorg_libxcb_jll", "Xorg_xkeyboard_config_jll"] +git-tree-sha1 = "63406453ed9b33a0df95d570816d5366c92b7809" +uuid = "d8fb68d0-12a3-5cfd-a85a-d49703b185fd" +version = "1.4.1+2" diff --git a/PauliStrings.jl-1.5/docs/Project.toml b/PauliStrings.jl-1.5/docs/Project.toml new file mode 100644 index 0000000000000000000000000000000000000000..825e44ed6b95a79e7e7dc989a206e968b5db241a --- /dev/null +++ b/PauliStrings.jl-1.5/docs/Project.toml @@ -0,0 +1,6 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" + +[compat] +Documenter = "1.6" diff --git a/PauliStrings.jl-1.5/docs/make.jl b/PauliStrings.jl-1.5/docs/make.jl new file mode 100644 index 0000000000000000000000000000000000000000..77f69bdacd4c64fb972e0598337942f267e7481c --- /dev/null +++ b/PauliStrings.jl-1.5/docs/make.jl @@ -0,0 +1,29 @@ +using Documenter, PauliStrings +using PauliStrings.Circuits + +makedocs( + format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true", + assets = [ + "assets/custom.css", + "assets/favicon.ico", + ], + analytics = "G-L0F0JFQ15V" + ), + sitename = "PauliStrings.jl", + authors = "Nicolas Loizeau", + pages = [ + "Getting started" => "index.md", + "Tutorials" => ["Constructing operators"=>"constructing.md", + "Lanczos"=>"lanczos.md", + "Time evolution"=>"evolution.md", + "Translation symmetry"=>"translation.md", + "Circuits"=>"circuits.md"], + "Documentation" => "documentation.md", + "Index" => "docstrings.md"] +) + +deploydocs( + repo = "github.com/nicolasloizeau/PauliStrings.jl.git", + devbranch = "main", + branch = "gh-pages", +) diff --git a/PauliStrings.jl-1.5/docs/src/assets/custom.css b/PauliStrings.jl-1.5/docs/src/assets/custom.css new file mode 100755 index 0000000000000000000000000000000000000000..824d9b68cc39d8ebf51a2e743d626b50cbe00556 --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/assets/custom.css @@ -0,0 +1,3 @@ +div#documenter .docs-sidebar .docs-logo > img { + max-height: 8em; +} diff --git a/PauliStrings.jl-1.5/docs/src/assets/favicon.ico b/PauliStrings.jl-1.5/docs/src/assets/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..9810373b46a44ffd13e0acd83e0ea7f5d290a0b9 Binary files /dev/null and b/PauliStrings.jl-1.5/docs/src/assets/favicon.ico differ diff --git a/PauliStrings.jl-1.5/docs/src/assets/favicon.png b/PauliStrings.jl-1.5/docs/src/assets/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..08388f0dd0ee12f78d0c8deca535463ce5dc3cef Binary files /dev/null and b/PauliStrings.jl-1.5/docs/src/assets/favicon.png differ diff --git a/PauliStrings.jl-1.5/docs/src/assets/logo.svg b/PauliStrings.jl-1.5/docs/src/assets/logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..9b06b7a348a90c2139aa667c2a2e1d2fd3f26205 --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/assets/logo.svg @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.2" width="254mm" height="254mm" viewBox="0 0 25400 25400" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xml:space="preserve"> + <defs class="ClipPathGroup"> + <clipPath id="presentation_clip_path" clipPathUnits="userSpaceOnUse"> + <rect x="0" y="0" width="25400" height="25400"/> + </clipPath> + <clipPath id="presentation_clip_path_shrink" clipPathUnits="userSpaceOnUse"> + <rect x="25" y="25" width="25350" height="25350"/> + </clipPath> + </defs> + <defs class="TextShapeIndex"> + <g ooo:slide="id1" ooo:id-list="id3 id4 id5"/> + </defs> + <defs class="EmbeddedBulletChars"> + <g id="bullet-char-template-57356" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 580,1141 L 1163,571 580,0 -4,571 580,1141 Z"/> + </g> + <g id="bullet-char-template-57354" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 8,1128 L 1137,1128 1137,0 8,0 8,1128 Z"/> + </g> + <g id="bullet-char-template-10146" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 174,0 L 602,739 174,1481 1456,739 174,0 Z M 1358,739 L 309,1346 659,739 1358,739 Z"/> + </g> + <g id="bullet-char-template-10132" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 2015,739 L 1276,0 717,0 1260,543 174,543 174,936 1260,936 717,1481 1274,1481 2015,739 Z"/> + </g> + <g id="bullet-char-template-10007" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 0,-2 C -7,14 -16,27 -25,37 L 356,567 C 262,823 215,952 215,954 215,979 228,992 255,992 264,992 276,990 289,987 310,991 331,999 354,1012 L 381,999 492,748 772,1049 836,1024 860,1049 C 881,1039 901,1025 922,1006 886,937 835,863 770,784 769,783 710,716 594,584 L 774,223 C 774,196 753,168 711,139 L 727,119 C 717,90 699,76 672,76 641,76 570,178 457,381 L 164,-76 C 142,-110 111,-127 72,-127 30,-127 9,-110 8,-76 1,-67 -2,-52 -2,-32 -2,-23 -1,-13 0,-2 Z"/> + </g> + <g id="bullet-char-template-10004" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 285,-33 C 182,-33 111,30 74,156 52,228 41,333 41,471 41,549 55,616 82,672 116,743 169,778 240,778 293,778 328,747 346,684 L 369,508 C 377,444 397,411 428,410 L 1163,1116 C 1174,1127 1196,1133 1229,1133 1271,1133 1292,1118 1292,1087 L 1292,965 C 1292,929 1282,901 1262,881 L 442,47 C 390,-6 338,-33 285,-33 Z"/> + </g> + <g id="bullet-char-template-9679" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 813,0 C 632,0 489,54 383,161 276,268 223,411 223,592 223,773 276,916 383,1023 489,1130 632,1184 813,1184 992,1184 1136,1130 1245,1023 1353,916 1407,772 1407,592 1407,412 1353,268 1245,161 1136,54 992,0 813,0 Z"/> + </g> + <g id="bullet-char-template-8226" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 346,457 C 273,457 209,483 155,535 101,586 74,649 74,723 74,796 101,859 155,911 209,963 273,989 346,989 419,989 480,963 531,910 582,859 608,796 608,723 608,648 583,586 532,535 482,483 420,457 346,457 Z"/> + </g> + <g id="bullet-char-template-8211" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M -4,459 L 1135,459 1135,606 -4,606 -4,459 Z"/> + </g> + <g id="bullet-char-template-61548" transform="scale(0.00048828125,-0.00048828125)"> + <path d="M 173,740 C 173,903 231,1043 346,1159 462,1274 601,1332 765,1332 928,1332 1067,1274 1183,1159 1299,1043 1357,903 1357,740 1357,577 1299,437 1183,322 1067,206 928,148 765,148 601,148 462,206 346,322 231,437 173,577 173,740 Z"/> + </g> + </defs> + <g> + <g id="id2" class="Master_Slide"> + <g id="bg-id2" class="Background"/> + <g id="bo-id2" class="BackgroundObjects"/> + </g> + </g> + <g class="SlideGroup"> + <g> + <g id="container-id1"> + <g id="id1" class="Slide" clip-path="url(#presentation_clip_path)"> + <g class="Page"> + <g class="Graphic"> + <g id="id3"> + <rect class="BoundingBox" stroke="none" fill="none" x="-1863" y="-1905" width="30243" height="28607"/> + <defs> + <clipPath id="clip_path_1" clipPathUnits="userSpaceOnUse"> + <path d="M -1863,-1905 L 28379,-1905 28379,26701 -1863,26701 -1863,-1905 Z"/> + </clipPath> + </defs> + <g clip-path="url(#clip_path_1)"> + <path fill="rgb(10,10,10)" stroke="none" d="M 8458,23109 C 8009,23227 7567,23367 7110,23454 6900,23494 6702,23555 6512,23421 6308,23275 6165,23060 6141,22810 6130,22692 6171,22391 6011,22353 5837,22312 5808,22589 5803,22698 5788,23089 5933,23341 6175,23633 L 4940,23746 C 4917,23498 5098,23126 5025,22911 4983,22789 4845,22879 4793,22940 4676,23077 4637,23275 4603,23446 L 4565,23446 C 4533,22798 4960,22357 5133,21762 5359,20983 5273,20181 5089,19404 5443,19288 5713,18628 5990,18362 6865,17522 7992,17149 9169,17478 9524,17577 9725,17821 10030,18002 10120,18055 10327,18129 10361,17968 10396,17799 10136,17629 10030,17537 9601,17165 9010,17054 8458,17009 7095,16899 5396,17880 5052,19255 L 5014,19255 C 4656,17721 3305,16575 2398,15362 1446,14088 947,12646 935,11058 1546,11867 2305,12906 3255,13334 3743,13554 4410,13596 4940,13596 5567,13596 6205,13459 6811,13308 6940,13276 7385,13203 7310,12985 7225,12740 6361,13048 6175,13090 5134,13325 3868,13381 2956,12742 707,11169 -132,7549 1531,5257 2540,3865 4193,3095 5800,2589 6550,2353 7553,2251 8308,2492 9327,2816 10186,3664 10888,4434 11360,4952 11758,5575 12088,6193 12160,6326 12300,6769 12516,6694 12707,6627 12562,6341 12509,6230 12320,5836 11846,5350 11797,4920 11749,4498 12104,3996 12299,3648 12681,2964 12977,2241 13262,1514 13359,1266 13645,442 13423,216 13314,107 13137,194 13024,248 12697,406 12365,572 12014,670 10938,970 9775,1000 8720,1330 8257,1475 7906,1769 7485,1981 7107,2171 6551,2107 6137,2169 5420,2277 4730,2480 4079,2807 3353,3172 2616,3586 2020,4142 731,5344 278,7057 338,8775 359,9389 698,9926 763,10521 789,10759 683,11009 658,11245 618,11611 637,12079 695,12443 896,13707 1557,14893 2341,15886 3455,17299 4830,18651 4934,20564 4986,21521 4371,22154 4215,23035 4164,23326 4201,23861 4532,23963 5051,24123 5651,23958 6175,23879 7486,23681 8894,23364 9992,22570 10739,22031 11074,21119 10361,20425 10245,20312 10110,20179 9956,20119 9827,20068 9649,20125 9725,20292 9869,20611 10284,20740 10408,21088 10681,21857 9547,22642 8950,22824 8541,22948 8235,22292 8160,21987 8134,21880 8144,21637 8020,21588 7785,21494 7795,21950 7818,22061 7907,22485 8156,22813 8458,23109 L 8458,23109 Z M 11303,2937 C 11128,3128 10856,3519 10554,3475 10254,3431 9963,3064 9731,2889 9237,2517 8630,2157 8009,2076 8367,1572 9105,1571 9656,1500 10746,1358 11813,1133 12837,728 12544,1539 11877,2310 11303,2937 Z M 11490,4546 L 10816,3760 C 11862,3101 12488,1871 13099,841 12890,2148 12015,3352 11490,4546 Z M 7747,3168 C 8302,3436 8860,3726 9317,4147 10007,4783 10489,5732 10798,6604 10870,6806 10938,7600 11164,7659 11386,7717 11295,7297 11276,7203 11184,6732 11102,6215 10887,5781 10182,4360 8810,2728 7073,2712 7146,2999 7506,3052 7747,3168 Z M 5225,3976 C 5324,4097 5587,4058 5726,4076 6177,4133 6632,4184 7073,4301 7962,4537 8724,5269 9241,6006 9605,6525 9776,7107 9879,7727 9899,7847 9925,8230 10129,8180 10333,8131 10228,7745 10198,7615 10070,7053 9941,6421 9628,5931 8754,4561 7202,3598 5539,3778 5468,3785 5100,3825 5225,3976 Z M 3533,7765 C 3377,7014 3437,6380 3555,5631 3878,5652 4210,5433 4528,5362 5284,5191 6226,5126 6961,5435 7236,5551 7488,5705 7746,5851 7825,5896 7952,5963 8032,5882 8275,5636 7548,5325 7410,5256 6719,4911 5778,4781 5014,4940 4520,5043 3716,5226 3391,5650 3222,5870 3177,6187 3141,6455 3032,7241 3070,8452 3891,8850 3999,8465 3611,8140 3533,7765 Z M 4015,6184 C 3853,6393 3887,6952 3919,7203 3947,7419 4050,8274 4430,8151 4622,8089 4400,7755 4363,7652 4240,7314 4062,6548 4423,6310 4861,6021 5947,6142 6437,6260 6629,6306 7056,6579 7235,6494 7602,6321 6881,6020 6774,5985 6220,5807 5441,5747 4865,5841 4616,5882 4178,5974 4015,6184 Z M 10966,11994 C 11161,12351 11592,12731 11005,12928 10918,12957 10830,12981 10741,13004 L 10704,12144 C 10415,12258 10598,12803 10629,13042 L 9843,13117 10142,12144 10030,12106 9693,13117 8683,12959 7859,12331 C 7905,12788 8353,13216 8795,13321 8995,13368 9389,13325 9515,13523 9632,13707 9514,14066 9529,14277 9579,14999 9535,16312 10180,16784 9978,15996 9795,15282 9714,14464 9689,14214 9611,13731 9810,13533 9996,13347 10460,13381 10704,13379 L 11115,16186 11228,16186 C 11214,15253 10996,14255 10816,13341 L 11602,13079 12571,14988 13024,16335 C 13024,15535 12724,14793 12359,14090 12216,13816 11786,13338 11808,13023 11824,12785 12249,12514 12391,12331 12557,12115 12669,11459 12892,11358 13049,11287 13257,11412 13399,11474 13670,11594 13967,11716 14215,11880 14333,11959 14408,12115 14540,12167 14805,12273 15085,12189 15308,12437 15487,12636 15404,12984 15458,13229 15551,13647 15764,14028 16043,14350 16323,14672 16721,14970 17104,15158 17233,15221 17499,15304 17597,15144 17709,14961 17006,14682 16880,14593 16174,14096 15758,13464 15757,12593 L 17291,13453 C 16989,12996 16420,12819 15987,12517 15865,12432 15797,12210 15662,12166 15558,12133 15443,12195 15335,12176 15172,12147 15015,12049 14858,11994 15102,11668 15507,11166 15906,11037 16344,10896 17016,11058 17479,11058 17536,11291 17685,11488 17890,11617 17977,11672 18160,11726 18176,11568 18196,11372 17918,11169 17815,11021 L 18115,10983 17815,10908 C 17856,10801 18075,10431 17927,10346 17693,10213 17509,10786 17350,10864 17032,11021 16368,10861 16019,10834 L 16019,10796 C 17547,9998 18769,8597 20667,8860 21415,8964 22692,9550 22251,10531 21951,11200 21075,11411 20473,11679 19896,11936 19462,12331 19073,12817 18193,13915 17916,15699 16543,16383 16235,16537 15914,16329 15683,16130 15179,15694 14829,15041 14705,14389 14677,14244 14733,13546 14545,13527 14415,13514 14355,13694 14336,13791 14282,14064 14349,14384 14412,14651 14604,15467 15197,16504 16056,16747 14961,17947 13397,18161 11864,18379 11384,18448 10889,18470 10404,18468 10284,18468 9953,18402 9870,18512 9732,18694 10256,18729 10329,18731 10215,19167 10074,20170 10554,20415 10595,20020 10372,18926 10896,18788 11178,18714 11499,18788 11789,18752 12602,18651 13507,18496 14297,18280 15158,18045 15717,17516 16393,16973 16740,16695 17160,16437 17456,16104 18378,15068 18694,13579 19658,12598 20477,11765 21953,11827 22544,10759 22984,9963 22339,8977 21558,8734 20719,8472 19825,8420 18976,8708 18497,8871 18075,9174 17591,9337 L 17591,9299 17778,9224 17778,9187 C 17073,9191 16638,8484 16056,8142 15156,7613 13908,7352 12875,7540 12844,7363 12827,7110 12689,6979 12329,6639 11981,7348 11936,7615 11825,8266 11922,8997 12195,9599 12361,9964 12712,10663 12421,11046 11915,11714 11350,11116 10978,10683 10925,10621 10584,10162 10483,10350 10395,10514 10725,10867 10814,10983 11045,11283 11322,11582 11639,11793 11747,11864 12004,11935 12021,12086 12045,12303 11674,12551 11527,12667 11429,12395 11281,12045 10966,11994 Z M 12500,8551 L 12463,8551 C 12489,8195 12516,7868 12276,7578 L 12575,7241 12500,8551 Z M 16842,9262 C 15375,9282 14138,9707 12800,10272 L 12509,9381 12743,8775 12912,7727 C 14316,8018 15900,7941 16842,9262 Z M 12313,8850 L 12276,8700 12463,8663 12313,8850 Z M 9543,8805 C 8861,8910 8294,9501 7672,9748 6973,10025 6242,9911 5614,10392 5355,10590 4598,11316 4799,11705 4955,12009 5283,11297 5345,11208 5865,10458 6449,10466 7223,10203 7431,10132 7772,9844 7991,9889 8139,9919 8224,10161 8321,10262 8557,10508 8933,10705 9281,10662 9716,10610 10922,9971 10292,9449 10280,9098 9913,8748 9543,8805 Z M 19978,9370 C 20107,9544 20234,9662 20215,9898 20204,10038 20100,10191 20134,10331 20157,10426 20257,10464 20342,10423 20666,10265 20608,9594 20451,9345 20370,9218 20140,9046 19982,9142 19890,9197 19927,9302 19978,9370 Z M 9506,9187 C 10134,9175 10171,10001 9618,10197 L 9506,9187 Z M 21501,9823 C 21441,10069 21200,10195 21129,10424 21093,10539 21166,10654 21294,10622 21619,10542 21822,10083 21840,9786 21845,9697 21837,9302 21656,9380 21511,9443 21531,9698 21501,9823 Z M 16168,10310 L 15495,10766 14439,10732 12875,10684 C 12901,10200 13472,10140 13848,9984 14644,9651 15455,9467 16318,9448 16679,9440 16960,9381 17291,9561 L 16168,10310 Z M 9207,10272 C 8979,10318 8351,10120 8440,9797 8495,9599 8812,9508 8982,9449 8884,9793 8936,10028 9207,10272 Z M 15382,10946 C 15186,11174 14812,11672 14514,11744 14333,11789 14115,11631 13960,11554 13609,11379 13258,11221 12875,11133 L 12912,10796 C 13659,11005 14604,10903 15382,10946 Z M 5875,14818 C 5131,15038 4245,15103 3480,14978 3221,14936 2985,14853 2732,14788 2663,14770 2493,14735 2493,14855 2493,15243 3339,15297 3592,15333 4527,15467 5644,15337 6512,14953 6706,14867 7150,14757 7270,14577 7392,14394 7112,14360 6998,14380 6606,14450 6257,14705 5875,14818 Z M 6848,20002 C 7247,19760 7814,19665 8271,19595 8704,19528 8931,19606 9317,19784 9387,19816 9522,19859 9554,19753 9695,19291 8695,19244 8458,19269 7528,19369 6631,19647 6010,20378 5795,20630 5561,20929 5576,21276 6000,20832 6309,20331 6848,20002 Z"/> + </g> + </g> + </g> + <g class="com.sun.star.drawing.CustomShape"> + <g id="id4"> + <rect class="BoundingBox" stroke="none" fill="none" x="12103" y="10351" width="13082" height="13081"/> + <path fill="rgb(203,60,51)" stroke="none" d="M 25184,16891 C 25184,18039 24882,19167 24308,20161 23734,21155 22908,21981 21914,22555 20919,23129 19792,23431 18644,23431 17495,23431 16368,23129 15373,22555 14379,21981 13553,21155 12979,20161 12405,19167 12103,18039 12103,16891 12103,15743 12405,14615 12979,13621 13553,12627 14379,11801 15373,11227 16368,10653 17495,10351 18643,10351 19792,10351 20919,10653 21914,11227 22908,11801 23734,12627 24308,13621 24882,14615 25184,15743 25184,16891 L 25184,16891 Z"/> + </g> + </g> + <g class="Graphic"> + <g id="id5"> + <rect class="BoundingBox" stroke="none" fill="none" x="2583" y="7411" width="28533" height="20277"/> + <defs> + <clipPath id="clip_path_2" clipPathUnits="userSpaceOnUse"> + <path d="M 2583,11094 L 28783,7412 31115,24005 4915,27687 2583,11094 Z"/> + </clipPath> + </defs> + <g clip-path="url(#clip_path_2)"> + <path fill="rgb(0,0,0)" stroke="none" d="M 16192,24596 C 15592,24535 13999,24081 13232,23751 11302,22921 9208,23286 6148,24988 5741,25215 6288,24667 6796,24340 8926,22968 11728,22626 13517,23520 13631,23577 13796,23642 13885,23666 13973,23690 14286,23786 14580,23881 16278,24426 17118,24397 18633,23744 19511,23365 20938,22953 20955,23074 20969,23175 20998,23161 19657,23690 17642,24485 16933,24671 16192,24596 Z M 16476,13336 C 16542,12182 16976,10582 17181,10737 17214,10762 17171,10984 17051,11403 16687,12683 16656,14068 16947,16115 17171,17699 17742,19919 18203,21004 18363,21380 19098,22989 19168,23115 19240,23244 19054,23185 18907,23033 17689,21768 16308,16257 16476,13336 Z M 19992,21597 C 19988,21571 19825,21189 19630,20747 18972,19260 18779,18668 18293,16635 17778,14487 17827,11385 18387,10642 18568,10402 18621,10549 18483,10914 18232,11584 18162,13952 18354,15318 18538,16626 19154,18868 19624,19938 19765,20260 20001,20802 20148,21142 20295,21483 20517,21921 20640,22116 20763,22311 20857,22487 20847,22507 20813,22586 20703,22557 20534,22425 20380,22306 20013,21744 19992,21597 Z M 22181,21878 C 22040,21659 21840,21352 21735,21196 21507,20854 20421,18335 20156,17530 19786,16409 19421,14295 19440,13376 19468,11946 19729,10760 19955,11032 19975,11057 19970,11094 19943,11116 19917,11138 19870,11327 19839,11537 19425,14308 20207,17605 22184,21427 22635,22300 22633,22580 22181,21878 Z M 16736,22732 C 15977,22256 14952,18647 14918,16334 14881,13821 15231,11558 15666,11497 15744,11486 15818,11607 15763,11654 15497,11881 15262,13714 15224,15869 15186,17988 15922,21024 16792,22334 17059,22736 17034,22918 16736,22732 Z M 22763,20885 C 22989,20823 23624,20427 23996,20116 24406,19773 24579,19822 24254,20189 23713,20802 22722,21381 22501,21214 22363,21110 22481,20962 22763,20885 Z M 14284,20666 C 14207,20396 14054,19877 13944,19514 13390,17690 13315,16024 13686,13764 13794,13110 13828,12999 13923,12986 14013,12973 14011,13085 13896,14251 13676,16474 13795,18116 14274,19490 14314,19606 14432,20010 14536,20386 14664,20849 14795,21213 14940,21511 15206,22060 15200,22227 14920,22016 14720,21865 14478,21353 14284,20666 Z M 22423,19920 C 23027,19642 24049,18899 24502,18407 24824,18059 24868,18206 24559,18593 23884,19438 22462,20394 22140,20217 22015,20148 22084,20076 22423,19920 Z M 13319,20432 C 13235,20336 13220,20295 12868,19199 12467,17953 12276,16084 12466,15268 12580,14775 12762,14840 12713,15356 12612,16426 12841,18057 13289,19451 13587,20379 13599,20751 13319,20432 L 13319,20432 Z M 22550,18036 C 23573,17295 24302,16655 24665,16178 24806,15993 24933,15963 24953,16109 25013,16533 22293,18861 21952,18678 21815,18604 21921,18491 22550,18036 Z M 21198,17300 C 21630,17055 22014,16761 22553,16261 22855,15981 23194,15669 23306,15568 23646,15260 24234,14660 24301,14552 24415,14368 24572,14428 24513,14635 24466,14795 23783,15556 23216,16079 22924,16348 22593,16658 22481,16767 21947,17289 21112,17735 20948,17586 20867,17512 20911,17462 21198,17300 Z M 20811,16077 C 20751,16023 20750,16006 20801,15966 20834,15940 21086,15745 21362,15533 21637,15321 22046,14958 22270,14726 22494,14494 22892,14090 23154,13829 23416,13567 23645,13313 23663,13263 23700,13164 23835,13082 23910,13115 24104,13200 22588,14965 21720,15665 21228,16062 20938,16193 20811,16077 L 20811,16077 Z M 20214,14654 C 20145,14591 20140,14594 20523,14440 20967,14263 21628,13695 22043,13135 22365,12700 22839,12177 22922,12165 23097,12141 23000,12325 22464,13037 21584,14208 20948,14722 20394,14711 20328,14710 20248,14684 20214,14654 Z M 20091,13555 C 19956,13454 20036,13318 20345,13121 20738,12872 21152,12464 21558,11926 21878,11502 22025,11402 22052,11591 22114,12036 20381,13773 20091,13555 Z M 20097,12132 C 20039,12028 21030,11187 21245,11157 21476,11124 21319,11339 20761,11820 20349,12175 20168,12260 20097,12132 Z"/> + </g> + </g> + </g> + </g> + </g> + </g> + </g> + </g> +</svg> \ No newline at end of file diff --git a/PauliStrings.jl-1.5/docs/src/circuits.md b/PauliStrings.jl-1.5/docs/src/circuits.md new file mode 100644 index 0000000000000000000000000000000000000000..84a2f9e830b56de7224082e027d69f61e4b0a49f --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/circuits.md @@ -0,0 +1,78 @@ +# Quantum circuits + +The module `Circuits` provides a way to construct and simulate circuits. +Initialise an empty circuit with `Circuit(n)` where `n` is the number of qubits. +Then, add gates to the circuit with `push!(circuit, gate, qubits...)` where `gate` is a string representing the gate and `qubits` are the qubits the gate acts on. +For example, a CNOT gate with control qubit 1 and target qubit 2 is added to the circuit `c` with `push!(c, "CNOT", 1, 2)`. +Depolarizing noise can be added to the circuit with `push!(c, "Noise")`. The noise amplitude can be set with `c.noise_amplitude=p`. + + +Lets construct a CCX gate (Toffoli gate) out of CNOT and single qubit gates. + + +```@example circuits +using PauliStrings +using PauliStrings.Circuits + +function noisy_toffoli() + c = Circuit(3) + push!(c, "H", 3) + push!(c, "CNOT", 2, 3); push!(c, "Noise") + push!(c, "Tdg", 3) + push!(c, "CNOT", 1, 3); push!(c, "Noise") + push!(c, "T", 3) + push!(c, "CNOT", 2, 3); push!(c, "Noise") + push!(c, "Tdg", 3) + push!(c, "CNOT", 1, 3); push!(c, "Noise") + push!(c, "T", 2) + push!(c, "T", 3) + push!(c, "CNOT", 1, 2); push!(c, "Noise") + push!(c, "H", 3) + push!(c, "T", 1) + push!(c, "Tdg", 2) + push!(c, "CNOT", 1, 2); push!(c, "Noise") + return c +end +``` + +We can plot the circuit using [QuantumCircuitDraw.jl](https://github.com/nicolasloizeau/QuantumCircuitDraw.jl): +```julia +using QuantumCircuitDraw +c = noisy_toffoli() +paulistrings_plot(c) +``` + + + + +The circuit can be compiled to a unitary matrix with `compile(c)`. +Before compiling, set `c.noise_amplitude` to the desired noise amplitude and `c.max_strings` to the number of strings to keep at each step. +Compile will multiply the gates in the circuit from left to right, apply the noise using [`add_noise`](@ref) and trim the operator at each step using [`trim`](@ref). + +Lets check our Toffoli gate against the built-in `CCX` gate in `Circuits`: + +```@example circuits +using PauliStrings.Circuits +c = noisy_toffoli() +c.noise_amplitude = 0 +U1 = compile(c) +U2 = CCXGate(3,1,2,3) +println(opnorm(U1-U2)) +``` + +We can also compute expectation values of states in the computational basis with `expect(c, state_out)` and `expect(c, state_in, state_out)` . +Let's compute the expectation values of the output states of the Toffoli gate when the input state is $|111\rangle$: +```@example circuits +in_state = "111" +out_states = ["000", "001", "010", "011", "100", "101", "110", "111"] +p = [expect(c, in_state, out_state) for out_state in out_states] +using Plots +bar(out_states, p, legend=false, xlabel="out state", ylabel="<out|U|in>") +``` + +Same as above but seting the noise amplitude to 0.05: +```@example circuits +c.noise_amplitude = 0.05 +p = [expect(c, in_state, out_state) for out_state in out_states] +bar(out_states, p, legend=false, xlabel="out state", ylabel="<out|U|in>") +``` diff --git a/PauliStrings.jl-1.5/docs/src/constructing.md b/PauliStrings.jl-1.5/docs/src/constructing.md new file mode 100644 index 0000000000000000000000000000000000000000..ec533eb6bb41337ea40047c7f176e87d1d9412ce --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/constructing.md @@ -0,0 +1,84 @@ +# Constructing operators + +Start by importing PauliStrings: +```@example constructing +using PauliStrings +import PauliStrings as ps +``` + +To construct an operator we first need to declare an empty operator of $N$ qubits: +```julia +H = Operator(N) +``` +For the moment, `PauliStrings.jl` supports a maximum of 64 qubits. + +We can add a term of the form $J X_i$ by doing +```julia +H += J, "X", i +``` + +and a term of the form $J X_iX_j$ by doing +```julia +H += J, "X", i, "X", j +``` + +Similarly, we add a term of the form $J X_iX_jX_k$ by doing +```julia +H += J, "X", i, "X", j, "X", k +``` +etc. + +## 1D transverse Ising model +Let's construct the Hamiltonian of a [1D transverse Ising model](https://en.wikipedia.org/wiki/Transverse-field_Ising_model) +$$H=-J(\sum_{<i,j>}Z_i Z_j +g \sum_i X_i)$$ + +```@example constructing +function ising1D(N, J, g) + H = Operator(N) + for j in 1:(N - 1) + H += "Z",j,"Z",j+1 + end + H += "Z",1,"Z",N # periodic boundary condition + for j in 1:N + H += g,"X",j + end + return -J*H +end +``` +Note that the first qubit starts at index 1, following Julia's 1-based index. + +Operators can be printed in strings format with the `println` function: +```@example constructing +println(ising1D(3, 1, 0.5)) +``` + + +## 2D transverse Ising model + + +Here we construct a 2D Ising model on a square lattice of L*L sites, with no periodic boundary conditions. + + +```julia +function ising2D(L, J, g) + H = ps.Operator(L*L) + for x in 1:L-1 + for y in 1:L + # convert x,y to qubit index + i = L*(y-1)+x + j = L*(y-1)+(x+1) + # horizontal interaction terms + H += ('Z',i,'Z',j) + # convert x,y to qubit index + i = L*(x-1)+y + j = L*x+y + # vertical interaction terms + H += ('Z',i,'Z',j) + end + end + for j in 1:L*L + H += g,"X",j + end + return -J*H +end +``` diff --git a/PauliStrings.jl-1.5/docs/src/docstrings.md b/PauliStrings.jl-1.5/docs/src/docstrings.md new file mode 100644 index 0000000000000000000000000000000000000000..ff46fb11da6f60c143e59047766d7112da9b1812 --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/docstrings.md @@ -0,0 +1,6 @@ + + +# Index + +```@index +``` diff --git a/PauliStrings.jl-1.5/docs/src/documentation.md b/PauliStrings.jl-1.5/docs/src/documentation.md new file mode 100644 index 0000000000000000000000000000000000000000..f78068f6172880b581d8c3491b084158ff254261 --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/documentation.md @@ -0,0 +1,298 @@ + +# Documentation + + +## Basics +```@docs +Operator(N::Int) +``` + +```@docs +Operator(o::OperatorTS1D) +``` + +```@docs +OperatorTS1D(o::Operator; full=true) +``` + +```@docs +Base.length(o::Operator) +``` + +```@docs +eye(N::Int) +``` + +```@docs +Base.:+(o::Operator, args::Tuple{Number, Vararg{Any}}) +Base.:+(o::Operator, args::Tuple{Vararg{Any}}) +Base.:+(o::Operator, term::Tuple{Number, String}) +Base.:+(o::Operator, term::String) +``` + + +## Operations + + +```@docs +Base.:+(o1::Operator, o2::Operator) +Base.:+(o::Operator, a::Number) +Base.:+(a::Number, o::Operator) +``` + + +```@docs +Base.:*(o1::Operator, o2::Operator) +Base.:*(o::Operator, a::Number) +Base.:*(a::Number, o::Operator) +``` + +```@docs +Base.:-(o::Operator) +Base.:-(o1::Operator, o2::Operator) +Base.:-(o::Operator, a::Real) +Base.:-(a::Real, o::Operator) +``` + +```@docs +com(o1::Operator, o2::Operator; epsilon::Real=0, maxlength::Int=1000) +``` + +```@docs +diag(o::Operator) +``` + +```@docs +trace(o::Operator) +``` + +```@docs +opnorm(o::Operator) +``` + +```@docs +dagger(o::Operator) +``` + +```@docs +ptrace(o::Operator, keep::Vector{Int}) +``` + + +## Power and moments +```@docs +Base.:^(o::Operator, k::Int) +``` +```@docs +oppow(o::Operator, k::Int) +``` +```@docs +trace_product(o1::Operator, o2::Operator; scale=0) +``` +```@docs +trace_product(A::Operator, k::Int, B::Operator, l::Int; scale=0) +``` +```@docs +trace_product(A::Operator, k::Int; scale=0) +``` +```@docs +moments(H::Operator, kmax::Int; start=1, scale=0) +``` + + + + +## Random operators +```@docs +rand_local1(N::Int) +``` +```@docs +rand_local2(N::Int) +``` +```@docs +rand_local1_TS1D(N::Int) +``` +```@docs +rand_local2_TS1D(N::Int) +``` + + + +## Truncation and noise +```@docs +truncate(o::Operator, N::Int; keepnorm::Bool = false) +``` +```@docs +trim(o::Operator, N::Int; keepnorm::Bool = false, keep::Operator=Operator(N)) +``` +```@docs +prune(o::Operator, alpha::Real; keepnorm::Bool = false) +``` +```@docs +cutoff(o::Operator, epsilon::Real; keepnorm::Bool = false) +``` +```@docs +add_noise(o::Operator, g::Real) +``` +```@docs +k_local_part(o::Operator, k::Int; atmost=false) +``` + +## Algorithms +```@docs +lanczos(H::Operator, O::Operator, steps::Int, nterms::Int; keepnorm=true, maxlength=1000, returnOn=false) +lanczos(H::OperatorTS1D, O::OperatorTS1D, steps::Int, nterms::Int; keepnorm=true, maxlength=1000, returnOn=false) +``` + +```@docs +rk4(H::Operator, O::Operator, dt::Real; hbar::Real=1, heisenberg=false, M=2^20, keep::Operator=Operator(N)) +``` + +```@docs +rk4(H::Function, O::Operator, dt::Real, t::Real; hbar::Real=1, heisenberg=false) +``` + +```@docs +equivalence_class(A1::Union{Operator64,Operator128}, H::Union{Operator64,Operator128}) +``` + +```@docs +frustration_graph(o::Operator) +``` +## Construction +```@docs +all_strings(N::Int) +``` +```@docs +all_k_local(N::Int, k::Int) +``` +```@docs +all_x(N::Int) +``` +```@docs +all_y(N::Int) +``` +```@docs +all_z(N::Int) +``` +```@docs +set_coefs(o::Operator, coefs::Vector{T}) where T <: Number +``` + +## Circuits + +```@docs +Circuit(N::Int; max_strings=2^30, noise_amplitude=0) +``` +```@docs +push!(c::Circuit, gate::String, sites::Real...) +``` +```@docs +pushfirst!(c::Circuit, gate::String, sites::Real...) +``` + +```@docs +XGate(N::Int, i::Int) +``` +```@docs +PhaseGate(N::Int, i::Int, theta::Real) +``` + +```@docs +CXGate(N::Int, i::Int, j::Int) +``` + +```@docs +SwapGate(N::Int, i::Int, j::Int) +``` +```@docs +CSXGate(N::Int, i::Int, j::Int) +``` + +```@docs +CCXGate(N::Int, i::Int, j::Int, k::Int) +``` +```@docs +MCZGate(N::Int, sites::Int...) +``` +```@docs +grover_diffusion(N::Int, sites::Int...) +``` +```@docs +compile(c::Circuit) +``` +```@docs +expect(c::Circuit, state::String) +``` +```@docs +expect(c::Circuit, in_state::String, out_state::String) +``` + + + + +## Tools +```@docs +compress(o::Operator) +``` +```@docs +op_to_strings(o::Operator) +``` +```@docs +get_coefs(o::Operator) +``` +```@docs +op_to_dense(o::Operator) +``` +```@docs +shift_left(O::Operator) +``` +```@docs +xcount(v::Unsigned, w::Unsigned) +``` +```@docs +ycount(v::Unsigned, w::Unsigned) +``` +```@docs +zcount(v::Unsigned, w::Unsigned) +``` + +```@docs +is_ts(o::Operator) +``` + +```@docs +get_coef(o::Operator, v::Unsigned, w::Unsigned) +``` + +```@docs +get_pauli(o::Operator, i::Int) +``` + + +## Low level + +```@docs +com(v1::Unsigned, w1::Unsigned, v2::Unsigned, w2::Unsigned) +``` + +```@docs +string_to_vw(pauli::String) +``` + +```@docs +vw_to_string(v::Unsigned, w::Unsigned, N::Int) +``` + +```@docs +vw_in_o(v::Unsigned, w::Unsigned, o::Operator) +``` + +```@docs +Base.push!(o::Operator, c::Number, v::Unsigned, w::Unsigned) +``` + +## Index + +```@index +``` diff --git a/PauliStrings.jl-1.5/docs/src/evolution.md b/PauliStrings.jl-1.5/docs/src/evolution.md new file mode 100644 index 0000000000000000000000000000000000000000..4bc391dd339d0d1406b7a11c792b54b7bdb1024d --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/evolution.md @@ -0,0 +1,97 @@ +# Time evolution + + +Time evolution with PauliStrings.jl is done in the Heisenberg picture because pure states are rank 1 density matrices and low rank density matrices cannot be efficiently encoded as a sum of Pauli strings ([Loizeau 2024](https://www.pnas.org/doi/abs/10.1073/pnas.2308006120)). + + +The advantage of working with Pauli strings is that noisy systems can be efficiently simulated in this representation ([Schuster 2024](https://arxiv.org/abs/2407.12768)). Depolarizing noise makes long strings decay, so we can make the simulations tractable by combining noise with truncation. + + +Let's time evolve operator $Z_1$ in the chaotic spin chain +$$H = \sum_i X_iX_{i+1}-1.05 Z_i +h_X X_i.$$ +First we construct the Hamiltonian: + +```julia +using PauliStrings +import PauliStrings as ps +``` + +```julia +function chaotic_chain(N::Int) + H = ps.Operator(N) + # XX interactions + for j in 1:(N - 1) + H += "X",j,"X",j+1 + end + H += "X",1,"X",N # close the chain + # fields + for j in 1:N + H += -1.05,"Z",j + H += 0.5,"X",j + end + return H +end +``` +We initialize a Hamiltonian and the $Z_1$ operator on a 32 spins system. + +```julia +N = 32 # system size +H = chaotic_chain(N) # Hamiltonian +O = ps.Operator(N) # operator to time evolve +O += "Z", 1 # Z on site 1 +``` + +Now we write a function that will time evolve operator O under Hamiltonian H and return some observable. Here we are interested in recording the correlator +$$ +S(t) = \frac{1}{2^N} \text{Tr} [Z_1(t)Z_1(0)] +$$. +We will time evolve O by integrating Von Neuman's equation $i \frac{dO}{dt}=-[H,O]$ with Runge-Kutta ([`rk4`](@ref)). At each time step we do 3 things : + +1. Perform a [`rk4`](@ref) step +2. [`add_noise`](@ref) that makes long strings decay +3. [`trim`](@ref) O by keeping only M strings with the largest weight + +```julia +# heisenberg evolution of the operator O using rk4 +# return tr(O(0)*O(t))/tr(O(t)^2) +# M is the number of strings to keep at each step +# noise is the amplitude of depolarizing noise +using ProgressBars + +function evolve(H, O, M, times, noise) + echo = [] + O0 = deepcopy(O) + dt = times[2]-times[1] + for t in ProgressBar(times) + push!(echo, ps.trace(O*ps.dagger(O0))/ps.trace(O0*O0)) + # perform one step of rk4, keep only M strings, do not discard O0 + O = ps.rk4(H, O, dt; heisenberg=true, M=M, keep=O0) + # add depolarizing oise + O = ps.add_noise(O, noise*dt) + # keep the M strings with the largest weight. Do not discard O0 + O = ps.trim(O, M; keep=O0) + end + return real.(echo) +end +``` + +Now we can actually time evolve O for different trim values and plot the result: + +```julia +# time evolve O for different trim values +times = range(0, stop=5, step=0.05) +noise = 0.01 +for trim in (10,12,14) + S = evolve(H, O, 2^trim, times, noise) + loglog(times, S) #plot S(t) +end + +legend() +title("N=$N") +xlabel("t") +ylabel(L"tr$(Z_1(0)*Z_1(t))$") +savefig("time_evolve_example.png") +show() +``` + + diff --git a/PauliStrings.jl-1.5/docs/src/gif.gif b/PauliStrings.jl-1.5/docs/src/gif.gif new file mode 100644 index 0000000000000000000000000000000000000000..1e2626a9b82f4edb2672b736d22079a9d2d17407 Binary files /dev/null and b/PauliStrings.jl-1.5/docs/src/gif.gif differ diff --git a/PauliStrings.jl-1.5/docs/src/index.md b/PauliStrings.jl-1.5/docs/src/index.md new file mode 100644 index 0000000000000000000000000000000000000000..1b719d0940cf1a2f4ce65421aa49d1e0b43db3fc --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/index.md @@ -0,0 +1,209 @@ + +[](https://github.com/nicolasloizeau/PauliStrings.jl/actions/workflows/CI.yml?query=branch%3Amain) +[](https://nicolasloizeau.github.io/PauliStrings.jl/dev) +[](https://nicolasloizeau.github.io/PauliStrings.jl/stable) +[](https://arxiv.org/abs/2410.09654) + + +# Getting started +PauliStrings.jl is a Julia package for many-body quantum mechanics with Pauli string represented as binary integers. +It is particularly adapted for running Lanczos, time evolving noisy systems and simulating spin systems on arbitrary graphs. +Paper : [https://arxiv.org/abs/2410.09654](https://arxiv.org/abs/2410.09654) + + + + + +## [Documentation](https://nicolasloizeau.github.io/PauliStrings.jl/dev/) + + +## Installation +You can install the package using Julia's package manager +```julia +using Pkg; Pkg.add(PauliStrings) +``` +Or +```julia +] add PauliStrings +``` + +## Initializing an operator + +Import the library and initialize a operator of 4 qubits +```julia +using PauliStrings +import PauliStrings as ps +H = ps.Operator(4) +``` + + +Add a Pauli string to the operator +```julia +H += "XYZ1" +H += "1YZY" +``` +``` +julia> H +(1.0 - 0.0im) XYZ1 +(1.0 - 0.0im) 1YZY +``` + +Add a Pauli string with a coefficient +```julia +H += -1.2, "XXXZ" # coefficient can be complex +``` + +Add a 2-qubit string coupling qubits i and j with X and Y: +```julia +H += 2, "X", i, "Y", j # with a coefficient=2 +H += "X", i, "Y", j # with a coefficient=1 +``` + +Add a 1-qubit string: +```julia +H += 2, "Z", i # with a coefficient=2 +H += "Z", i # with a coefficient=1 +H += "S+", i +``` + +Supported sites operators are `X`, `Y`, `Z`, `Sx`$=X/2$, `Sy`$=Y/2$, `Sz`$=Z/2$, `S+`$=(X+iY)/2$, `S-`$=(X-iY)/2$. + +## Basic Algebra +The Operator type supports the +,-,* operators with other Operators and Numbers: +```julia +H3 = H1*H2 +H3 = H1+H2 +H3 = H1-H2 +H3 = H1+2 # adding a scalar is equivalent to adding the unit times the scalar +H = 5*H # multiply operator by a scalar +``` +Trace : `ps.trace(H)` + +Frobenius norm : `ps.opnorm(H)` + +Conjugate transpose : `ps.dagger(H)` + +Number of terms: `length(H)` + +Commutator: `ps.com(H1, H2)`. This is much faster than `H1*H2-H2*H1` + + +## Print and export +`print` shows a list of terms with coefficients e.g: +```julia +julia> println(H) +(10.0 - 0.0im) 1ZZ +(5.0 - 0.0im) 1Z1 +(15.0 + 0.0im) XYZ +(5.0 + 0.0im) 1YY +``` + +Export a list of strings with coefficients: +```julia +coefs, strings = ps.op_to_strings(H) +``` + +## Truncate, Cutoff, Trim, Noise +`ps.truncate(H,M)` removes Pauli strings longer than M (returns a new Operator) +`ps.cutoff(H,c)` removes Pauli strings with coefficient smaller than c in absolute value (returns a new Operator) +`ps.trim(H,N)` keeps the first N trings with higest weight (returns a new Operator) +`ps.prune(H,alpha)` keeps terms with probability 1-exp(-alpha*abs(c)) (returns a new Operator) + +`ps.add_noise(H,g)` adds depolarizing noise that make each strings decay like $e^{gw}$ where $w$ is the length of the string. This is useful when used with `trim` to keep the number of strings manageable during time evolution. + + +## Time evolution + +`ps.rk4(H, O, dt; hbar=1, heisenberg=false)` performs a step of Runge Kutta and returns the new updated O(t+dt) + +H can be an Operator, or a function that takes a time and return an Operator. In case H is a function, a time also needs to be passed to `rk4(H, O, dt, t)`. O is an Observable or a density matrix to time evolve. +If evolving an observable in the Heisenberg picture, set `heisenberg=true`. + +An example is in `time_evolve_example.jl`. +The following will time evolve O in the Heisenberg picture. At each step, we add depolarizing noise and trim the operator to keep the number of strings manageable +```julia +function evolve(H, O, M, times, noise) + dt = times[2]-times[1] + for t in times + O = ps.rk4(H, O, dt; heisenberg=true, M=M) # perform one step of rk4, keep only M strings + O = ps.add_noise(O, noise*dt) # add depolarizing noise + O = ps.trim(O, M) # keep the M strings with the largest weight + end + return O +end +``` + +Time evolution of the spin correlation function $\textup{Tr}(Z_1(0)Z_1(t))$ in the chaotic spin chain. +Check time_evolve_example.jl to reproduce the plot. + + +## Lanczos +Compute lanczos coefficients +```julia +bs = ps.lanczos(H, O, steps, nterms) +``` +`H` : Hamiltonian + +`O` : starting operator + +`nterms` : maximum number of terms in the operator. Used by trim at every step + +Results for X in XX from https://journals.aps.org/prx/pdf/10.1103/PhysRevX.9.041017 : + + + + +## Circuits +The module `Circuits` provides an easy way to construct and simulate circuits. +Construct a Toffoli gate out elementary gates: + + +```julia +using PauliStrings +using PauliStrings.Circuits + +function noisy_toffoli() + c = Circuit(3) + push!(c, "H", 3) + push!(c, "CNOT", 2, 3); push!(c, "Noise") + push!(c, "Tdg", 3) + push!(c, "CNOT", 1, 3); push!(c, "Noise") + push!(c, "T", 3) + push!(c, "CNOT", 2, 3); push!(c, "Noise") + push!(c, "Tdg", 3) + push!(c, "CNOT", 1, 3); push!(c, "Noise") + push!(c, "T", 2) + push!(c, "T", 3) + push!(c, "CNOT", 1, 2); push!(c, "Noise") + push!(c, "H", 3) + push!(c, "T", 1) + push!(c, "Tdg", 2) + push!(c, "CNOT", 1, 2); push!(c, "Noise") + return c +end +``` + + +Compute the expectation value $<110|U|111>$: +```julia +c = noisy_toffoli() +expect(c, "111", "110") +``` + + + +## Contact +For questions and suggestions : `nicolas.loizeau@nbi.ku.dk` + +## Citation +``` +@misc{loizeau2024, + title={Quantum many-body simulations with PauliStrings.jl}, + author={Nicolas Loizeau and J. Clayton Peacock and Dries Sels}, + year={2024}, + eprint={2410.09654}, + archivePrefix={arXiv}, + primaryClass={quant-ph}, + url={https://arxiv.org/abs/2410.09654}, +} +``` diff --git a/PauliStrings.jl-1.5/docs/src/lanczos.md b/PauliStrings.jl-1.5/docs/src/lanczos.md new file mode 100644 index 0000000000000000000000000000000000000000..aa39fbcee11bad9cd1d036debaf54f16df1dc160 --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/lanczos.md @@ -0,0 +1,70 @@ +# Lanczos + + +Here we show how to use PauliStrings.jl to run the recursion method and compute [`lanczos`](@ref) coefficients. +We will focus on reproducing the X in XX results from figure 2 of [Parker 2019](https://journals.aps.org/prx/abstract/10.1103/PhysRevX.9.041017). + +Start by importing PauliStrings: +```julia +using PauliStrings +import PauliStrings as ps +``` + +Define the XX Hamiltonian $$H = \sum_i X_iX_{i+1}+Y_iY_{i+1}$$ on a 1D chain with periodic boundary conditions +```julia +function XX(N) + H = ps.Operator(N) + for j in 1:(N - 1) + H += "X",j,"X",j+1 + H += "Z",j,"Z",j+1 + end + H += "X",1,"X",N + H += "Z",1,"Z",N + return H +end +``` +and the X operator $$\sum_{i=1}^N X_i$$ +```julia +function X(N) + H = ps.Operator(N) + for j in 1:N + H += "X",j + end + return H +end +``` + +Initialize a Hamiltonian and an operator: +```julia +N = 50 # system size +H = XX(N) # Hamiltonian +O = X(N) # operator +``` + +Compute and plot the [`lanczos`](@ref) coefficients for different truncations. +For each level of truncation, we keep only $$2^p$$ terms with the highest weight at each step of the [`lanczos`](@ref) algorithm. +```julia +ioff() # pyplot +# nterms is the max pauli string length +for p in (14,16,18,20) + @time bs = ps.lanczos(H, O, 20, 2^p; keepnorm=true) + plot(bs, label="trim: 2^$p") +end +legend() +ylabel(L"$b_n$") +xlabel(L"$n$") +title("X in XX, N=$N spins") +savefig("lanczos_example.png") +show() +``` + + + +# Tacking advantage of translation symmetry +If the problem is 1D and has translation symmetry, we can take advantage of the symmetry to save time and memory. Just pass $$O$$ and $$H$$ as [`OperatorTS1D`](@ref) to [`lanczos`](@ref). For example : +```julia +Hts = OperatorTS1D(H) +Ots = OperatorTS1D(O) +bs = ps.lanczos(Hts, Ots, 20, 2^p; keepnorm=true) +``` +Check the [translation symmetry tutorial](@ref translation). diff --git a/PauliStrings.jl-1.5/docs/src/lanczos_example.png b/PauliStrings.jl-1.5/docs/src/lanczos_example.png new file mode 100644 index 0000000000000000000000000000000000000000..17bd9ee986dec772ec7849108050eccb31e6333a Binary files /dev/null and b/PauliStrings.jl-1.5/docs/src/lanczos_example.png differ diff --git a/PauliStrings.jl-1.5/docs/src/time_evolve_example.png b/PauliStrings.jl-1.5/docs/src/time_evolve_example.png new file mode 100644 index 0000000000000000000000000000000000000000..b319fc93fc23100b76545a7b0dc54f6f5f2d4541 Binary files /dev/null and b/PauliStrings.jl-1.5/docs/src/time_evolve_example.png differ diff --git a/PauliStrings.jl-1.5/docs/src/toffoli.png b/PauliStrings.jl-1.5/docs/src/toffoli.png new file mode 100644 index 0000000000000000000000000000000000000000..61015d8428eb6d411cf9b6559c75f99e99c011c2 Binary files /dev/null and b/PauliStrings.jl-1.5/docs/src/toffoli.png differ diff --git a/PauliStrings.jl-1.5/docs/src/translation.md b/PauliStrings.jl-1.5/docs/src/translation.md new file mode 100644 index 0000000000000000000000000000000000000000..b0c785cb476ca89dea573b8ee0ad7ef2f202e552 --- /dev/null +++ b/PauliStrings.jl-1.5/docs/src/translation.md @@ -0,0 +1,119 @@ +# [Translation symmetry in 1D with [`OperatorTS1D`](@ref)] (@id translation) + +Here we will show how to take advantage of translation symmetry to save time and memory in PauliStrings.jl. +Consider the 1D Ising Hamiltonian with periodic boundary conditions +$$H=-J(\sum_{i}Z_i Z_{i+1} +g \sum_i X_i)$$. +There is no need to actually store all the Pauli strings in this case. H is fully specified by just $$-JZ_1Z_2$$ and $$-Jg X_1$$ and the fact that it's translation symmetric. + +In general, a 1D translation symmetric operator can be written as $$\sum_i T_i H_0$$ where $$T_i$$ is the i-sites translation operator and $$H_0$$ is the local operator that generates $$H$$. $$H_0$$ can be chosen so that it's only composed of Pauli strings that start on the first site. + +In PauliStrings.jl, the structure [`OperatorTS1D`](@ref) lets you manipulate operators in this format. If your problem is 1D translation symmetric, [`OperatorTS1D`](@ref) will be much faster than [`Operator`](@ref). + +## Construction + +There are two ways of constructing an [`OperatorTS1D`](@ref) : +### From the full translation symmetric $$H$$ +First we construct the full [`Operator`](@ref): +```julia +function ising1D(N, J, g) + H = Operator(N) + for j in 1:(N - 1) + H += "Z",j,"Z",j+1 + end + H += "Z",1,"Z",N #periodic boundary condition + for j in 1:N + H += g,"X",j + end + return -J*H +end +H = ising1D(N, J, g) +``` +then convert it to an [`OperatorTS1D`](@ref) +```julia +Hts = OperatorTS1D(H) +``` +If `H` is not translation symmetric, then an error will be returned +### From the local generator $$H_0$$ +Construct $$H_0$$ using [`Operator`](@ref): +```julia +H = Operator(N) +H += -J, "Z",1,"Z",2 +H += -J*g,"X",1 +``` +then convert it to an [`OperatorTS1D`](@ref) +```julia +Hts = OperatorTS1D(H, full=false) +``` +Note that here, we need to set `full=false` in order to specify that we are not passing the full Hamiltonian but just its local generator. + +## Manipulation +All the operations defined on [`Operator`](@ref) are also defined on [`OperatorTS1D`](@ref). + +Construct a simple translation invariant operator on 4 sites: +```julia +H = Operator(N) +H += "X", 1 +H += "Z", 1,"Z", 2 + +Hts = OperatorTS1D(H, full=false) + +println(H) +println(Operator(Hts)) +``` +``` +(1.0 + 0.0im) X111 +(1.0 + 0.0im) ZZ11 + +(1.0 + 0.0im) 1ZZ1 +(1.0 + 0.0im) 1X11 +(1.0 + 0.0im) X111 +(1.0 + 0.0im) Z11Z +(1.0 + 0.0im) 11ZZ +(1.0 + 0.0im) 11X1 +(1.0 + 0.0im) ZZ11 +(1.0 + 0.0im) 111X +``` +Note that only the local generator is printed when printing [`OperatorTS1D`](@ref), not the full operator. + +Multiplication: +``` +julia> Hts*Hts +(1.0 + 0.0im) X1X1 +(2.0 + 0.0im) Z1Z1 +(2.0 + 0.0im) 1111 +(1.0 + 0.0im) ZZZZ +(2.0 + 0.0im) XZZ1 +(2.0 + 0.0im) XX11 +(2.0 + 0.0im) ZZX1 +``` + +Addition: +``` +julia> Hts+Hts +(2.0 + 0.0im) X111 +(2.0 + 0.0im) ZZ11 +``` + +etc. + +## Example: computing $$Tr(H^k)$$ +As an example of performance gains of using [`OperatorTS1D`](@ref) instead of [`Operator`](@ref) we compute the 8th moment ($$Tr(H^8)$$) of a 30 spin system. + +Using the function defined above we construct a Ising Hamiltonian and convert it to an [`OperatorTS1D`](@ref): +``` +N = 30 +k = 8 +H = ising1D(N, 1) +Hts = OperatorTS1D(H) +``` +then we compute the kth moment ([`trace_product`](@ref)) using both [`Operator`](@ref) and [`OperatorTS1D`](@ref) : +``` +julia> @time println(trace_product(H, k)) +1.1904927790006272e18 + 0.0im + 80.697013 seconds (28.91 k allocations: 111.213 MiB, 0.07% gc time, 0.04% compilation time) + +julia> @time println(trace_product(Hts, k)) +1.190492779000627e18 + 0.0im + 1.951678 seconds (37.09 k allocations: 36.165 MiB, 2.00% gc time, 2.01% compilation time) +``` +[`OperatorTS1D`](@ref) is 40 times faster in this case. diff --git a/PauliStrings.jl-1.5/examples/lanczos_example.jl b/PauliStrings.jl-1.5/examples/lanczos_example.jl new file mode 100644 index 0000000000000000000000000000000000000000..f9577e61068ed4c9f0575dc6a0e618b18442d3f2 --- /dev/null +++ b/PauliStrings.jl-1.5/examples/lanczos_example.jl @@ -0,0 +1,50 @@ + + +# lanczos example from : +# https://journals.aps.org/prx/abstract/10.1103/PhysRevX.9.041017 +# figure 2, "X in XX" + +using PauliStrings +import PauliStrings as ps +using PyPlot + +# XX hamiltonian: 1d chain with XX+YY interraction +function XX(N) + H = ps.Operator(N) + for j in 1:(N - 1) + H += "X",j,"X",j+1 + H += "Z",j,"Z",j+1 + end + return H +end + +# X local operator: X operator on each site +function X(N) + H = ps.Operator(N) + for j in 1:N + H += "X",j + end + return H +end + + +N = 50 # system size +H = XX(N) #hamiltonian +O = X(N) #operator + +ioff()#pyplot + +# nterms is the max pauli string length +for p in (14,16,18,20) + @time bs = ps.lanczos(H, O, 20, 2^p; keepnorm=true) + plot(bs, label="trim: 2^$p") +end + + + +legend() +ylabel(L"$b_n$") +xlabel(L"$n$") +title("X in XX, N=$N spins") +savefig("lanczos_example.png") +show() diff --git a/PauliStrings.jl-1.5/examples/lanczos_example.png b/PauliStrings.jl-1.5/examples/lanczos_example.png new file mode 100644 index 0000000000000000000000000000000000000000..17bd9ee986dec772ec7849108050eccb31e6333a Binary files /dev/null and b/PauliStrings.jl-1.5/examples/lanczos_example.png differ diff --git a/PauliStrings.jl-1.5/examples/time_evolve_example.jl b/PauliStrings.jl-1.5/examples/time_evolve_example.jl new file mode 100644 index 0000000000000000000000000000000000000000..498282a72d088248606721dbd62ea9e6308c687f --- /dev/null +++ b/PauliStrings.jl-1.5/examples/time_evolve_example.jl @@ -0,0 +1,70 @@ + +# example of time evolving Z_1 on a chaotic spin chain + + +using PauliStrings +import PauliStrings as ps +using PyPlot +using ProgressBars + + +# build a chaotic spin chain with periodic bc +function chaotic_chain(N::Int) + H = ps.Operator(N) + # XX interractions + for j in 1:(N - 1) + H += "X",j,"X",j+1 + end + H += "X",1,"X",N # close the chain + # fields + for j in 1:N + H += -1.05,"Z",j + H += 0.5,"X",j + end + return H +end + + +N = 32 # system size +H = chaotic_chain(N) #hamiltonian +O = ps.Operator(N) #operator to time evolve +O += "Z", 1 # Z on site 1 + +ioff() + + +# heisenberg evolution of the operator O using rk4 +# return tr(O(0)*O(t))/tr(O(t)^2) +# M is the number of strings to keep at each step +# noise is the amplitude of depolarizing noise +function evolve(H, O, M, times, noise) + echo = [] + O0 = deepcopy(O) + dt = times[2]-times[1] + for t in ProgressBar(times) + push!(echo, ps.trace(O*ps.dagger(O0))/ps.trace(O0*O0)) + #preform one step of rk4, keep only M strings, do not discard O0 + O = ps.rk4(H, O, dt; heisenberg=true, M=M, keep=O0) + #add depolarizingn oise + O = ps.add_noise(O, noise*dt) + # keep the M strings with the largest weight. Do not discard O0 + O = ps.trim(O, M; keep=O0) + end + return real.(echo) +end + +plt.cla() +# time evolve O for different trim values +times = range(0, stop=5, step=0.05) +noise = 0.01 +for trim in (10,12,14) + S = evolve(H, O, 2^trim, times, noise) + loglog(times, S) #plot S(t) +end + +legend() +title("N=$N") +xlabel("t") +ylabel(L"tr$(Z_1(0)*Z_1(t))$") +savefig("time_evolve_example.png") +show() diff --git a/PauliStrings.jl-1.5/examples/time_evolve_example.png b/PauliStrings.jl-1.5/examples/time_evolve_example.png new file mode 100644 index 0000000000000000000000000000000000000000..b319fc93fc23100b76545a7b0dc54f6f5f2d4541 Binary files /dev/null and b/PauliStrings.jl-1.5/examples/time_evolve_example.png differ diff --git a/PauliStrings.jl-1.5/gif.gif b/PauliStrings.jl-1.5/gif.gif new file mode 100644 index 0000000000000000000000000000000000000000..80410e5bbb355787e00e4f756c0a4d736208cba3 Binary files /dev/null and b/PauliStrings.jl-1.5/gif.gif differ diff --git a/PauliStrings.jl-1.5/lanczos_example.png b/PauliStrings.jl-1.5/lanczos_example.png new file mode 100644 index 0000000000000000000000000000000000000000..17bd9ee986dec772ec7849108050eccb31e6333a Binary files /dev/null and b/PauliStrings.jl-1.5/lanczos_example.png differ diff --git a/PauliStrings.jl-1.5/src/PauliStrings.jl b/PauliStrings.jl-1.5/src/PauliStrings.jl new file mode 100644 index 0000000000000000000000000000000000000000..d54fa0eee901dfa4524fb1a7ab0f2e2bfc6fa149 --- /dev/null +++ b/PauliStrings.jl-1.5/src/PauliStrings.jl @@ -0,0 +1,42 @@ +module PauliStrings + +export Operator, OperatorTS1D, Operator64, Operator128, OperatorTS1D64, OperatorTS1D128 +export trace, opnorm, eye, dagger, com, add, compress, ptrace, shift_left, shift, com +export diag, xcount, ycount, zcount +export truncate, trim, cutoff, prune, add_noise, k_local_part, participation +export rand_local1, rand_local2 +export lanczos, rk4, norm_lanczos, rotate_lower +export op_to_strings, vw_to_string, string_to_vw, tring_to_dense, op_to_dense, get_pauli, push!, vw_in_o +export get_coefs, get_coef +export trace_product, oppow, trace_product_pow, trace_exp, moments +export OperatorTS1D, resum, rand_local1_TS1D, rand_local2_TS1D, is_ts +export all_strings, set_coefs, all_z, all_x, all_y, all_k_local +export equivalence_class +export frustration_graph +export renyi_entropy +export Circuits + + +using Random +using LinearAlgebra +using ProgressBars +using Dictionaries + +rng = MersenneTwister(0) + +include("operator.jl") +include("operatorts1d.jl") +include("io.jl") +include("operations.jl") +include("lanczos.jl") +include("truncation.jl") +include("random.jl") +include("time_evolution.jl") +include("moments.jl") +include("construction.jl") +include("equivalence.jl") +include("graph.jl") +include("entropy.jl") +include("circuits.jl") + +end diff --git a/PauliStrings.jl-1.5/src/circuits.jl b/PauliStrings.jl-1.5/src/circuits.jl new file mode 100644 index 0000000000000000000000000000000000000000..b50bece149eeb36c91b60a2436a46cf5042bb719 --- /dev/null +++ b/PauliStrings.jl-1.5/src/circuits.jl @@ -0,0 +1,274 @@ + + +module Circuits +export CCXGate, TGate, TdgGate, HGate, SwapGate, PhaseGate, SXGate +export Sgate, SXGate +export CXGate, CYGate, CZGate, CNOTGate +export MCZGate +export CSXGate, CSXdgGate +export Circuit, compile, expect +export grover_diffusion +export XGate, YGate, ZGate +using PauliStrings + +single_gates = ["X", "Y", "Z", "H", "S", "T", "Tdg", "Phase"] +two_gates = ["CNOT", "Swap", "CX", "CY", "CZ", "CCX", "CSX", "CSXdg"] +other = ["CCX", "Noise", "MCZ"] + +allowed_gates = vcat(single_gates, two_gates, other) + + + +mutable struct Circuit + N::Int + gates::Vector{Tuple{String,Vector{Real}}} + max_strings::Int + noise_amplitude::Real +end + + +""" + Circuit(N::Int; max_strings=2^30, noise_amplitude=0) + +Creates an empty quantum circuit with `N` qubits. `max_strings` is the maximum number of strings to keep in the operator. `noise_amplitude` is the amplitude of the noise gate. +""" +Circuit(N::Int; max_strings=2^30, noise_amplitude=0) = Circuit(N, [], max_strings, noise_amplitude) + + + +""" + push!(c::Circuit, gate::String, sites::Real...) + +Adds a gate to the circuit `c`. The gate is specified by a string `gate` and a list of sites `sites`. +The gates have the same naming convention as in Qiskit. +Allowed gates are: "X", "Y", "Z", "H", "S", "T", "Tdg", "Phase", "CNOT", "Swap", "CX", "CY", "CZ", "CCX", "CSX", "CSXdg", "MCZ", "Noise". +""" +function Base.push!(c::Circuit, gate::String, sites::Real...) + @assert gate in allowed_gates "Unknown gate: $(gate)" + push!(c.gates, (gate, collect(sites))) +end + +""" + pushfirst!(c::Circuit, gate::String, sites::Real...) + +Adds a gate to the beginning of the circuit `c`. +""" +function Base.pushfirst!(c::Circuit, gate::String, sites::Real...) + @assert gate in allowed_gates "Unknown gate: $(gate)" + pushfirst!(c.gates, (gate, collect(sites))) +end + + + +function XYZGate(N::Int, i::Int, type::String) + O = Operator(N) + O += type, i + return O +end + + + +""" + XGate(N::Int, i::Int) + YGate(N::Int, i::Int) + ZGate(N::Int, i::Int) + HGate(N::Int, i::Int) + SGate(N::Int, i::Int) + TGate(N::Int, i::Int) + TdgGate(N::Int, i::Int) + SXGate(N::Int, i::Int) + +Creates a single qubit gate acting on qubit `i` of a `N` qubit system. +""" +XGate(N::Int, i::Int) = XYZGate(N, i, "X") +YGate(N::Int, i::Int) = XYZGate(N, i, "Y") +ZGate(N::Int, i::Int) = XYZGate(N, i, "Z") +HGate(N::Int, i::Int) = (XGate(N, i) + ZGate(N, i)) / sqrt(2) +SGate(N::Int, i::Int) = PhaseGate(N, i, pi / 2) +TGate(N::Int, i::Int) = PhaseGate(N, i, pi / 4) +TdgGate(N::Int, i::Int) = dagger(TGate(N::Int, i::Int)) +SXGate(N::Int, i::Int) = ((1-1im)*XGate(N, i) + (1+1im)*eye(N))/2 + +""" + PhaseGate(N::Int, i::Int, theta::Real) + +Creates a phase gate acting on qubit `i` of a `N` qubit system with phase `theta`. +""" +PhaseGate(N::Int, i::Int, theta::Real) = (eye(N) + ZGate(N, i)) / 2 + (eye(N) - ZGate(N, i)) / 2 * exp(1im * theta) + + +function CXYZGate(N::Int, i::Int, j::Int, type::String) + O = Operator(N) + O -= "Z", i, type, j + O += type, j + O += "Z", i + O += eye(N) + return O / 2 +end + + +""" + CXGate(N::Int, i::Int, j::Int) + CYGate(N::Int, i::Int, j::Int) + CZGate(N::Int, i::Int, j::Int) + CNOTGate(N::Int, i::Int, j::Int) + +Creates a two qubit gate with control qubit `i` and target qubit `j` of a `N` qubit system. +""" +CXGate(N::Int, i::Int, j::Int) = CXYZGate(N, i, j, "X") +CYGate(N::Int, i::Int, j::Int) = CXYZGate(N, i, j, "Y") +CZGate(N::Int, i::Int, j::Int) = CXYZGate(N, i, j, "Z") +CNOTGate(N::Int, i::Int, j::Int) = CXGate(N, i, j) + + +""" + SwapGate(N::Int, i::Int, j::Int) + +Creates a swap gate between qubits `i` and `j` of a `N` qubit system. +""" +function SwapGate(N::Int, i::Int, j::Int) + O = Operator(N) + O += "X", i, "X", j + O += "Y", i, "Y", j + O += "Z", i, "Z", j + O += eye(N) + return O / 2 +end + +""" + CSXGate(N::Int, i::Int, j::Int) + CSXdgGate(N::Int, i::Int, j::Int) + +Controlled sqrt X gate and its dagger +""" +function CSXGate(N::Int, i::Int, j::Int) + O = Operator(N) + O += -1+1im, "Z", i, "X", j + O += 1-1im, "Z", i + O += 1-1im, "X", j + O += eye(N)*(3+1im) + return O / 4 +end +CSXdgGate(N::Int, i::Int, j::Int) = dagger(CSXGate(N, i, j)) + +""" + CCXGate(N::Int, i::Int, j::Int, k::Int) + +Tofolli gate with control qubits `i` and `j` and target qubit `k` of a `N` qubit system. +""" +function CCXGate(N::Int, i::Int, j::Int, k::Int) + O = Operator(N) + O += "Z", i, "Z", j, "X", k + O -= "Z", i, "X", k + O -= "Z", j, "X", k + O += "X", k + O -= "Z", i, "Z", j + O += "Z", i + O += "Z", j + O += eye(N) * 3 + return O / 4 +end + +""" + MCZGate(N::Int, sites::Int...) + +Creates a multi-controlled Z gate acting on `sites` qubits of a `N` qubit system. +""" +function MCZGate(N::Int, sites::Int...) + sites = collect(sites) + U = eye(N)-2*all_z(N, sites)/2^N + for i in sites + U = XGate(N, i) * U * XGate(N, i) + end + return compress(U) +end + +MCZGate(N::Int) = MCZGate(N, 1:N...) + +""" + grover_diffusion(N::Int, sites::Int...) + +Creates the Grover diffusion operator acting on `sites` qubits of a `N` qubit system. +""" +function grover_diffusion(N::Int, sites::Int...) + println(sites) + U = MCZGate(N, sites...) + for i in sites + U = HGate(N, i) * U * HGate(N, i) + end + return compress(U) +end + + + +""" + compile(c::Circuit) + +Compiles the quantum circuit `c` into a unitary operator. Applies the gates in the order they were added. +Applies noise gates if present and trim the operator to `c.max_strings` strings at each step. +""" +function compile(c::Circuit) + U = eye(c.N) + for (gate, args) in c.gates # args is a vector of the form [site1, site2, ... other args] + if gate == "Noise" + U = add_noise(U, c.noise_amplitude) + elseif gate in allowed_gates + O = eval(Symbol(gate * "Gate"))(c.N, args...) + U = O * U + else + error("Unknown gate: $gate") + end + U = compress(U) + U = trim(U, c.max_strings) + end + return U +end + + +function trace_zpart(o::Operator) + s = 0 + for i in 1:length(o) + if xcount(o.v[i], o.w[i]) == 0 && ycount(o.v[i], o.w[i]) == 0 + s += o.coef[i] + end + end + return s*2^o.N +end + + +""" + expect(c::Circuit, state::String) + +Computes the expectation value of the state `state` after applying the circuit `c` to the state `|0>^N`. +""" +function expect(c::Circuit, state::String) + @assert c.N == length(state) "State length does not match circuit size" + c2 = deepcopy(c) + for i in 1:c.N + if state[i] == '1' + push!(c2, "X", i) + end + end + U = compile(c2) + return real(trace_zpart(U))/2^c.N +end + +""" + expect(c::Circuit, in_state::String, out_state::String) + +Computes the expectation value of the state `out_state` after applying the circuit `c` to the state `in_state`. +""" +function expect(c::Circuit, in_state::String, out_state::String) + @assert c.N == length(in_state) "State length does not match circuit size" + @assert c.N == length(out_state) "State length does not match circuit size" + c2 = deepcopy(c) + for i in 1:c.N + if in_state[i] == '1' + pushfirst!(c2, "X", i) + end + end + return expect(c2, out_state) +end + + +end diff --git a/PauliStrings.jl-1.5/src/construction.jl b/PauliStrings.jl-1.5/src/construction.jl new file mode 100644 index 0000000000000000000000000000000000000000..aa2418398e0928b7422c9151b6245b07771955c6 --- /dev/null +++ b/PauliStrings.jl-1.5/src/construction.jl @@ -0,0 +1,146 @@ + +""" + all_strings(N::Int) + +Return the sum of all the strings supported on N spins, with coeficients 1 +""" +function all_strings(N::Int) + O = Operator(N) + for i in 0:2^N-1 + for j in 0:2^N-1 + push!(O.v, i) + push!(O.w, j) + push!(O.coef, (1im)^ycount(i, j)) + end + end + return O +end + + +""" + all_k_local(N::Int, k::Int) + +Return the sum of all the k-local strings supported on N spins, with coeficients 1. +These are k-local only strings, not including strings shorter than k. + +``` +julia> all_k_local(2, 1) +(1.0 + 0.0im) X1 +(1.0 + 0.0im) 1X +(1.0 + 0.0im) Z1 +(1.0 - 0.0im) Y1 +(1.0 + 0.0im) 1Z +(1.0 - 0.0im) 1Y +``` +""" +function all_k_local(N::Int, k::Int) + O = Operator(N) + for i in 0:2^N-1 + for j in 0:2^N-1 + if pauli_weight(i, j) == k + push!(O.v, i) + push!(O.w, j) + push!(O.coef, (1im)^ycount(i, j)) + end + end + end + return O +end + + +""" + all_z(N::Int) + +Return the sum of all the strings supported on N spins with only z and with coeficients 1 + +``` +julia> all_z(2) +(1.0 + 0.0im) 11 +(1.0 + 0.0im) Z1 +(1.0 + 0.0im) 1Z +(1.0 + 0.0im) ZZ +``` +""" +function all_z(N::Int) + O = Operator(N) + for i in 0:2^N-1 + push!(O.v, i) + push!(O.w, 0) + push!(O.coef, 1) + end + return O +end + +function all_z(N::Int, bits::Vector{Int}) + O = Operator(N) + mask = sum(1 << (b-1) for b in bits) + for i in 0:2^N-1 + if (i & ~mask) == 0 + push!(O.v, i) + push!(O.w, 0) + push!(O.coef, 1) + end + end + return O +end + + + +""" + all_x(N::Int) + +Return the sum of all the strings supported on N spins with only x and with coeficients 1 + +``` +julia> all_x(2) +(1.0 + 0.0im) 11 +(1.0 + 0.0im) X1 +(1.0 + 0.0im) 1X +(1.0 + 0.0im) XX +``` +""" +function all_x(N::Int) + O = Operator(N) + for i in 0:2^N-1 + push!(O.v, 0) + push!(O.w, i) + push!(O.coef, 1) + end + return O +end + + +""" + all_y(N::Int) + +Return the sum of all the strings supported on N spins with only y and with coeficients 1 + +``` +julia> all_y(2) +(1.0 + 0.0im) 11 +(1.0 - 0.0im) Y1 +(1.0 - 0.0im) 1Y +(1.0 - 0.0im) YY +``` +""" +function all_y(N::Int) + O = Operator(N) + for i in 0:2^N-1 + push!(O.v, i) + push!(O.w, i) + push!(O.coef, (1im)^ycount(i, i)) + end + return O +end + +""" + Base.push!(o::Operator, c::Number, v::Unsigned, w::Unsigned) + +Add string c,(v,w) to operator o. Note that c is not the coeficient in front of the pauli string +but the coeficient in front of the real string. A factor (1im)^ycount(v,w) relate the two. +""" +function Base.push!(o::Operator, c::Number, v::Unsigned, w::Unsigned) + push!(o.v, v) + push!(o.w, w) + push!(o.coef, c) +end diff --git a/PauliStrings.jl-1.5/src/entropy.jl b/PauliStrings.jl-1.5/src/entropy.jl new file mode 100644 index 0000000000000000000000000000000000000000..6b59e1fc02b1f430192302864643188123fb708d --- /dev/null +++ b/PauliStrings.jl-1.5/src/entropy.jl @@ -0,0 +1,8 @@ + + +function renyi_entropy(o::Operator, alpha::Int) + o = compress(o) + c = get_coefs(o) + c /= sum(abs.(c)) + return log(sum(abs.(c) .^ alpha)) / (1 - alpha) +end diff --git a/PauliStrings.jl-1.5/src/equivalence.jl b/PauliStrings.jl-1.5/src/equivalence.jl new file mode 100644 index 0000000000000000000000000000000000000000..06bcd6c4be678bb866b39d54665050766f3ae8fc --- /dev/null +++ b/PauliStrings.jl-1.5/src/equivalence.jl @@ -0,0 +1,27 @@ + +""" + equivalence_class(A1::Union{Operator64,Operator128}, H::Union{Operator64,Operator128}) + +Equivalence class of A1 with respect to Hamiltonian H, as defined in [https://arxiv.org/abs/2406.13026](https://arxiv.org/abs/2406.13026) Algorithm 1. +The equivalence class is returned as an operator with coeficients 1 +Use [`get_pauli`](@ref) to access individual strings. +""" +function equivalence_class(A1::Union{Operator64,Operator128}, H::Union{Operator64,Operator128}) + length(A1) != 1 && error("A1 needs to be an operator with a single Pauli string") + A = deepcopy(A1) + D = 1 + counter = 0 + while counter < D + Vv = A.v[counter+1] + Vw = A.w[counter+1] + for i in 1:length(H) + a, Av, Aw = com(Vv, Vw, H.v[i], H.w[i]) + if a != 0 && !vw_in_o(Av, Aw, A) + push!(A, (1im)^ycount(Av, Aw), Av, Aw) + D += 1 + end + end + counter += 1 + end + return A +end diff --git a/PauliStrings.jl-1.5/src/graph.jl b/PauliStrings.jl-1.5/src/graph.jl new file mode 100644 index 0000000000000000000000000000000000000000..f2b271ac6f09753e2584e86cbafeb2b9818d7cad --- /dev/null +++ b/PauliStrings.jl-1.5/src/graph.jl @@ -0,0 +1,25 @@ + +using SparseArrays +""" + frustration_graph(o::Operator) + +Construct the frustration graph, or anticommutation graph of an operator o. Returns a sparse adjacency matrix. +Each vertex represents a pauli string of the operator, and two vertices are connected by an edge if the corresponding pauli strings anticommute. +The vertices are labeled by the index of the pauli string in the operator. Use [`get_pauli`](@ref) to access individual strings. +""" +function frustration_graph(o::Operator) + o = Operator(o) + n = length(o) + G = spzeros(Int, n, n) + for i in 1:n + for j in 1:n + v = o.v[i] ⊻ o.v[j] + w = o.w[i] ⊻ o.w[j] + k = (-1)^count_ones(o.v[i] & o.w[j]) - (-1)^count_ones(o.w[i] & o.v[j]) + if k != 0 + G[i, j] = 1 + end + end + end + return G +end diff --git a/PauliStrings.jl-1.5/src/io.jl b/PauliStrings.jl-1.5/src/io.jl new file mode 100644 index 0000000000000000000000000000000000000000..51d5d707b2c0e9773b881ff5133e8a45ceab431e --- /dev/null +++ b/PauliStrings.jl-1.5/src/io.jl @@ -0,0 +1,342 @@ + +import LinearAlgebra as la + + +"""number of Y in a pauli string""" +function getdelta(pauli::String) + return count(c -> c == 'Y', pauli) +end + +""" +get v and w from ref +https://journals.aps.org/pra/abstract/10.1103/PhysRevA.68.042318 +""" +function getvw(pauli::String) + v::UInt = 0 + w::UInt = 0 + for k in 1:length(pauli) + if pauli[k] == 'X' + w += 2^(k - 1) + end + if pauli[k] == 'Z' + v += 2^(k - 1) + end + if pauli[k] == 'Y' + w += 2^(k - 1) + v += 2^(k - 1) + end + end + return v, w +end + +""" + string_to_vw(pauli::String) + +Convert a string to two integers (v,w) +""" +string_to_vw(pauli::String) = getvw(pauli) + + +""" + set_coefs(o::Operator, coefs::Vector{T}) where T <: Number + +Sets the coefficient of `o` to `coefs`. Inplace. + +```julia +A = Operator(4) +A += 2, "1XXY" +A += 3, "11Z1" +``` +``` +julia> A +(3.0 + 0.0im) 11Z1 +(2.0 - 0.0im) 1XXY +julia> set_coefs(A, [5,6]) +julia> A +(5.0 + 0.0im) 11Z1 +(6.0 - 0.0im) 1XXY +``` +""" +function set_coefs(o::Operator, coefs::Vector{T}) where {T<:Number} + length(o) != length(coefs) && error("length(o) != length(coefs)") + for i in 1:length(o) + o.coef[i] = (1im)^ycount(o.v[i], o.w[i]) * coefs[i] + end +end + +""" +add a pauli string term to an operator +""" +function add_string(o::Operator, pauli::String, J::Number) + v, w = getvw(pauli) + c = (1im)^getdelta(pauli) * J + push!(o.v, v) + push!(o.w, w) + push!(o.coef, c) +end + +function string_from_inds(ind::Vector{Int}) + l::Vector{Char} = [] + paulis = ['1', 'X', 'Y', 'Z'] + for i in ind + push!(l, paulis[i+1]) + end + return join(l) +end + + +function Base.:+(o::Operator, term::Tuple{Number,Char,Int,Char,Int}) + o1 = deepcopy(o) + J, Pi, i, Pj, j = term + pauli = fill('1', o1.N) + pauli[i] = Pi + pauli[j] = Pj + pauli = join(pauli) + add_string(o1, pauli, J) + return compress(o1) +end + + +function Base.:+(o::Operator, term::Tuple{Number,Char,Int}) + o1 = deepcopy(o) + J, Pi, i = term + pauli = fill('1', o1.N) + pauli[i] = Pi + pauli = join(pauli) + add_string(o1, pauli, J) + return compress(o1) +end + +Base.:+(o::Operator, term::Tuple{Char,Int,Char,Int}) = o + (1, term...) +Base.:+(o::Operator, term::Tuple{Char,Int}) = o + (1, term...) + + +""" + Base.:+(o::Operator, args::Tuple{Number, Vararg{Any}}) + Base.:+(o::Operator, args::Tuple{Vararg{Any}}) + Base.:+(o::Operator, term::Tuple{Number, String}) + Base.:+(o::Operator, term::String) + +Main functions to contruct spin operators. +Identical signatures are available for `-`. + +# Examples +k-local terms can be added by adding a tuple to the operator. +The first element of the tuple is an optional coefficient. +The other element are couples (symbol,site) where symbol can be "X", "Y", "Z", "Sx", "Sy", "Sz", "S+", "S-" and site is an integer specifying the site on wich the symbol is acting. + +```julia +A = Operator(4) +A += 2, "X",1,"X",2 +A += 3, "Y",1,"X",2 +A += "X",3,"X",4 +A += 4,"Z",3 +A += 5.2,"X",1,"Y",2,"Z",3 +``` +``` +julia> A +(4.0 + 0.0im) 11Z1 +(3.0 - 0.0im) YX11 +(1.0 + 0.0im) 11XX +(2.0 + 0.0im) XX11 +(5.2 - 0.0im) XYZ1 +``` + +Full strings can also be added: +```julia +A = Operator(4) +A += 2, "1XXY" +A += 2im, "11Z1" +``` +``` +julia> A +(0.0 + 2.0im) 11Z1 +(2.0 - 0.0im) 1XXY +``` +""" +function Base.:+(o::Operator, args::Tuple{Number,Vararg{Any}}) + term = Operator(o.N) + 1 + c = args[1] + for i in 2:2:length(args) + o2 = Operator(o.N) + symbol = args[i]::String + site = args[i+1]::Int + if occursin(symbol, "XYZ") + o2 += only(symbol), site + elseif occursin(symbol, "SxSySz") + o2 += 0.5, only(uppercase(symbol[2])), site + elseif symbol == "S+" + o2 += 0.5, 'X', site + o2 += 0.5im, 'Y', site + elseif symbol == "S-" + o2 += 0.5, 'X', site + o2 += -0.5im, 'Y', site + else + error("Allowed operators: X,Y,Z,Sx,Sy,Sz,S-,S+") + end + term *= o2 + end + return compress(o + c * term) +end +Base.:+(o::Operator, args::Tuple{Vararg{Any}}) = o + (1, args...) +Base.:-(o::Operator, args::Tuple{Number,Vararg{Any}}) = o + (-args[1], args[2:end]...) +Base.:-(o::Operator, args::Tuple{Vararg{Any}}) = o + (-1, args...) + + + +function Base.:+(o::Operator, term::Tuple{Number,String}) + o1 = deepcopy(o) + c, pauli = term + if o1.N != length(pauli) + error("The string needs to be of the same size as the operator") + end + add_string(o1, pauli, c) + return compress(o1) +end + +Base.:+(o::Operator, term::String) = o + (1, term) +Base.:-(o::Operator, term::String) = o + (-1, term) +Base.:-(o::Operator, term::Tuple{Number,String}) = o + (-term[1], term[2]) + +Base.:+(o::Operator, term::Tuple{Number,Vector{Int}}) = o + (term[1], string_from_inds(term[2])) +Base.:-(o::Operator, term::Tuple{Number,Vector{Int}}) = o - (term[1], string_from_inds(term[2])) + +Base.:+(o::Operator, term::Vector{Int}) = o + (1, string_from_inds(term)) +Base.:-(o::Operator, term::Vector{Int}) = o - (1, string_from_inds(term)) + + +"""true if bit i of n is set""" +function bit(n::Integer, i::Integer) + return (n & (1 << (i - 1))) != 0 +end + +""" + vw_to_string(v::Int, w::Unsigned, N::Unsigned) + +convert v,w to a string and a phase +""" +function vw_to_string(v::Unsigned, w::Unsigned, N::Int) + string::String = "" + phase::Complex{Float64} = 1 + for i in 1:N + if !bit(v, i) && !bit(w, i) + string *= '1' + end + if !bit(v, i) && bit(w, i) + string *= 'X' + end + if bit(v, i) && !bit(w, i) + string *= 'Z' + end + if bit(v, i) && bit(w, i) + string *= 'Y' + phase *= 1im + end + end + return string, phase +end + + + +"""print an operator""" +function Base.show(io::IO, o::Operator) + for i in 1:length(o.v) + pauli, phase = vw_to_string(o.v[i], o.w[i], o.N) + c = o.coef[i] / phase + println(io, "($(round(c, digits=10))) ", pauli) + end +end + + +""" + get_coefs(o::Operator) + +Return the list of coefficient in front of each strings. +""" +function get_coefs(o::Operator) + return [o.coef[i] / (1im)^ycount(o.v[i], o.w[i]) for i in 1:length(o)] +end + + +""" + op_to_strings(o::Operator) + +takes an operator, +return (coefs, strings) +where coefs is a list of numbers and strings is a list of pauli string +coefs[i] multiply strings[i] +""" +function op_to_strings(o::Operator) + strings::Vector{String} = [] + coefs::Vector{Complex{Float64}} = [] + for i in 1:length(o) + pauli, phase = vw_to_string(o.v[i], o.w[i], o.N) + push!(coefs, o.coef[i] / phase) + push!(strings, pauli) + end + return coefs, strings +end + +s0 = [1 0; 0 1] +sx = [0 1; 1 0] +sy = [0 -im; im 0] +sz = [1 0; 0 -1] +pdict = Dict('1' => s0, 'X' => sx, 'Y' => sy, 'Z' => sz) + +function string_to_dense(v, w, N) + pauli, phase = vw_to_string(v, w, N) + tau = 1 + for s in pauli + tau = la.kron(tau, pdict[s]) + end + return tau, phase +end + +""" + op_to_dense(o::Operator) + op_to_dense(o::OperatorTS1D) + +Convert an operator to a dense matrix. +""" +function op_to_dense(o::Operator) + dense = zeros(Complex, 2^o.N, 2^o.N) + for i in 1:length(o) + tau, phase = string_to_dense(o.v[i], o.w[i], o.N) + dense .+= tau * o.coef[i] / phase + end + return dense +end + + + +""" + get_coef(o::Operator, v::Unsigned, w::Unsigned) + get_coef(o::Operator, v::Integer, w::Integer) + +Return the coefficient of the string v,w in o. +""" +function get_coef(o::Operator, v::Unsigned, w::Unsigned) + for i in 1:length(o) + if o.v[i] == v && o.w[i] == w + return o.coef[i] / (1im)^ycount(v, w) + end + end + return 0 +end +get_coef(o::Operator, v::Integer, w::Integer) = get_coef(o, Unsigned(v), Unsigned(w)) + +""" + get_pauli(o::Operator, i::Int) + +Return an operator that represent the i-th pauli string of `o'. +Does not return the string multiplied by the coefficient. Only the string. +""" +function get_pauli(o::Operator, i::Int) + o2 = Operator(o.N) + push!(o2.v, o.v[i]) + push!(o2.w, o.w[i]) + push!(o2.coef, (1im)^ycount(o.v[i], o.w[i])) + return o2 +end + +op_to_dense(o::OperatorTS1D) = op_to_dense(Operator(o)) diff --git a/PauliStrings.jl-1.5/src/lanczos.jl b/PauliStrings.jl-1.5/src/lanczos.jl new file mode 100644 index 0000000000000000000000000000000000000000..cb9616aae9dfe647eb7aeb79235b5dbb910ff86a --- /dev/null +++ b/PauliStrings.jl-1.5/src/lanczos.jl @@ -0,0 +1,49 @@ + + + +function norm_lanczos(O::Operator) + return opnorm(O) / sqrt(2^O.N) +end + + +""" + lanczos(H::Operator, O::Operator, steps::Int, nterms::Int; keepnorm=true, maxlength=1000, returnOn=false) + lanczos(H::OperatorTS1D, O::OperatorTS1D, steps::Int, nterms::Int; keepnorm=true, maxlength=1000, returnOn=false) + +Compute the first `steps` lanczos coeficients for Hamiltonian `H` and initial operator `O` + +At every step, the operator is trimed with [`trim`](@ref) and only `nterms` are kept. + +Using `maxlength` speeds up the commutator by only keeping terms of length <= `maxlength` + +Set `returnOn=false` to save the On's at each step. Then the function returns a pair of lists (bn, On). +The first operators of the list On is O +""" +function lanczos(H::Operator, O::Operator, steps::Int, nterms::Int; keepnorm=true, maxlength=1000, returnOn=false, observer=false) + @assert typeof(H) == typeof(O) + @assert H.N == O.N + @assert observer === false || returnOn === false + O0 = deepcopy(O) + O0 /= norm_lanczos(O0) + LHO = com(H, O0) + b = norm_lanczos(LHO) + O1 = com(H, O0) / b + bs = [b] + returnOn && (Ons = [O0, O1]) + (observer !== false) && (obs = [observer(O0), observer(O1)]) + for n in ProgressBar(0:steps-2) + LHO = com(H, O1; maxlength=maxlength) + O2 = LHO - b * O0 + b = norm_lanczos(O2) + O2 /= b + O2 = trim(O2, nterms; keepnorm=keepnorm) + returnOn && push!(Ons, O2) + (observer !== false) && push!(obs, observer(O2)) + O0 = deepcopy(O1) + O1 = deepcopy(O2) + push!(bs, b) + end + (observer !== false) && return (bs, obs) + returnOn && (return bs, Ons) + return bs +end diff --git a/PauliStrings.jl-1.5/src/moments.jl b/PauliStrings.jl-1.5/src/moments.jl new file mode 100644 index 0000000000000000000000000000000000000000..537cd95940a369f5e1916e9da7f10fbd7d109f72 --- /dev/null +++ b/PauliStrings.jl-1.5/src/moments.jl @@ -0,0 +1,141 @@ + + +using Base.Iterators + + +""" + trace_product(o1::Operator, o2::Operator; scale=0) + trace_product(o1::OperatorTS1D, o2::OperatorTS1D; scale=0) + +Efficiently compute `trace(o1*o2)`. This is much faster than doing `trace(o1*o2)`. +If `scale` is not 0, then the result is normalized such that trace(identity)=scale. +""" +function trace_product(o1::Operator, o2::Operator; scale=0) + (scale == 0) && (scale = 2^o1.N) + tr = 0 + T = uinttype(o1) + o1v::Vector{T} = o1.v + o2v::Vector{T} = o2.v + o1w::Vector{T} = o1.w + o2w::Vector{T} = o2.w + for i in eachindex(o1v) + o1vi = o1v[i] + for j in eachindex(o2v) + if (o1vi == o2v[j] && o1w[i] == o2w[j]) + tr += o1.coef[i] * o2.coef[j] * (-1)^count_ones(o1v[i] & o2w[j]) + end + end + end + return tr * scale +end +function trace_product(o1::OperatorTS1D, o2::OperatorTS1D; scale=0) + (scale == 0) && (scale = 2^o1.N) + tr = 0 + N = o1.N + T = uinttype(o1) + o1v::Vector{T} = o1.v + o2v::Vector{T} = o2.v + o1w::Vector{T} = o1.w + o2w::Vector{T} = o2.w + for k in 0:N-1 + for j in eachindex(o2v) + o2vj = o2v[j] + o2wj = o2w[j] + v2 = rotate_lower(o2vj, N, k) + w2 = rotate_lower(o2wj, N, k) + for i in eachindex(o1v) + if (o1v[i] == v2) && (o1w[i] == w2) + tr += o1.coef[i] * o2.coef[j] * (-1)^count_ones(o1v[i] & w2) + end + end + end + end + return tr * scale * N +end + + +""" + oppow(o::Operator, k::Int) + oppow(o::OperatorTS1D, k::Int) + +kth power of o. Same as `^`. +""" +function oppow(o::Operator, k::Int) + # divide and conqueer is not faster + r = eye(o.N) + for i in 1:k + r *= o + end + return r +end +function oppow(o::OperatorTS1D, k::Int) + # divide and conqueer is not faster + r = OperatorTS1D(eye(o.N)) + for i in 1:k + r *= o + end + return r +end + + +""" + Base.:^(o::Operator, k::Int) + +kth power of o. Same as `oppow`. +""" +Base.:^(o::Operator, k::Int) = oppow(o::Operator, k::Int) +Base.:^(o::OperatorTS1D, k::Int) = oppow(o::OperatorTS1D, k::Int) + +""" + trace_product(A::Operator, k::Int, B::Operator, l::Int; scale=0) + trace_product(A::OperatorTS1D, k::Int, B::OperatorTS1D, l::Int; scale=0) + +Efficiently compute `trace(A^k*B^l)`. This is much faster than doing `trace(A^k*B^l)`. + +If `scale` is not 0, then the result is normalized such that trace(identity)=scale. +""" +function trace_product(A::Operator, k::Int, B::Operator, l::Int; scale=0) + @assert typeof(A) == typeof(B) + m = div(k + l, 2) + n = k + l - m + if k < m + C = oppow(A, k) * oppow(B, m - k) + D = oppow(B, n) + elseif k > m + C = oppow(A, m) + D = oppow(A, k - m) * oppow(B, l) + else + C = oppow(A, k) + D = oppow(B, l) + end + return trace_product(C, D; scale=scale) +end + +""" + trace_product(A::Operator, k::Int; scale=0) + +Efficiently compute `trace(A^k)`. This is much faster than doing `trace(A^k)`. + +If `scale` is not 0, then the result is normalized such that trace(identity)=scale. +""" +function trace_product(A::Operator, k::Int; scale=0) + m = div(k, 2) + n = k - m + C = oppow(A, m) + D = oppow(A, n) + return trace_product(C, D; scale=scale) +end + + +""" + moments(H::Operator, kmax::Int; start=1, scale=0) + moments(H::OperatorTS1D, kmax::Int; start=1, scale=0) + +Compute the first kmax moments of H. +start is the first moment to start from. + +If scale is not 0, then the result is normalized such that trace(identity)=scale. +""" +function moments(H::Operator, kmax::Int; start=1, scale=0) + return [trace_product(H, k; scale=scale) for k in start:kmax] +end diff --git a/PauliStrings.jl-1.5/src/operations.jl b/PauliStrings.jl-1.5/src/operations.jl new file mode 100644 index 0000000000000000000000000000000000000000..f598c1fad9c7d03764cfe20fa2debb2ccb7bffbd --- /dev/null +++ b/PauliStrings.jl-1.5/src/operations.jl @@ -0,0 +1,494 @@ + + + +function uinttype(o::Operator) + if typeof(o) == Operator64 || typeof(o) == OperatorTS1D64 + return UInt64 + elseif typeof(o) == Operator128 || typeof(o) == OperatorTS1D128 + return UInt128 + else + error("Type not recognized") + end +end + +function emptydict(o::Operator) + T = uinttype(o) + return UnorderedDictionary{Tuple{T,T},Complex{Float64}}() +end + + + +""" + add(o1::Operator, o2::Operator) + Base.:+(o1::Operator, o2::Operator) + Base.:+(o::Operator, a::Number) + Base.:+(a::Number, o::Operator) + +Add two operators together or add a number to an operator + +# Example +```julia +A = Operator(4) +A += "XYZ1" +A += 1, "Y", 4 +B = Operator(4) +B += 2, "Y", 2, "Y", 4 +B += 1, "Z", 3 +``` + +``` +julia> A +(1.0 - 0.0im) 111Y +(1.0 - 0.0im) XYZ1 + +julia> B +(1.0 + 0.0im) 11Z1 +(2.0 - 0.0im) 1Y1Y + +julia> A+B +(1.0 + 0.0im) 11Z1 +(2.0 - 0.0im) 1Y1Y +(1.0 - 0.0im) 111Y +(1.0 - 0.0im) XYZ1 + +julia> A+5 +(1.0 - 0.0im) 111Y +(1.0 - 0.0im) XYZ1 +(5.0 + 0.0im) 1111 +``` +""" +function Base.:+(o1::Operator, o2::Operator) + @assert o1.N == o2.N "Adding operators of different dimention" + @assert typeof(o1) == typeof(o2) "Adding operators of different types" + o3 = typeof(o1)(o1.N) + o3.v = vcat(o1.v, o2.v) + o3.w = vcat(o1.w, o2.w) + o3.coef = vcat(o1.coef, o2.coef) + return compress(o3) +end + + +function Base.:+(o::Operator, a::Number) + o1 = deepcopy(o) + i = ione(o) + if i >= 0 + o1.coef[ione(o)] += a + else + push!(o1.coef, a) + push!(o1.v, 0) + push!(o1.w, 0) + end + return o1 +end + +Base.:+(a::Number, o::Operator) = o + a + +""" + Base.:*(o1::Operator, o2::Operator) + Base.:*(o::Operator, a::Number) + Base.:*(a::Number, o::Operator) + +Multiply two operators together or an operator with a number + +# Example +```julia +A = Operator(4) +A += "XYZ1" +A += 1, "Y", 4 +B = Operator(4) +B += 2, "Y", 2, "Y", 4 +B += 1, "Z", 3 +``` + +``` +julia> A +(1.0 - 0.0im) 111Y +(1.0 - 0.0im) XYZ1 + + +julia> B +(1.0 + 0.0im) 11Z1 +(2.0 - 0.0im) 1Y1Y + +julia> A*B +(2.0 - 0.0im) X1ZY +(1.0 - 0.0im) 11ZY +(2.0 - 0.0im) 1Y11 +(1.0 - 0.0im) XY11 + +julia> A*5 +(5.0 - 0.0im) 111Y +(5.0 - 0.0im) XYZ1 +``` +""" +function Base.:*(o1::Operator, o2::Operator) + @assert o1.N == o2.N "Multiplying operators of different dimention" + @assert typeof(o1) == typeof(o2) "Multiplying operators of different types" + d = emptydict(o1) + for i in 1:length(o1.v) + for j in 1:length(o2.v) + v = o1.v[i] ⊻ o2.v[j] + w = o1.w[i] ⊻ o2.w[j] + c = o1.coef[i] * o2.coef[j] * (-1)^count_ones(o1.v[i] & o2.w[j]) + if isassigned(d, (v, w)) + d[(v, w)] += c + else + insert!(d, (v, w), c) + end + end + end + return op_from_dict(d, o1.N) +end + + +function op_from_dict(d::UnorderedDictionary{Tuple{T,T},Complex{Float64}}, N::Int) where {T<:Unsigned} + o = Operator(N) + for (v, w) in keys(d) + push!(o.v, v) + push!(o.w, w) + push!(o.coef, d[(v, w)]) + end + return o +end + + + +function Base.:*(o::Operator, a::Number) + o1 = deepcopy(o) + o1.coef .*= a + return o1 +end + +Base.:*(a::Number, o::Operator) = o * a + + +""" + Base.:/(o::Operator, a::Number) + +Divide an operator by a number +""" +function Base.:/(o::Operator, a::Number) + o1 = deepcopy(o) + o1.coef ./= a + return o1 +end + +""" + Base.:-(o::Operator) + Base.:-(o1::Operator, o2::Operator) + Base.:-(o::Operator, a::Real) + Base.:-(a::Real, o::Operator) + +Subtraction between operators and numbers +""" +Base.:-(o::Operator) = -1 * o +Base.:-(o1::Operator, o2::Operator) = o1 + (-o2) +Base.:-(o::Operator, a::Number) = o + (-a) +Base.:-(a::Number, o::Operator) = a + (-o) + + +""" + com(o1::Operator, o2::Operator; epsilon::Real=0, maxlength::Int=1000) + com(o1::OperatorTS1D, o2::OperatorTS1D; anti=false) + +Commutator of two operators. Set anti=true to compute the anti-commutator. + +# Example +``` +julia> A = Operator(4) +julia> A += "X111" +julia> B = Operator(4) +julia> B += "Z111" +julia> B += "XYZ1" +julia> com(A,B) +(0.0 - 2.0im) Y111 +``` +""" +function com(o1::Operator, o2::Operator; epsilon::Real=0, maxlength::Int=1000, anti=false) + s = 1 + anti && (s = -1) + @assert o1.N == o2.N "Commuting operators of different dimention" + @assert typeof(o1) == typeof(o2) "Commuting operators of different types" + o3 = Operator(o1.N) + d = emptydict(o1) + for i in 1:length(o1.v) + for j in 1:length(o2.v) + v = o1.v[i] ⊻ o2.v[j] + w = o1.w[i] ⊻ o2.w[j] + k = (-1)^count_ones(o1.v[i] & o2.w[j]) - s * (-1)^count_ones(o1.w[i] & o2.v[j]) + c = o1.coef[i] * o2.coef[j] * k + if (k != 0) && (abs(c) > epsilon) && pauli_weight(v, w) < maxlength + if isassigned(d, (v, w)) + d[(v, w)] += c + else + insert!(d, (v, w), c) + end + end + end + end + for (v, w) in keys(d) + push!(o3.v, v) + push!(o3.w, w) + push!(o3.coef, d[(v, w)]) + end + return o3 +end + + + +""" + com(v1::Unsigned, w1::Unsigned, v2::Unsigned, w2::Unsigned) + +Commutator of two pauli strings in integer representation +Return k,v,w +""" +function com(v1::Unsigned, w1::Unsigned, v2::Unsigned, w2::Unsigned) + v = v1 ⊻ v2 + w = w1 ⊻ w2 + k = (-1)^count_ones(v1 & w2) - (-1)^count_ones(w1 & v2) + return k, v, w +end + + +""" + compress(o::Operator) + +Accumulate repeated terms and remove terms with a coeficient smaller than 1e-16 +""" +function compress(o::Operator) + o1 = typeof(o)(o.N) + T = uinttype(o) + vw = Set{Tuple{T,T}}(zip(o.v, o.w)) + d = UnorderedDictionary{Tuple{T,T},Complex{Float64}}(vw, zeros(length(vw))) + for i in 1:length(o) + v = o.v[i] + w = o.w[i] + d[(v, w)] += o.coef[i] + end + for (v, w) in keys(d) + if abs(d[(v, w)]) > 1e-16 + push!(o1.v, v) + push!(o1.w, w) + push!(o1.coef, d[(v, w)]) + end + end + return o1 +end + + +"""return the index of the 1 string""" +function ione(o::Operator) + for i in 1:length(o) + if o.v[i] == 0 && o.w[i] == 0 + return i + end + end + return -1 +end + +""" + trace(o::Operator) + trace(o::OperatorTS1D) + +Trace of an operator + +# Example +``` +julia> A = Operator(4) +julia> A += 2,"1111" +julia> A += 3,"XYZ1" +julia> trace(A) +32.0 + 0.0im +``` +""" +function trace(o::Operator) + t = 0 + for i in 1:length(o.v) + if o.v[i] == 0 && o.w[i] == 0 + t += o.coef[i] + end + end + return t * 2^o.N +end + + +""" + diag(o::Operator) + diag(o::OperatorTS1D) + +Diagonal of an operator. Keep the strings that only contain 1's or Z's. +Return another operator. + +# Example +``` +julia> A = Operator(4) +julia> A += 2,"1111" +julia> A += 3,"XYZ1" +julia> A += 3,"Z11Z" +julia> diag(A) +(2.0 + 0.0im) 1111 +(3.0 + 0.0im) Z11Z +``` +""" +function diag(o::Operator) + o2 = Operator(o.N) + for i in 1:length(o) + v = o.v[i] + w = o.w[i] + if xcount(v, w) == 0 && ycount(v, w) == 0 + push!(o2.coef, o.coef[i]) + push!(o2.v, v) + push!(o2.w, w) + end + end + return o2 +end + +""" + ycount(v::Unsigned, w::Unsigned) + +Count the number of Y in a string +""" +ycount(v::Unsigned, w::Unsigned) = count_ones(v & w) + +""" + zcount(v::Unsigned, w::Unsigned) + +Count the number of Z in a string +""" +zcount(v::Unsigned, w::Unsigned) = count_ones(v & ~w) + +""" + xcount(v::Unsigned, w::Unsigned) + +Count the number of X in a string +""" +xcount(v::Unsigned, w::Unsigned) = count_ones(~v & w) + + + +""" + opnorm(o::Operator) + opnorm(o::OperatorTS1D) + +Frobenius norm + +# Example +``` +julia> A = Operator(4) +julia> A += 2,"X",2 +julia> A += 1,"Z",1,"Z",3 +julia> opnorm(A) +8.94427190999916 +``` +""" +function opnorm(o::Operator) + return norm(o.coef) * sqrt(2^o.N) +end + + +""" + dagger(o::Operator) + dagger(o::OperatorTS1D) + +Conjugate transpose + +# Example +```julia +A = Operator(3) +A += 1im,"X",2 +A += 1,"Z",1,"Z",3 +``` +``` +julia> A + +(1.0 + 0.0im) Z1Z +(0.0 + 1.0im) 1X1 + + +julia> dagger(A) +(1.0 - 0.0im) Z1Z +(0.0 - 1.0im) 1X1 +``` +""" +function dagger(o::Operator) + o1 = deepcopy(o) + for i in 1:length(o1) + s = (-1)^count_ones(o1.v[i] & o1.w[i]) + o1.coef[i] = s * conj(o1.coef[i]) + end + return o1 +end + + + + +""" +v,w encode a string. +return true if at least one index of keep is non unit in vw +""" +function tokeep(v::Unsigned, w::Unsigned, keep::Vector{Int}) + for i in keep + if bit(v | w, i) + return true + end + end + return false +end + +""" + ptrace(o::Operator, keep::Vector{Int}) + +Partial trace. + +`keep` is list of qubits indices to keep starting at 1 +note that this still returns an operator of size N and doesnt permute the qubits +this only gets rid of Pauli strings that have no support on keep +and add their coeficient*2^N to the identity string + +# Example +```julia +A = Operator(5) +A += "XY1XZ" +A += "XY11Z" +``` +``` +julia> ptrace(A, [3,4]) +(1.0 - 0.0im) XY1XZ +(8.0 - 0.0im) 11111 + +julia> ptrace(A, [1,5]) +(1.0 - 0.0im) XY1XZ +(1.0 - 0.0im) XY11Z +``` +""" +function ptrace(o::Operator, keep::Vector{Int}) + o2 = Operator(o.N) + NA = length(keep) + NB = o.N - NA + for i in 1:length(o) + if tokeep(o.v[i], o.w[i], keep) + push!(o2.v, o.v[i]) + push!(o2.w, o.w[i]) + push!(o2.coef, o.coef[i]) + else + o2 += o.coef[i] * 2^NB / (1im)^count_ones(o.v[i] & o.w[i]) + end + end + return o2 +end + + +""" + vw_in_o(v::Unsigned, w::Unsigned, o::Operator) + +Return true is string (v,w) is in o +""" +function vw_in_o(v::Unsigned, w::Unsigned, o::Operator) + for i in 1:length(o) + if v == o.v[i] && w == o.w[i] + return true + end + end + return false +end diff --git a/PauliStrings.jl-1.5/src/operator.jl b/PauliStrings.jl-1.5/src/operator.jl new file mode 100644 index 0000000000000000000000000000000000000000..3dfe6c776a8f7e46fe20ff9cc27598d6ecbb4602 --- /dev/null +++ b/PauliStrings.jl-1.5/src/operator.jl @@ -0,0 +1,146 @@ + +abstract type Operator end +abstract type OperatorTS1D <: Operator end + +""" +operator as a sum of pauli string encoded like in +https://journals.aps.org/pra/abstract/10.1103/PhysRevA.68.042318 +intialized as : O=Operator(N) +where N is the number of qubits +""" + +mutable struct Operator64 <: Operator + N::Int + v::Vector{UInt64} + w::Vector{UInt64} + coef::Vector{Complex{Float64}} +end + +mutable struct Operator128 <: Operator + N::Int + v::Vector{UInt128} + w::Vector{UInt128} + coef::Vector{Complex{Float64}} +end + +mutable struct OperatorTS1D64 <: OperatorTS1D + N::Int + v::Vector{UInt64} + w::Vector{UInt64} + coef::Vector{Complex{Float64}} +end + +mutable struct OperatorTS1D128 <: OperatorTS1D + N::Int + v::Vector{UInt128} + w::Vector{UInt128} + coef::Vector{Complex{Float64}} +end + + +Operator64(N::Int) = Operator64(N, UInt64[], UInt64[], Complex{Float64}[]) +Operator128(N::Int) = Operator128(N, UInt128[], UInt128[], Complex{Float64}[]) +OperatorTS1D64(N::Int) = OperatorTS1D64(N, UInt64[], UInt64[], Complex{Float64}[]) +OperatorTS1D128(N::Int) = OperatorTS1D128(N, UInt128[], UInt128[], Complex{Float64}[]) + + +function Operator(N::Int, v::Vector{T}, w::Vector{T}, coef::Vector{Complex{Float64}}) where {T<:Unsigned} + if N <= 64 + return Operator64(N, v, w, coef) + elseif N <= 128 + return Operator128(N, v, w, coef) + else + error("N needs to be <= 128 qubits") + end +end + +""" + Operator(N::Int) + +Initialize an empty operator on N qubits +""" +function Operator(N::Int) + if N <= 64 + return Operator64(N) + elseif N <= 128 + return Operator128(N) + else + error("N needs to be <= 128 qubits") + end +end + +function OperatorTS1D(N::Int, v::Vector{T}, w::Vector{T}, coef::Vector{Complex{Float64}}) where {T<:Unsigned} + if N <= 64 + return OperatorTS1D64(N, v, w, coef) + elseif N <= 128 + return OperatorTS1D128(N, v, w, coef) + else + error("N needs to be <= 128 qubits") + end +end + + +function OperatorTS1D(N::Int) + if N <= 64 + return OperatorTS1D64(N) + elseif N <= 128 + return OperatorTS1D128(N) + else + error("N needs to be <= 128 qubits") + end +end + + +function Operator(pauli::String) + N = length(pauli) + v, w = string_to_vw(pauli) + return Operator(N, [v], [w], [(1.0im)^ycount(v, w)]) +end + + + +""" + Base.length(o::Operator) + Base.length(o::OperatorTS1D) + +Number of pauli strings in an operator + +# Example +``` +julia> A = Operator(4) +julia> A += "X111" +julia> A += "XYZ1" +julia> A += 2, "Y", 4 +julia> length(A) +3 +``` +""" +function Base.length(o::Operator) + return length(o.v) +end + +""" + eye(N::Int) + +Identity operator on N qubits +""" +function eye(N::Int) + O = Operator(N) + return O + 1 +end + +"""number of non unit paulis in a string encoded by v,w""" +function pauli_weight(v::Unsigned, w::Unsigned) + return count_ones(v | w) +end + + +"""returns the position of (v,w) in O. return 0 if (v,w) not in O""" +function posvw(v, w, O) + for i in 1:length(O) + if O.v[i] == v && O.w[i] == w + return i + end + end + return 0 +end diff --git a/PauliStrings.jl-1.5/src/operatorts1d.jl b/PauliStrings.jl-1.5/src/operatorts1d.jl new file mode 100644 index 0000000000000000000000000000000000000000..edae437aab0711971f21c38ac6a1c5357954476c --- /dev/null +++ b/PauliStrings.jl-1.5/src/operatorts1d.jl @@ -0,0 +1,206 @@ + +using Dictionaries + + +""" + OperatorTS1D(o::Operator; full=true) + +Initialize a 1D translation invariant operator from an Operator +\$O=\\sum_i o_i O_i\$ where \$O_i=T_i(O_0)\$ and \$T_i\$ is the i-sites translation operator. +Set full=true if passing \$O\$, an Operator that is supported on the whole chain (i.e converting from a translation symmetric [`Operator`](@ref)) +Set full=false if passing \$O_0\$,a local term o such that the full operator is \$O=\\sum_i o_i T_i(O_0)\$ +""" +function OperatorTS1D(o::Operator; full=true) + if full && !is_ts(o) + error("o is not translation symmetric. If you want to initialize an OperatorTS1D only with its local part H_0, then set full=false") + end + o2 = shift_left(o) + full && (o2 /= o.N) + o3 = OperatorTS1D(o2.N, o2.v, o2.w, o2.coef) +end + + + +""" + Operator(o::OperatorTS1D) + +Convert an OperatorTS1D to an Operator +""" +function Operator(o::OperatorTS1D; rs=true) + rs && (o = resum(o)) + return Operator(o.N, o.v, o.w, o.coef) +end + + + + +""" + is_ts(o::Operator) + +return true if o is translation symmetric +""" +function is_ts(o::Operator) + for i in 1:o.N + if opnorm(o - shift(o, i)) / opnorm(o) > 1e-10 + return false + end + end + return true +end + + + +"""rotate left the first n bits of x by r""" +function rotate_lower(x::Unsigned, n::Int, r::Int) + @assert r <= n + mask = (1 << n) - 1 + lower_bits = x & mask + rotated_bits = (lower_bits >> r) | (lower_bits << (n - r)) + rotated_bits &= mask + return (x & ~mask) | rotated_bits +end + + +"""rotate left the qubits of O by r""" +function shift(o::Operator, r::Int) + o2 = deepcopy(o) + for i in 1:length(o) + o2.v[i] = rotate_lower(o2.v[i], o2.N, r) + o2.w[i] = rotate_lower(o2.w[i], o2.N, r) + end + return compress(o2) +end + +"""shift the string v,w so it starts on site 1""" +function shift_left(v, w, N) + l = 2^(N + 1) + v2 = v + w2 = w + for i in 0:N + v3 = rotate_lower(v, N, i) + w3 = rotate_lower(w, N, i) + if v3 | w3 + v3 & w3 / 100000 < l + v2 = v3 + w2 = w3 + l = v3 | w3 + v3 & w3 / 100000 + end + end + return (v2, w2) +end + +""" + shift_left(O::Operator) + +Shift evey string left so they start on site 1. This usefull for using translation symmetry in 1D systems +# Example +```julia +A = Operator(4) +A += "XYZ1" +A += "11ZZ" +A += "1XZY" +A += "ZZ11" +``` +```julia +julia> shift_left(A) +(1.0 - 0.0im) XZY1 +(1.0 - 0.0im) XYZ1 +(2.0 + 0.0im) ZZ11 +``` +""" +function shift_left(O::Operator) + d = UnorderedDictionary{Tuple{Unsigned,Unsigned},Complex{Float64}}() + for i in 1:length(O) + v, w = shift_left(O.v[i], O.w[i], O.N) + c = O.coef[i] + if isassigned(d, (v, w)) + d[(v, w)] += c + else + insert!(d, (v, w), c) + end + end + return op_from_dict(d, O.N) +end + +shift1(O::Operator) = shift_left(O) + + +function resum(o::OperatorTS1D) + o2 = Operator(o.N) + for i in 1:o.N + oi = Operator(o.N, o.v, o.w, o.coef) + o2 += shift(oi, i) + end + return o2 +end + + +Base.:+(a::Number, o::OperatorTS1D) = OperatorTS1D(Operator(o, rs=false) + a / o.N; full=false) +Base.:+(o::OperatorTS1D, a::Number) = a + o + + +function Base.:*(o1::OperatorTS1D, o2::OperatorTS1D) + if o1.N != o2.N + error("Multiplying OperatorTS1D of different dimention") + end + N = o1.N + d = emptydict(o1) + for i in 1:length(o1.v) + for j in 1:length(o2.v) + for k in 0:N-1 + v2 = rotate_lower(o2.v[j], N, k) + w2 = rotate_lower(o2.w[j], N, k) + v = o1.v[i] ⊻ v2 + w = o1.w[i] ⊻ w2 + c = o1.coef[i] * o2.coef[j] * (-1)^count_ones(o1.v[i] & w2) + if isassigned(d, (v, w)) + d[(v, w)] += c + else + insert!(d, (v, w), c) + end + end + end + end + o = op_from_dict(d, N) + return OperatorTS1D(compress(shift_left(o)); full=false) +end + + + +trace(o::OperatorTS1D) = trace(Operator(o; rs=false)) * o.N +opnorm(o::OperatorTS1D) = opnorm(Operator(o; rs=false)) * sqrt(o.N) + + +# diag(o::OperatorTS1D) = OperatorTS1D(diag(o.o); full=false) +# compress(o::OperatorTS1D) = OperatorTS1D(compress(o.o); full=false) + + +function com(o1::OperatorTS1D, o2::OperatorTS1D; epsilon::Real=0, maxlength::Int=1000, anti=false) + s = 1 + anti && (s = -1) + if o1.N != o2.N + error("Multiplying OperatorTS1D of different dimention") + end + N = o1.N + d = emptydict(o1) + for i in 1:length(o1.v) + for j in 1:length(o2.v) + for k in 0:N-1 + v2 = rotate_lower(o2.v[j], N, k) + w2 = rotate_lower(o2.w[j], N, k) + v = o1.v[i] ⊻ v2 + w = o1.w[i] ⊻ w2 + k = (-1)^count_ones(o1.v[i] & w2) - s * (-1)^count_ones(o1.w[i] & v2) + c = o1.coef[i] * o2.coef[j] * k + if (k != 0) && (abs(c) > epsilon) && pauli_weight(v, w) < maxlength + if isassigned(d, (v, w)) + d[(v, w)] += c + else + insert!(d, (v, w), c) + end + end + end + end + end + o = op_from_dict(d, N) + return OperatorTS1D(compress(shift_left(o)); full=false) +end diff --git a/PauliStrings.jl-1.5/src/random.jl b/PauliStrings.jl-1.5/src/random.jl new file mode 100644 index 0000000000000000000000000000000000000000..23d6b3e66d48a6b828d3ff696efef75fdf0eb7b2 --- /dev/null +++ b/PauliStrings.jl-1.5/src/random.jl @@ -0,0 +1,68 @@ + +""" + rand_local2(N::Int) + +Random 2-local operator +""" +function rand_local2(N::Int) + o = Operator(N) + for i in 1:N + for j in 1:N + if i != j + for k in ['X', 'Y', 'Z'] + for l in ['X', 'Y', 'Z'] + o += (randn(rng, Float64), k, i, l, j) + end + end + end + end + end + return compress(o) +end + +""" + rand_local2(N::Int) + +Random 1-local operator +""" +function rand_local1(N::Int) + o = Operator(N) + for i in 1:N + for k in ['X', 'Y', 'Z'] + o += (randn(rng, Float64), k, i) + end + end + return compress(o) +end + + +""" + rand_local1_TS1D(N::Int) + +Random 1-local OperatorTS1D +""" +function rand_local1_TS1D(N::Int) + o = Operator(N) + for k in ['X', 'Y', 'Z'] + o += (randn(rng, Float64), k, 1) + end + return OperatorTS1D(o; full=false) +end + +""" + rand_local2_TS1D(N::Int) + +Random 2-local OperatorTS1D +""" +function rand_local2_TS1D(N::Int) + o = Operator(N) + for i in 2:N + for k in ['X', 'Y', 'Z'] + for l in ['X', 'Y', 'Z'] + o += (randn(rng, Float64), k, 1, l, i) + end + end + end + o = compress(o) + return OperatorTS1D(o; full=false) +end diff --git a/PauliStrings.jl-1.5/src/time_evolution.jl b/PauliStrings.jl-1.5/src/time_evolution.jl new file mode 100644 index 0000000000000000000000000000000000000000..9b9cc18173a2e73101945f4cf6a5b963fac0dcc6 --- /dev/null +++ b/PauliStrings.jl-1.5/src/time_evolution.jl @@ -0,0 +1,39 @@ +""" + rk4(H::Operator, O::Operator, dt::Real; hbar::Real=1, heisenberg=false, M=2^20, keep::Operator=Operator(N)) + +Single step of Runge–Kutta-4 with time independant Hamiltonian. +Returns O(t+dt). +Set `heisenberg=true` for evolving an observable in the heisenberg picture. +If `heisenberg=false` then it is assumed that O is a density matrix. +""" +function rk4(H::Operator, O::Operator, dt::Real; hbar::Real=1, heisenberg=false, M=2^20, keep::Operator=Operator(0)) + (keep.N == 0) && (keep=Operator(O.N)) + s = -1im + heisenberg && (s*=-1) + k1 = s/hbar*com(H, O) + k1 = trim(k1, M; keep=keep) + k2 = s/hbar*com(H, O+dt*k1/2) + k2 = trim(k2, M; keep=keep) + k3 = s/hbar*com(H, O+dt*k2/2) + k3 = trim(k3, M; keep=keep) + k4 = s/hbar*com(H, O+dt*k3) + k4 = trim(k4, M; keep=keep) + return O+(k1+2*k2+2*k3+k4)*dt/6 +end + +""" + rk4(H::Function, O::Operator, dt::Real, t::Real; hbar::Real=1, heisenberg=false) + +Single step of Runge–Kutta-4 with time dependant Hamiltonian. +`H` is a function that takes a number (time) and returns an operator. +""" +function rk4(H::Function, O::Operator, dt::Real, t::Real; hbar::Real=1, heisenberg=false) + s = -1im + heisenberg && (s*=-1) + itime && (s*= 1im) + k1 = s/hbar*com(H(t), O) + k2 = s/hbar*com(H(t+dt/2), O+dt*k1/2) + k3 = s/hbar*com(H(t+dt/2), O+dt*k2/2) + k4 = s/hbar*com(H(t+dt), O+dt*k3) + return O+(k1+2*k2+2*k3+k4)*dt/6 +end diff --git a/PauliStrings.jl-1.5/src/truncation.jl b/PauliStrings.jl-1.5/src/truncation.jl new file mode 100644 index 0000000000000000000000000000000000000000..bd067f819cbf02c0a3e11b78987235b3a9de560f --- /dev/null +++ b/PauliStrings.jl-1.5/src/truncation.jl @@ -0,0 +1,216 @@ + +""" + truncate(o::Operator, max_lenght::Int; keepnorm::Bool = false) + +Remove all terms of length > max_lenght. +Keep all terms of length <= max_lenght. +i.e remove all M-local terms with M>max_lenght + +# Example +```julia +A = Operator(4) +A += "X",1,"X",2 +A += "Z",1,"Z",2,"Z",4 +``` +``` +julia> A +(1.0 + 0.0im) ZZ1Z +(1.0 + 0.0im) XX11 + +julia> ps.truncate(A,2) +(1.0 + 0.0im) XX11 +``` +""" +function PauliStrings.truncate(o::Operator, max_lenght::Int; keepnorm::Bool=false) + o2 = typeof(o)(o.N) + for i in 1:length(o) + v = o.v[i] + w = o.w[i] + if pauli_weight(v, w) <= max_lenght + push!(o2.coef, o.coef[i]) + push!(o2.v, v) + push!(o2.w, w) + end + end + if keepnorm + return o2 * opnorm(o) / opnorm(o2) + end + return o2 +end + + + +""" + k_local_part(o::Operator, k::Int; atmost=false) + +Return the k-local part of o. I.e all the strings of lenght k. +Set `atmost=true` to return the 'at most' k-local part, i.e all the strings of length <= k. + +# Example +```julia +A = Operator(4) +A += "X",1,"X",2 +A += "Z",1,"Z",2,"Z",4 +A += "1X11" +``` +``` +julia> A +(1.0 + 0.0im) ZZ1Z +(1.0 + 0.0im) 1X11 +(1.0 + 0.0im) XX11 + +julia> k_local_part(A,2) +(1.0 + 0.0im) XX11 +``` +""" +function k_local_part(o::Operator, k::Int; atmost=false) + o2 = typeof(o)(o.N) + for i in 1:length(o) + v = o.v[i] + w = o.w[i] + l = pauli_weight(v, w) + if l == k || (atmost && l <= k) + push!(o2.coef, o.coef[i]) + push!(o2.v, v) + push!(o2.w, w) + end + end + return o2 +end + + + + +""" + trim(o::Operator, max_strings::Int; keepnorm::Bool = false, keep::Operator=Operator(N)) + +Keep the first `max_strings` terms with largest coeficients. + +`keepnorm` is set to true to keep the norm of o. + +`keep` is an operator that specify a set of strings that cannot be removed + +# Example +```julia +A = Operator(4) +A += 1,"XXXX" +A += 2,"XX11" +A += 3,"XX1X" +A += 4,"ZZXX" +B = Operator(4) +B += 1,"XX11" +B += 1,"XX1X" +``` +``` +julia> trim(A,2) +(4.0 + 0.0im) ZZXX +(3.0 + 0.0im) XX1X + +julia> trim(A,2;keep=B) +(4.0 + 0.0im) ZZXX +(3.0 + 0.0im) XX1X +(2.0 + 0.0im) XX11 +``` +""" +function trim(o::Operator, max_strings::Int; keepnorm::Bool=false, keep::Operator=Operator(0)) + if length(o) <= max_strings + return deepcopy(o) + end + # keep the N first indices + i = sortperm(abs.(o.coef), rev=true)[1:max_strings] + # add the string to keep in case there was a specified string to keep + if length(keep) > 0 + for tau in 1:length(keep) #for each string tau in the keep operator + # we check if tau is in o and has been removed + j = posvw(keep.v[tau], keep.w[tau], o) + if !(j in i) && j != 0 + push!(i, j) + end + end + end + o1 = typeof(o)(o.N, o.v[i], o.w[i], o.coef[i]) + if keepnorm + return o1 * opnorm(o) / opnorm(o1) + end + return o1 +end + +""" + prune(o::Operator, alpha::Real; keepnorm::Bool = false) + +Keep terms with probability 1-exp(-alpha*abs(c)) where c is the weight of the term +""" +function prune(o::Operator, alpha::Real; keepnorm::Bool=false) + i = Int[] + for k in 1:length(o) + p = 1 - exp(-alpha * abs(o.coef[k])) + if rand() < p + push!(i, k) + end + end + o1 = typeof(o)(o.N, o.v[i], o.w[i], o.coef[i]) + if keepnorm + return o1 * opnorm(o) / opnorm(o1) + end + return o1 +end + +""" + cutoff(o::Operator, epsilon::Real; keepnorm::Bool = false) + +Remove all terms with weight < epsilon + +# Example +```julia +A = Operator(4) +A += 1,"XXXX" +A += 2,"XX11" +A += 3,"XX1X" +A += 4,"ZZXX" +``` +``` +julia> cutoff(A, 2.5) +(3.0 + 0.0im) XX1X +(4.0 + 0.0im) ZZXX +``` +""" +function cutoff(o::Operator, epsilon::Real; keepnorm::Bool=false) + o2 = typeof(o)(o.N) + for i in 1:length(o) + if abs(o.coef[i]) > epsilon + push!(o2.coef, o.coef[i]) + push!(o2.v, o.v[i]) + push!(o2.w, o.w[i]) + end + end + if keepnorm + return o2 * opnorm(o) / opnorm(o2) + end + return o2 +end + + + +""" + add_noise(o::Operator, g::Real) + +Add depolarizing noise that make the long string decays. `g` is the noise amplitude. +# Example +```julia +A = add_noise(A, 0.1) +``` +# Reference +[https://arxiv.org/pdf/2407.12768](https://arxiv.org/pdf/2407.12768) +""" +function add_noise(o::Operator, g::Real) + o2 = deepcopy(o) + for i in 1:length(o) + o2.coef[i] *= exp(-pauli_weight(o.v[i], o.w[i]) * g) + end + return o2 +end + + +function participation(o::Operator) + return sum(o.coef .^ 4) / sum(o.coef .^ 2)^2 +end diff --git a/PauliStrings.jl-1.5/test/algorithms.jl b/PauliStrings.jl-1.5/test/algorithms.jl new file mode 100644 index 0000000000000000000000000000000000000000..3dccd3a36b3a52eb35551054dbdfff3c54a55f6c --- /dev/null +++ b/PauliStrings.jl-1.5/test/algorithms.jl @@ -0,0 +1,35 @@ +@testset "lanczos" begin + bs1 = ps.lanczos(XX(10), X(10), 10, 2^14) + bs2 = ps.lanczos(OperatorTS1D(XX(10)), OperatorTS1D(X(10)), 10, 2^14) + @test norm(bs1 .- [2.8284271247461903, 4.0, 4.898979485566357, 5.65685424949238, 6.324555320336759, 6.92820323027551, 7.483314773547883, 8.0, 8.487501570645295, 8.957117508915214]) < 1e-14 + @test norm(bs1 .- bs2) < 1e-10 +end + +@testset "time_evolution" begin + @test norm(evolve_chaotic() - 0.09208935978092929) < 1e-10 +end + +@testset "moments" begin + for N in (10, 70) + O1 = rand_local2_M(N, 15) + O2 = rand_local2_M(N, 15) + @test opnorm(oppow(O1, 3) - O1 * O1 * O1) < 1e-9 + @test abs(trace_product(O1, O2) - trace(O1 * O2)) < 1e-9 + @test abs(trace_product(O1, 4) - trace(oppow(O1, 4))) < 1e-9 + @test abs(trace_product(O1, 4, O2, 3) - trace(oppow(O1, 4) * oppow(O2, 3))) < 1e-8 + end + N = 6 + O1 = ising1D(N, 0.5) + O2 = ising1D(N, 1.1) + O1ts = OperatorTS1D(O1) + O2ts = OperatorTS1D(O2) + @test opnorm(oppow(O1ts, 3) - O1ts * O1ts * O1ts) < 1e-10 + @test abs(trace_product(O1ts, 4) - trace_product(O1, 4)) < 1e-10 + @test abs(trace_product(O1ts, 4, O2ts, 3) - trace_product(O1, 4, O2, 3)) < 1e-10 +end + + +@testset "equivalence" begin + @test length(equivalence_class(Operator("Y11111"), XX(6))) == 72 + @test length(equivalence_class(Operator("Y111Z1"), XX(6))) == 512 +end diff --git a/PauliStrings.jl-1.5/test/circuits.jl b/PauliStrings.jl-1.5/test/circuits.jl new file mode 100644 index 0000000000000000000000000000000000000000..f76d78351fd8fcb25bba737e26118d9e0954dd2e --- /dev/null +++ b/PauliStrings.jl-1.5/test/circuits.jl @@ -0,0 +1,68 @@ + +using PauliStrings.Circuits + +function ccx() + c = Circuit(3) + push!(c, "H", 3) + push!(c, "CNOT", 2, 3) + push!(c, "Tdg", 3) + push!(c, "CNOT", 1, 3) + push!(c, "T", 3) + push!(c, "CNOT", 2, 3) + push!(c, "Tdg", 3) + push!(c, "CNOT", 1, 3) + push!(c, "T", 2) + push!(c, "T", 3) + push!(c, "CNOT", 1, 2) + push!(c, "H", 3) + push!(c, "T", 1) + push!(c, "Tdg", 2) + push!(c, "CNOT", 1, 2) + return compile(c) +end + +function swap() + c = Circuit(2) + push!(c, "CNOT", 1, 2) + push!(c, "CNOT", 2, 1) + push!(c, "CNOT", 1, 2) + return compile(c) +end + +function swapH() + c = Circuit(2) + push!(c, "H", 1) + push!(c, "CZ", 1, 2) + push!(c, "H", 1) + push!(c, "H", 2) + push!(c, "CZ", 1, 2) + push!(c, "H", 1) + push!(c, "H", 2) + push!(c, "CZ", 1, 2) + push!(c, "H", 1) + return compile(c) +end + +function cxH() + c = Circuit(2) + push!(c, "H", 2) + push!(c, "CZ", 2, 1) + push!(c, "H", 2) + return compile(c) +end + +import LinearAlgebra: diag as ldiag +@testset "circuits" begin + U1 = compress(ccx()) + U2 = CCXGate(3, 1, 2, 3) + @test opnorm(U1 - U2) < 1e-10 + @test isidentity(U1 * dagger(U2)) + @test isunitary(TGate(1,1)) + @test isunitary(U1) + @test isunitary(U2) + @test isidentity(swap() * SwapGate(2, 1, 2)) + @test isidentity(swapH() * SwapGate(2, 1, 2)) + @test isidentity(cxH() * CXGate(2, 1, 2)) + @test opnorm(CZGate(2, 1, 2)-CZGate(2, 2, 1)) < 1e-10 + @test ldiag(op_to_dense(MCZGate(3))) == [1,1,1,1,1,1,1,-1] +end diff --git a/PauliStrings.jl-1.5/test/examples.jl b/PauliStrings.jl-1.5/test/examples.jl new file mode 100644 index 0000000000000000000000000000000000000000..e2395535375f040dbfb6fcb17594cc8672550896 --- /dev/null +++ b/PauliStrings.jl-1.5/test/examples.jl @@ -0,0 +1,165 @@ + +using ProgressBars +using Random + +rng = MersenneTwister(0) + +function construction_example1() + A = Operator(4) + A += "X", 1 + A += "Y", 2 + A += 2, "Z", 3 + return A +end + +function construction_example2() + A = Operator(8) + A += 2, "X", 1, "X", 2 + A += 1.5, "Y", 2, "Z", 3 + A += "Z", 3, "Z", 8 + return A +end + +function construction_example3() + A = Operator(6) + A += "XYZ111" + A += 5, "11XX11" + return A +end + +"""XX hamiltonian https://arxiv.org/abs/1812.08657""" +function XX(N) + H = Operator(N) + for j in 1:(N-1) + H += ('X', j, 'X', j + 1) + H += ('Z', j, 'Z', j + 1) + end + H += ('X', N, 'X', 1) + H += ('Z', N, 'Z', 1) + return H +end + + +"""X operator on all sites""" +function X(N) + H = Operator(N) + for j in 1:N + H += ('X', j) + end + return H +end + +"""Y operator on all sites""" +function Y(N) + H = Operator(N) + for j in 1:N + H += ('Y', j) + end + return H +end + +"""Z operator on all sites""" +function Z(N) + H = Operator(N) + for j in 1:N + H += ('Z', j) + end + return H +end + +# build a chaotic spin chain with periodic bc +function chaotic_chain(N::Int) + H = ps.Operator(N) + # XX interractions + for j in 1:(N-1) + H += "X", j, "X", j + 1 + end + H += "X", 1, "X", N # close the chain + # fields + for j in 1:N + H += -1.05, "Z", j + H += 0.5, "X", j + end + return H +end + + + +function ising1D(N, g) + H = Operator(N) + for j in 1:(N-1) + H += "Z", j, "Z", j + 1 + end + H += "Z", 1, "Z", N #periodic boundary condition + for j in 1:N + H += g, "X", j + end + return -H +end + + + + +# heisenberg evolution of the operator O using rk4 +# return tr(O(0)*O(t))/tr(O(t)^2) +# M is the number of strings to keep at each step +# noise is the amplitude of depolarizing noise +function evolve(H, O, M, times, noise) + echo = [] + O0 = deepcopy(O) + dt = times[2] - times[1] + for t in ProgressBar(times) + push!(echo, ps.trace(O * ps.dagger(O0)) / ps.trace(O0 * O0)) + #preform one step of rk4, keep only M strings, do not discard O0 + O = ps.rk4(H, O, dt; heisenberg=true, M=M, keep=O0) + #add depolarizingn oise + O = ps.add_noise(O, noise * dt) + # keep the M strings with the largest weight. Do not discard O0 + O = ps.trim(O, M; keep=O0) + end + return real.(echo) +end + +function evolve_chaotic() + N = 20 # system size + H = chaotic_chain(N) #hamiltonian + O = ps.Operator(N) #operator to time evolve + O += "Z", 1 # Z on site 1 + times = range(0, stop=5, step=0.05) + noise = 0.01 + S = evolve(H, O, 2^8, times, noise) + return S[end] +end + + +""" +random 2-local operator with N sites and M terms for use in tests +""" +function rand_local2_M(N::Int, M::Int) + o = Operator(N) + for i in 1:M + k = rand(['X', 'Y', 'Z']) + l = rand(['X', 'Y', 'Z']) + i = rand(1:N) + j = i + while j == i + j = rand(1:N) + end + o += (randn(rng, Float64), k, i, l, j) + end + return compress(o) +end + + +""" +random 1-local operator with N sites and M terms for use in tests +""" +function rand_local1_M(N::Int, M::Int) + o = Operator(N) + for i in 1:M + k = rand(['X', 'Y', 'Z']) + i = rand(1:N) + o += (randn(rng, Float64), k, i) + end + return compress(o) +end diff --git a/PauliStrings.jl-1.5/test/operator.jl b/PauliStrings.jl-1.5/test/operator.jl new file mode 100644 index 0000000000000000000000000000000000000000..ec0b872ccb1ec39a87ad6a393e27ad3ea2895ef3 --- /dev/null +++ b/PauliStrings.jl-1.5/test/operator.jl @@ -0,0 +1,71 @@ + + +# tests for the Operator type and operations on operators + + +@testset "io" begin + @test construction_example1().w == [0, 1, 2] + @test construction_example2().v == [6, 0, 132] + @test construction_example2().w == [2, 3, 0] + @test construction_example3().v == [0, 6] + @test construction_example3().w == [12, 3] + @test get_coef(construction_example1(), 4, 0) == 2 + @test get_coef(construction_example1(), 0, 1) == 1 + @test get_coef(construction_example1(), 2, 2) == 1 +end + +@testset "random" begin + N = 10 + @test length(ps.rand_local1(N)) == 3 * N + @test ps.rand_local1(N).N == N + @test length(ps.rand_local2(N)) == 9 * N * (N - 1) / 2 + @test ps.rand_local2(N).N == N +end + +@testset "operators" begin + @test Operator128 <: Operator + @test Operator64 <: Operator + @test OperatorTS1D128 <: OperatorTS1D + @test OperatorTS1D64 <: OperatorTS1D + @test OperatorTS1D <: Operator + @test typeof(Operator(10)) <: Operator + @test typeof(Operator(70)) <: Operator + ising10 = ising1D(10, 1) + ising70 = ising1D(70, 1) + @test typeof(ising10) <: Operator + @test typeof(ising70) <: Operator + @test typeof(ising10) == Operator64 + @test typeof(ising70) == Operator128 + ising10ts = OperatorTS1D(ising10) + ising70ts = OperatorTS1D(ising70) + @test typeof(ising10ts) == OperatorTS1D64 + @test typeof(ising70ts) == OperatorTS1D128 + @test typeof(Operator(ising10ts)) == Operator64 + @test typeof(Operator(ising70ts)) == Operator128 +end + +@testset "operations" begin + for N in (10, 10) + O1 = rand_local1_M(N, 20) + O2 = rand_local2_M(N, 20) + @test trace(O1 * O2) == 0 + @test trace(O1 * O1) != 0 + @test opnorm(O1) > 0 + @test opnorm(dagger(XX(N)) - XX(N)) == 0 + @test opnorm(dagger(X(N)) - X(N)) == 0 + @test opnorm(dagger(O1) - O1) == 0 + @test opnorm(dagger(O2) - O2) == 0 + @test opnorm(com(O1, O2) - (O1 * O2 - O2 * O1)) <= 1e-10 + @test opnorm(com(O1, O2, anti=true) - (O1 * O2 + O2 * O1)) <= 1e-10 + @test opnorm(com(O1, eye(N))) == 0 + @test opnorm(com(XX(N), Y(N))) == 0 + @test opnorm(com(XX(N), X(N))) == opnorm(com(XX(N), Z(N))) + @test trace(diag(O1)) == trace(O1) + @test trace(diag(O2)) == trace(O2) + end + O = Operator(6) + O += "XYZZ1Y" + @test xcount(O.v[1], O.w[1]) == 1 + @test ycount(O.v[1], O.w[1]) == 2 + @test zcount(O.v[1], O.w[1]) == 2 +end diff --git a/PauliStrings.jl-1.5/test/operatorts1d.jl b/PauliStrings.jl-1.5/test/operatorts1d.jl new file mode 100644 index 0000000000000000000000000000000000000000..fb520133a5ccbeb58fbc4522a2d742024a1739c2 --- /dev/null +++ b/PauliStrings.jl-1.5/test/operatorts1d.jl @@ -0,0 +1,30 @@ + +@testset "operatorts1d" begin + N = 6 + O1 = ising1D(N, 0.5) + O2 = ising1D(N, 1.1) + O1ts = OperatorTS1D(O1) + O2ts = OperatorTS1D(O2) + eps = 1e-10 + @test typeof(O1ts + O2ts) == typeof(O1ts) + @test typeof(O1ts - O2ts) == typeof(O1ts) + @test typeof(O1ts * O2ts) == typeof(O1ts) + @test typeof(O1ts - 1) == typeof(O1ts) + @test typeof(O1ts + 1) == typeof(O1ts) + @test typeof(O1ts * 2) == typeof(O1ts) + @test typeof(O1ts / 2) == typeof(O1ts) + @test typeof(OperatorTS1D(ising1D(70, 1))) == OperatorTS1D128 + @test typeof(OperatorTS1D(ising1D(40, 1))) == OperatorTS1D64 + @test opnorm(Operator(O1ts) - O1) < eps + @test opnorm(Operator(O2ts) - O2) < eps + @test opnorm(Operator(O2ts) - O2) < eps + @test opnorm(Operator(O1ts * O2ts) - O1 * O2) < eps + @test opnorm(Operator(O1ts * O2ts * O2ts) - O1 * O2 * O2) < eps + @test opnorm(Operator(O1ts + O2ts) - (O1 + O2)) < eps + @test opnorm(Operator(O1ts * 7) - O1 * 7) < eps + @test opnorm(Operator(O1ts + 7) - (O1 + 7)) < eps + @test is_ts(O1) + @test !is_ts(ps.rand_local2(N)) + @test trace(O1ts) == trace(dagger(O1)) + @test trace(O1ts) == trace(diag(O1ts)) +end diff --git a/PauliStrings.jl-1.5/test/runtests.jl b/PauliStrings.jl-1.5/test/runtests.jl new file mode 100644 index 0000000000000000000000000000000000000000..9036e3ac5da0c5c3d728dc27763feed4dd2d7da9 --- /dev/null +++ b/PauliStrings.jl-1.5/test/runtests.jl @@ -0,0 +1,18 @@ +using PauliStrings +import PauliStrings as ps +using Test +using LinearAlgebra: norm + + + +ishermitian(H::Operator) = opnorm(H-dagger(H)) < 1e-10 +isunitary(U::Operator) = opnorm(U * dagger(U) - eye(U.N)) < 1e-10 +isidentity(U::Operator) = opnorm(U - eye(U.N)) < 1e-10 + + +include("examples.jl") + +include("operator.jl") +include("algorithms.jl") +include("operatorts1d.jl") +include("circuits.jl") diff --git a/PauliStrings.jl-1.5/test/truncation.jl b/PauliStrings.jl-1.5/test/truncation.jl new file mode 100644 index 0000000000000000000000000000000000000000..f1044de6ae72172c89b9c873d7e78f6b289a1e0a --- /dev/null +++ b/PauliStrings.jl-1.5/test/truncation.jl @@ -0,0 +1,21 @@ + +@testset "truncation" begin + N = 8 + O2 = ps.rand_local2(N) + @test opnorm(ps.truncate(O2, 1)) == 0 + @test opnorm(ps.truncate(O2, 2)) == opnorm(O2) + @test length(ps.trim(O2, 10)) == 10 + @test length(ps.prune(O2, 2)) <= length(ps.prune(O2, 20)) + @test length(ps.cutoff(XX(N) + 0.1 * X(N), 0.5)) == length(XX(N)) + @test opnorm(ps.cutoff(O2, 0.5)) <= opnorm(O2) + @test opnorm(ps.add_noise(O2, 0.5)) < opnorm(O2) + @test opnorm(ps.add_noise(O2, 0.5)) < opnorm(ps.add_noise(O2, 0.1)) + @test opnorm(k_local_part(O2, 1) - ps.truncate(O2, 1)) == 0 + O1 = ising1D(N, 0.5) + O1ts = OperatorTS1D(O1) + @test opnorm(ps.truncate(O1ts, 2)) == opnorm(O1) + @test length(ps.trim(O1ts, 1)) == 1 + @test opnorm(ps.cutoff(O1ts, 0.8)) <= opnorm(O1ts) + @test opnorm(ps.add_noise(O1ts, 0.5)) < opnorm(O1ts) + @test opnorm(Operator(ps.add_noise(O1ts, 0.5)) - ps.add_noise(O1, 0.5)) < 1e-10 +end diff --git a/PauliStrings.jl-1.5/time_evolve_example.png b/PauliStrings.jl-1.5/time_evolve_example.png new file mode 100644 index 0000000000000000000000000000000000000000..b319fc93fc23100b76545a7b0dc54f6f5f2d4541 Binary files /dev/null and b/PauliStrings.jl-1.5/time_evolve_example.png differ diff --git a/PauliStrings.jl-1.5/toffoli.png b/PauliStrings.jl-1.5/toffoli.png new file mode 100644 index 0000000000000000000000000000000000000000..61015d8428eb6d411cf9b6559c75f99e99c011c2 Binary files /dev/null and b/PauliStrings.jl-1.5/toffoli.png differ