diff --git a/Cargo.lock b/Cargo.lock index 5995977c..ec21256a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -19,57 +19,58 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "approx" @@ -83,9 +84,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "bit-set" @@ -104,39 +105,27 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.3.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytecount" -version = "0.6.3" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" +checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.15.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" [[package]] name = "cast" @@ -144,15 +133,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" -[[package]] -name = "cc" -version = "1.0.82" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" -dependencies = [ - "libc", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -161,9 +141,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "ciborium" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" dependencies = [ "ciborium-io", "ciborium-ll", @@ -172,15 +152,15 @@ dependencies = [ [[package]] name = "ciborium-io" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" [[package]] name = "ciborium-ll" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", "half", @@ -188,9 +168,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", @@ -198,9 +178,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", @@ -210,38 +190,38 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck 0.5.0", - "proc-macro2 1.0.78", - "quote 1.0.35", - "syn 2.0.48", + "proc-macro2 1.0.86", + "quote 1.0.36", + "syn 2.0.68", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "console" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", "lazy_static", "libc", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -280,48 +260,36 @@ dependencies = [ "itertools 0.10.5", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "deranged" @@ -340,9 +308,9 @@ checksum = "3d1b11bd5e7e98406c6ff39fbc94d6e910a489b978ce7f17c19fce91a1195b7a" [[package]] name = "either" -version = "1.9.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "encode_unicode" @@ -358,30 +326,19 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "cc", "libc", + "windows-sys", ] [[package]] name = "fastrand" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fixedbitset" @@ -397,9 +354,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -412,9 +369,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -422,15 +379,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -439,44 +396,44 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ - "proc-macro2 1.0.78", - "quote 1.0.35", - "syn 2.0.48", + "proc-macro2 1.0.86", + "quote 1.0.36", + "syn 2.0.68", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -492,9 +449,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -509,15 +466,19 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "half" -version = "1.8.2" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" @@ -533,9 +494,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "indexmap" @@ -549,15 +510,15 @@ dependencies = [ [[package]] name = "indoc" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "insta" -version = "1.37.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1718b3f2b85bb5054baf8ce406e36401f27c3169205f4175504c4b1d98252d3f" +checksum = "810ae6042d48e2c9e9215043563a58a80b877bc863228a74cf10c49d4620a6f5" dependencies = [ "console", "lazy_static", @@ -573,15 +534,21 @@ checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", - "windows-sys 0.48.0", + "libc", + "windows-sys", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -602,24 +569,24 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lexical" @@ -696,15 +663,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linked-hash-map" @@ -714,15 +681,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -730,15 +697,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "matrixmultiply" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090126dc04f95dc0d1c1c91f61bdd474b3930ca064c1edc8a849da2c6cbe1e77" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" dependencies = [ "autocfg", "rawpointer", @@ -746,15 +713,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -789,8 +756,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" dependencies = [ - "proc-macro2 1.0.78", - "quote 1.0.35", + "proc-macro2 1.0.86", + "quote 1.0.36", "syn 1.0.109", ] @@ -820,9 +787,9 @@ dependencies = [ [[package]] name = "nom_locate" -version = "4.1.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e299bf5ea7b212e811e71174c5d1a5d065c4c0ad0c8691ecb1f97e3e66025e" +checksum = "1e3c83c053b0713da60c5b8de47fe8e494fe3ece5267b2f23090a07a053ba8f3" dependencies = [ "bytecount", "memchr", @@ -831,9 +798,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -846,45 +813,33 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "numpy" version = "0.20.0" @@ -902,9 +857,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "oorandom" @@ -914,9 +869,9 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -924,28 +879,28 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.1", + "windows-targets", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", "indexmap", @@ -953,9 +908,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c516611246607d0c04186886dbb3a754368ef82c79e9827a802c6d836dd111c" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -965,9 +920,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "plotters" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" dependencies = [ "num-traits", "plotters-backend", @@ -978,15 +933,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" [[package]] name = "plotters-svg" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" dependencies = [ "plotters-backend", ] @@ -1020,28 +975,28 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.2.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", - "bitflags 1.3.2", - "byteorder", + "bit-vec", + "bitflags", "lazy_static", "num-traits", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.6.29", + "regex-syntax", "rusty-fork", "tempfile", "unarray", @@ -1105,10 +1060,10 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.86", "pyo3-macros-backend", - "quote 1.0.35", - "syn 2.0.48", + "quote 1.0.36", + "syn 2.0.68", ] [[package]] @@ -1118,10 +1073,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.78", + "proc-macro2 1.0.86", "pyo3-build-config", - "quote 1.0.35", - "syn 2.0.48", + "quote 1.0.36", + "syn 2.0.68", ] [[package]] @@ -1132,7 +1087,7 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quil-cli" -version = "0.2.1" +version = "0.3.1" dependencies = [ "anyhow", "clap", @@ -1141,7 +1096,7 @@ dependencies = [ [[package]] name = "quil-py" -version = "0.9.1" +version = "0.10.1" dependencies = [ "indexmap", "ndarray", @@ -1155,7 +1110,7 @@ dependencies = [ [[package]] name = "quil-rs" -version = "0.25.1" +version = "0.26.1" dependencies = [ "approx", "clap", @@ -1194,11 +1149,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.86", ] [[package]] @@ -1264,9 +1219,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -1274,71 +1229,63 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] name = "regex" -version = "1.9.3" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.7.4", + "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.7.4" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "relative-path" -version = "1.8.0" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf2521270932c3c7bed1a59151222bd7643c79310f2916f01925e1e16255698" +checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" [[package]] name = "rigetti-pyo3" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402e7e159c1a8b5fcd0a2bb7c9b6d50b25f9380a0ecb83930c1e907e3a9737db" +checksum = "c59068763670399bb3e895a17cc631d9214c3172b64fc74d3ab63dac7371c340" dependencies = [ "indexmap", "num-complex", @@ -1368,12 +1315,12 @@ checksum = "d428f8247852f894ee1be110b375111b586d4fa431f6c46e64ba5a0dcccbe605" dependencies = [ "cfg-if", "glob", - "proc-macro2 1.0.78", - "quote 1.0.35", + "proc-macro2 1.0.86", + "quote 1.0.36", "regex", "relative-path", "rustc_version", - "syn 2.0.48", + "syn 2.0.68", "unicode-ident", ] @@ -1394,22 +1341,22 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.7" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.3.3", + "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rusty-fork" @@ -1425,15 +1372,15 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "safe_arch" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +checksum = "c3460605018fdc9612bce72735cba0d27efbcd9904780d44c7e3a9948f96148a" dependencies = [ "bytemuck", ] @@ -1455,35 +1402,35 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.18" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ - "proc-macro2 1.0.78", - "quote 1.0.35", - "syn 2.0.48", + "proc-macro2 1.0.86", + "quote 1.0.36", + "syn 2.0.68", ] [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -1505,24 +1452,24 @@ dependencies = [ [[package]] name = "similar" -version = "2.2.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "static_assertions" @@ -1532,9 +1479,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "statrs" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d08e5e1748192713cc281da8b16924fb46be7b0c2431854eadc785823e5696e" +checksum = "b35a062dbadac17a42e0fc64c27f419b25d6fae98572eb43c8814c9e873d7721" dependencies = [ "approx", "lazy_static", @@ -1545,30 +1492,30 @@ dependencies = [ [[package]] name = "strsim" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.26.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.26.1" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.4.1", - "proc-macro2 1.0.78", - "quote 1.0.35", + "heck 0.5.0", + "proc-macro2 1.0.86", + "quote 1.0.36", "rustversion", - "syn 2.0.48", + "syn 2.0.68", ] [[package]] @@ -1588,59 +1535,58 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.78", - "quote 1.0.35", + "proc-macro2 1.0.86", + "quote 1.0.36", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.48" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ - "proc-macro2 1.0.78", - "quote 1.0.35", + "proc-macro2 1.0.86", + "quote 1.0.36", "unicode-ident", ] [[package]] name = "target-lexicon" -version = "0.12.11" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tempfile" -version = "3.7.1" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ - "proc-macro2 1.0.78", - "quote 1.0.35", - "syn 2.0.48", + "proc-macro2 1.0.86", + "quote 1.0.36", + "syn 2.0.68", ] [[package]] @@ -1686,9 +1632,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-xid" @@ -1704,9 +1650,9 @@ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "wait-timeout" @@ -1719,9 +1665,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -1735,9 +1681,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1745,53 +1691,53 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.78", - "quote 1.0.35", - "syn 2.0.48", + "proc-macro2 1.0.86", + "quote 1.0.36", + "syn 2.0.68", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ - "quote 1.0.35", + "quote 1.0.36", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ - "proc-macro2 1.0.78", - "quote 1.0.35", - "syn 2.0.48", + "proc-macro2 1.0.86", + "quote 1.0.36", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -1799,61 +1745,21 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.16" +version = "0.7.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a1851a719f11d1d2fea40e15c72f6c00de8c142d7ac47c1441cc7e4d0d5bc6" +checksum = "8a040b111774ab63a19ef46bbc149398ab372b4ccdcfd719e9814dbd7dfd76c8" dependencies = [ "bytemuck", "safe_arch", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.1", + "windows-sys", ] [[package]] @@ -1862,176 +1768,69 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows-targets" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" -dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" [[package]] -name = "windows_i686_gnu" -version = "0.48.0" +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/quil-rs/src/expression/mod.rs b/quil-rs/src/expression/mod.rs index dd37ed97..eadbe1b6 100644 --- a/quil-rs/src/expression/mod.rs +++ b/quil-rs/src/expression/mod.rs @@ -1009,8 +1009,8 @@ mod tests { #[test] fn specific_round_trip_tests() { for input in &[ - "-1*(phases[0]+phases[1])", - "(-1*(phases[0]+phases[1]))+(-1*(phases[0]+phases[1]))", + "-1*(phases+phases[1])", + "(-1*(phases+phases[1]))+(-1*(phases+phases[1]))", ] { let parsed = Expression::from_str(input); let parsed = parsed.unwrap(); diff --git a/quil-rs/src/instruction/declaration.rs b/quil-rs/src/instruction/declaration.rs index 3b17d723..fea888b5 100644 --- a/quil-rs/src/instruction/declaration.rs +++ b/quil-rs/src/instruction/declaration.rs @@ -201,6 +201,11 @@ impl Quil for MemoryReference { f: &mut impl std::fmt::Write, _fall_back_to_debug: bool, ) -> crate::quil::ToQuilResult<()> { + if self.index == 0 { + write!(f, "{}", self.name)?; + return Ok(()); + } + write!(f, "{}[{}]", self.name, self.index).map_err(Into::into) } } diff --git a/quil-rs/src/instruction/gate.rs b/quil-rs/src/instruction/gate.rs index 1aabd314..ed78b653 100644 --- a/quil-rs/src/instruction/gate.rs +++ b/quil-rs/src/instruction/gate.rs @@ -2,6 +2,8 @@ use crate::{ expression::Expression, imag, instruction::{write_expression_parameter_string, write_parameter_string, write_qubits, Qubit}, + parser::{gate::parse_gate, lex, ParseError}, + program::{disallow_leftover, SyntaxError}, quil::{write_join_quil, Quil}, real, validation::identifier::{ @@ -9,11 +11,13 @@ use crate::{ }, }; use ndarray::{array, linalg::kron, Array2}; +use nom_locate::LocatedSpan; use num_complex::Complex64; use once_cell::sync::Lazy; use std::{ cmp::Ordering, collections::{HashMap, HashSet}, + str::FromStr, }; /// A struct encapsulating all the properties of a Quil Quantum Gate. @@ -176,6 +180,16 @@ impl Gate { } } +impl FromStr for Gate { + type Err = SyntaxError; + + fn from_str(s: &str) -> Result { + let input = LocatedSpan::new(s); + let tokens = lex(input)?; + disallow_leftover(parse_gate(&tokens).map_err(ParseError::from_nom_internal_err)) + } +} + /// Lift a unitary matrix to act on the specified qubits in a full `n_qubits`-qubit Hilbert /// space. /// diff --git a/quil-rs/src/lib.rs b/quil-rs/src/lib.rs index 67361fc2..f7da6adf 100644 --- a/quil-rs/src/lib.rs +++ b/quil-rs/src/lib.rs @@ -31,6 +31,7 @@ //! [constructor for timing graphs]: crate::program::graph::ScheduledProgram#method.get_dot_format //! [expressions]: crate::expression::Expression //! [instructions]: crate::instruction::Instruction +//! [latex]: crate::program::latex::Latex#method.to_latex //! [parser]: crate::program::Program#method.from_str //! [programs]: crate::program::Program //! [serializer]: crate::program::Program#method.to_string diff --git a/quil-rs/src/parser/expression.rs b/quil-rs/src/parser/expression.rs index 63f73d62..52cc1dd6 100644 --- a/quil-rs/src/parser/expression.rs +++ b/quil-rs/src/parser/expression.rs @@ -284,7 +284,8 @@ mod tests { "%theta", "cis(%theta)", "%a+%b", - "(pi/2)+(1*theta[0])", + "(pi/2)+(1*theta)", + "(pi/2)+(1*theta[1])", "3 - -2", ]; diff --git a/quil-rs/src/parser/gate.rs b/quil-rs/src/parser/gate.rs index cf63079a..061f24fa 100644 --- a/quil-rs/src/parser/gate.rs +++ b/quil-rs/src/parser/gate.rs @@ -14,7 +14,7 @@ use nom::{combinator::opt, multi::many0, multi::separated_list0, sequence::delimited}; -use crate::{instruction::Instruction, token}; +use crate::token; use super::{ common::{self, parse_gate_modifier}, @@ -25,7 +25,7 @@ use crate::instruction::Gate; use crate::parser::InternalParserResult; /// Parse a gate instruction. -pub(crate) fn parse_gate<'a>(input: ParserInput<'a>) -> InternalParserResult<'a, Instruction> { +pub(crate) fn parse_gate<'a>(input: ParserInput<'a>) -> InternalParserResult<'a, Gate> { let (input, modifiers) = many0(parse_gate_modifier)(input)?; let (input, name) = token!(Identifier(v))(input)?; let (input, parameters) = opt(delimited( @@ -37,12 +37,12 @@ pub(crate) fn parse_gate<'a>(input: ParserInput<'a>) -> InternalParserResult<'a, let (input, qubits) = many0(common::parse_qubit)(input)?; Ok(( input, - Instruction::Gate(Gate { + Gate { name, parameters, qubits, modifiers, - }), + }, )) } @@ -50,7 +50,7 @@ pub(crate) fn parse_gate<'a>(input: ParserInput<'a>) -> InternalParserResult<'a, mod test { use super::parse_gate; use crate::expression::Expression; - use crate::instruction::{Gate, GateModifier, Instruction, Qubit}; + use crate::instruction::{Gate, GateModifier, Qubit}; use crate::make_test; use crate::parser::lexer::lex; @@ -58,11 +58,11 @@ mod test { test_modifiers, parse_gate, "DAGGER CONTROLLED RX(pi) 0 1", - Instruction::Gate(Gate { + Gate { name: "RX".to_string(), parameters: vec![Expression::PiConstant], qubits: vec![Qubit::Fixed(0), Qubit::Fixed(1)], modifiers: vec![GateModifier::Dagger, GateModifier::Controlled], - }) + } ); } diff --git a/quil-rs/src/parser/instruction.rs b/quil-rs/src/parser/instruction.rs index bfc42e05..a3ce5f14 100644 --- a/quil-rs/src/parser/instruction.rs +++ b/quil-rs/src/parser/instruction.rs @@ -13,7 +13,7 @@ // limitations under the License. use nom::{ - combinator::all_consuming, + combinator::{all_consuming, map}, multi::{many0, many1}, sequence::{delimited, preceded}, }; @@ -113,7 +113,9 @@ pub(crate) fn parse_instruction(input: ParserInput) -> InternalParserResult todo!(), }, - Some((Token::Identifier(_), _)) | Some((Token::Modifier(_), _)) => gate::parse_gate(input), + Some((Token::Identifier(_), _)) | Some((Token::Modifier(_), _)) => { + map(gate::parse_gate, Instruction::Gate)(input) + } Some((_, _)) => Err(nom::Err::Failure(InternalParseError::from_kind( &input[..1], ParserErrorKind::NotACommandOrGate, diff --git a/quil-rs/src/parser/mod.rs b/quil-rs/src/parser/mod.rs index 3983acb1..5129ded4 100644 --- a/quil-rs/src/parser/mod.rs +++ b/quil-rs/src/parser/mod.rs @@ -19,7 +19,7 @@ pub(crate) use instruction::parse_instructions; pub(crate) use lexer::lex; mod command; -mod gate; +pub(crate) mod gate; mod macros; pub(crate) mod common; diff --git a/quil-rs/src/program/latex/circuit.rs b/quil-rs/src/program/latex/circuit.rs new file mode 100644 index 00000000..731e2ff4 --- /dev/null +++ b/quil-rs/src/program/latex/circuit.rs @@ -0,0 +1,269 @@ +//! Higher-level construct which represents a program in a way that can be converted to a diagram. + +use std::collections::BTreeSet; + +use once_cell::sync::Lazy; +use regex::Regex; + +use crate::{ + instruction::{Gate, GateModifier, Instruction, Measurement, Qubit}, + quil::Quil, +}; + +use super::RenderSettings; + +#[derive(Debug)] +pub(super) enum CircuitElement { + SingleQubitGate { + dagger_count: u64, + name: String, + parameters: Vec, + qubit: u64, + controls: BTreeSet, + }, + Measurement { + qubit: u64, + }, +} + +impl Gate { + /// A single gate can be represented in multiple ways. This function converts the gate to one canonical form + /// for easier processing. + fn to_canonical_form(&self) -> Self { + let mut new = self.clone(); + + static ABBREVIATED_CONTROLLED_GATE: Lazy = + Lazy::new(|| Regex::new("(?PC+)(?PPHASE|X|Y|Z|NOT)").unwrap()); + + if let Some(captures) = ABBREVIATED_CONTROLLED_GATE.captures(&new.name) { + let count = captures.name("count").unwrap().as_str().len(); + let base = captures.name("base").unwrap().as_str(); + + new.name = base.to_string(); + new.modifiers.extend(vec![GateModifier::Controlled; count]); + } + + new + } + + /// Remove the qubits from the gate which are used as its control qubits, and + /// return them as a set. + /// + /// Return an error if any control qubit is also a target qubit. + fn extract_fixed_controls(&mut self) -> BuildCircuitResult> { + let mut control_count = 0; + + self.modifiers.retain(|modifier| { + if modifier == &GateModifier::Controlled { + control_count += 1; + false + } else { + true + } + }); + + let new_qubits = self.qubits.split_off(control_count); + let controls = self + .qubits + .iter() + .map(|qubit| match qubit { + Qubit::Fixed(index) => Ok(*index), + Qubit::Variable(_) | Qubit::Placeholder(_) => todo!(), + }) + .collect::, _>>()?; + + if let Some(overlap) = controls + .iter() + .find(|control| new_qubits.contains(&Qubit::Fixed(**control))) + { + return Err(BuildCircuitError::ControlAndTargetQubitOverlap { + qubit: Qubit::Fixed(*overlap), + }); + } + + self.qubits = new_qubits; + + Ok(controls) + } + + /// Remove the dagger modifiers from the gate and return their count. + fn extract_dagger_count(&mut self) -> u64 { + let mut count = 0; + + self.modifiers.retain(|modifier| { + if modifier == &GateModifier::Dagger { + count += 1; + false + } else { + true + } + }); + + count + } +} + +impl TryFrom<&Gate> for CircuitElement { + type Error = BuildCircuitError; + + fn try_from(gate: &Gate) -> Result { + let mut canonical_gate = gate.to_canonical_form(); + let controls = canonical_gate.extract_fixed_controls()?; + let dagger_count = canonical_gate.extract_dagger_count(); + + match canonical_gate.qubits.as_slice() { + &[Qubit::Fixed(qubit)] if canonical_gate.modifiers.is_empty() => { + Ok(Self::SingleQubitGate { + controls, + parameters: gate + .parameters + .iter() + .map(|p| p.to_quil_or_debug()) + .collect(), + dagger_count, + name: canonical_gate.name.clone(), + qubit, + }) + } + _ => Err(BuildCircuitError::UnsupportedGate { gate: gate.clone() }), + } + } +} + +impl TryFrom<&Measurement> for CircuitElement { + type Error = BuildCircuitError; + + fn try_from(measurement: &Measurement) -> Result { + match measurement.qubit { + Qubit::Fixed(qubit) => Ok(Self::Measurement { qubit }), + Qubit::Variable(_) | Qubit::Placeholder(_) => { + Err(BuildCircuitError::UnsupportedMeasurement { + measurement: measurement.clone(), + }) + } + } + } +} + +#[derive(Debug)] +pub(super) struct CircuitColumn { + // TODO: this could be Vec if we compress columns + pub element: CircuitElement, +} + +#[derive(Debug, Default)] +pub(super) struct Circuit { + pub columns: Vec, + + pub settings: RenderSettings, +} + +impl Circuit { + pub fn get_qubit_indices(&self) -> BTreeSet { + let mut indices = BTreeSet::new(); + + for column in &self.columns { + match &column.element { + CircuitElement::SingleQubitGate { + qubit, controls, .. + } => { + indices.insert(*qubit); + indices.extend(controls) + } + CircuitElement::Measurement { qubit } => { + indices.insert(*qubit); + } + } + } + + indices + } +} + +#[derive(Debug, thiserror::Error)] +#[non_exhaustive] +#[allow(clippy::enum_variant_names)] +pub enum BuildCircuitError { + #[error("control qubit {} is also a target qubit", qubit.to_quil_or_debug())] + ControlAndTargetQubitOverlap { qubit: Qubit }, + + #[error("cannot render gate as LaTeX: {gate:?}")] + UnsupportedGate { gate: Gate }, + + #[error("cannot render measurement as LaTeX: {measurement:?}")] + UnsupportedMeasurement { measurement: Measurement }, + + #[error("cannot render instruction as LaTeX: {}", instruction.to_quil_or_debug())] + UnsupportedInstruction { instruction: Instruction }, +} + +pub type BuildCircuitResult = Result; + +impl Circuit { + pub(super) fn try_from_program( + program: &crate::Program, + settings: RenderSettings, + ) -> BuildCircuitResult { + let mut circuit = Circuit { + settings, // TODO not ideal, reconsider how and when these should be used. Not all settings are inherent to the circuit's construction + ..Default::default() + }; + + for instruction in &program.to_instructions() { + let element = match instruction { + Instruction::Gate(gate) => gate.try_into().map(Some), + Instruction::Measurement(measurement) => measurement.try_into().map(Some), + Instruction::GateDefinition(_) | Instruction::Reset(_) => Ok(None), + _ => Err(BuildCircuitError::UnsupportedInstruction { + instruction: instruction.clone(), + }), + }?; + + if let Some(element) = element { + let column = CircuitColumn { element }; + + circuit.columns.push(column); + } + } + + Ok(circuit) + } +} + +#[cfg(test)] +mod tests { + use std::collections::BTreeSet; + + use rstest::rstest; + + use crate::{instruction::Gate, quil::Quil}; + + #[rstest] + #[case("CPHASE 0 1", "CONTROLLED PHASE 0 1")] + #[case("CZ 0 1", "CONTROLLED Z 0 1")] + #[case("DAGGER CZ 0 1", "DAGGER CONTROLLED Z 0 1")] + fn canonicalize_gate(#[case] input: &str, #[case] expected: &str) { + let input_gate = ::from_str(input).unwrap(); + let canonical = input_gate.to_canonical_form(); + assert_eq!(canonical.to_quil_or_debug().as_str(), expected); + } + + #[rstest] + #[case("CONTROLLED PHASE 1 0", "PHASE 0", vec![1])] + #[case("CONTROLLED CONTROLLED PHASE 2 1 0", "PHASE 0", vec![1, 2])] + #[case("CNOT 1 2", "NOT 2", vec![1])] + fn extract_controls( + #[case] input: &str, + #[case] expected: &str, + #[case] expected_controls: Vec, + ) { + let input_gate = ::from_str(input).unwrap(); + let mut canonical = input_gate.to_canonical_form(); + let controls = canonical.extract_fixed_controls().unwrap(); + assert_eq!(canonical.to_quil_or_debug().as_str(), expected); + assert_eq!( + controls, + expected_controls.into_iter().collect::>() + ); + } +} diff --git a/quil-rs/src/program/latex/diagram.rs b/quil-rs/src/program/latex/diagram.rs new file mode 100644 index 00000000..8c134cd4 --- /dev/null +++ b/quil-rs/src/program/latex/diagram.rs @@ -0,0 +1,406 @@ +use std::collections::{BTreeMap, BTreeSet, HashSet}; + +use super::{ + circuit::{Circuit, CircuitElement}, + RenderSettings, +}; + +// Write every element from an iterable +macro_rules! write_many { + ($f:expr, $iter:expr) => {{ + for item in $iter { + write!($f, "{item}")?; + } + + Ok(()) + }}; +} + +// Write every element from an iterable, wrapped with a left and right element +macro_rules! write_many_delimited { + ($f:expr, $left:expr, $iter:expr, $right: expr) => {{ + write!($f, "{}", $left)?; + + write_many!($f, $iter)?; + + write!($f, "{}", $right) + }}; +} + +/// Available commands used for building circuits with the same names taken +/// from the Quantikz documentation for easy reference. LaTeX string denoted +/// inside `backticks`. +/// +/// # Available Commands +/// +/// Single wire commands: lstick, gate, phase, super, qw, nr +/// Multi-wire commands: ctrl, targ +/// Ryan: derive_more::Display would be great here. All of the symbols are repeated between here and the display implementation +/// for discussion: tradeoffs of literal representation of Quantikz vs more ergonomics (both are acceptable, just consider the audience) +/// in our case, we don't expect this to be a general-purpose quantikz library, so it should be whatever makes this module most +/// readable. +#[derive(Clone, Debug)] +enum DiagramElement { + /// `\lstick{}`: Make a qubit "stick out" from the left. + /// + /// Example: `\lstick{\ket{q_{u32}}}` + Lstick(Vec), + /// `\gate{}`: Make a gate on the wire. + Gate(Vec), + /// `\phase{}`: Make a phase on the wire with a rotation + Phase(Vec), + /// `^{}`: Add a superscript to a gate + Super(Vec), + /// `\qw`: Connect the current cell to the previous cell i.e. "do nothing". + Qw, + /// `\\`: Start a new row + Nr, + /// `\ctrl{wire}`: Make a control qubit + Ctrl { + distance: i64, + }, + /// `\targ{}`: Make a controlled-not gate. + Targ, + + /// `&`: Start a new cell in the same row/wire + Ampersand, + + /// `\meter{}` - Measurement + Meter, + + Ket(String), + + Text(String), + + String(String), + + Dagger, + + Symbol(String), +} + +impl DiagramElement { + fn daggers(count: u64) -> Vec { + (0..count) + .map(|_| Self::Super(vec![Self::Dagger])) + .collect() + + // This would work fine IIUC but would not pass snapshot + // Self::Super(vec![Self::Dagger; count as usize]) + } + + fn texify_parameter(name: String) -> Self { + // TODO: make static + let supported = [ + "alpha", "beta", "gamma", "theta", "pi", //TODO + ] + .into_iter() + .collect::>(); + + if supported.contains(&name.as_str()) { + Self::Symbol(name) + } else { + Self::Text(name) + } + } + + fn parameters(parameters: Vec, settings: &RenderSettings) -> Vec { + if settings.texify_numerical_constants { + parameters.into_iter().map(Self::texify_parameter).collect() + } else { + parameters.into_iter().map(Self::Text).collect() + } + } + + fn gate( + name: String, + parameters: Vec, + dagger_count: u64, + controlled: bool, + settings: &RenderSettings, + ) -> Self { + match name.as_str() { + // TODO: DAGGER CPHASE? + "PHASE" if dagger_count == 0 => Self::Phase(Self::parameters(parameters, settings)), + // TODO: DAGGER NOT? + "NOT" | "X" if dagger_count == 0 && controlled => Self::Targ, + _ => { + let mut gate_elements = vec![DiagramElement::String(name)]; + gate_elements.append(&mut DiagramElement::daggers(dagger_count)); + // if !parameters.is_empty() //TODO + + Self::Gate(gate_elements) + } + } + } + + fn qubit(index: u64) -> Self { + Self::Ket(format!("q_{{{index}}}")) + } +} + +impl std::fmt::Display for DiagramElement { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + DiagramElement::Lstick(wire) => { + write!(f, r#"\lstick{{"#)?; + write_many!(f, wire)?; + write!(f, "}}") + } + DiagramElement::Gate(elements) => { + write!(f, r"\gate{{")?; + write_many!(f, elements)?; + write!(f, "}}") + } + DiagramElement::Phase(inner) => write_many_delimited!(f, r"\phase{", inner, "}"), + DiagramElement::Super(inner) => write_many_delimited!(f, r"^{", inner, "}"), + DiagramElement::Qw => write!(f, r"\qw"), + DiagramElement::Nr => write!(f, r"\\"), + DiagramElement::Ctrl { distance } => write!(f, r#"\ctrl{{{distance}}}"#), + DiagramElement::Targ => write!(f, r"\targ{{}}"), + DiagramElement::Ampersand => write!(f, "&"), + DiagramElement::Meter => write!(f, r"\meter{{}}"), + DiagramElement::Ket(contents) => write!(f, r"\ket{{{contents}}}"), + DiagramElement::Text(string) => write!(f, r"\text{{{string}}}"), + DiagramElement::Dagger => write!(f, r"\dagger"), + DiagramElement::String(string) => write!(f, "{string}"), + DiagramElement::Symbol(inner) => write!(f, r#"\{inner}"#), + } + } +} + +#[derive(Debug)] +pub struct Diagram { + footer: Option, + header: Option, + wires: BTreeMap, +} + +impl Diagram { + const DEFAULT_FOOTER: &'static str = r"\end{tikzcd} +\end{document}"; + + const DEFAULT_HEADER: &'static str = r"\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd}"; + + fn push_to_cell(&mut self, row: u64, column: u64, element: DiagramElement) { + self.wires + .entry(row) + .or_default() + .push_at_column(column, element); + } + + fn from_qubit_indices(qubits: I) -> Self + where + I: IntoIterator, + { + let mut diagram = Self::default(); + for qubit in qubits { + diagram.wires.insert(qubit, DiagramWire::default()); + } + + diagram + } + + fn with_default_header_and_footer(&mut self) { + self.with_footer(Self::DEFAULT_FOOTER); + self.with_header(Self::DEFAULT_HEADER); + } + + fn with_header(&mut self, header: S) + where + S: Into, + { + self.header = Some(header.into()) + } + + fn with_footer(&mut self, footer: S) + where + S: Into, + { + self.footer = Some(footer.into()) + } +} + +impl Default for Diagram { + fn default() -> Self { + let mut new = Self { + footer: None, + header: None, + wires: Default::default(), + }; + new.with_default_header_and_footer(); + new + } +} + +impl std::fmt::Display for Diagram { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if let Some(header) = &self.header { + writeln!(f, "{header}")?; + } + + let column_count = self + .wires + .values() + .filter_map(|wire| wire.elements.last_key_value().map(|(k, _)| *k)) + .max() + .unwrap_or(0); + + if !self.wires.is_empty() { + let mut wires = self.wires.values().peekable(); + + while let Some(wire) = wires.next() { + wire.fmt(f, column_count)?; + + if wires.peek().is_some() { + writeln!(f, " {}", DiagramElement::Nr)?; + } + } + + writeln!(f)?; + } + + if let Some(footer) = &self.footer { + write!(f, "{footer}")?; + } + + Ok(()) + } +} + +impl From for Diagram { + fn from(circuit: Circuit) -> Self { + let qubit_indices = circuit.get_qubit_indices(); + + let mut diagram = if circuit.settings.impute_missing_qubits { + get_set_min_and_max_values(&qubit_indices) + .map(|(&min, &max)| Diagram::from_qubit_indices(min..=max)) + .unwrap_or_default() + } else { + Diagram::from_qubit_indices(qubit_indices.iter().cloned()) + }; + + for (column_index, column) in circuit.columns.into_iter().enumerate() { + match column.element { + CircuitElement::SingleQubitGate { + dagger_count, + parameters, + name, + qubit, + controls, + } => { + let gate_element = DiagramElement::gate( + name, + parameters, + dagger_count, + !controls.is_empty(), + &circuit.settings, + ); + diagram.push_to_cell(qubit, column_index as u64, gate_element); + + for control in controls { + let distance = if qubit > control { + diagram.wires.range(control..qubit).count() as i64 + } else { + -(diagram.wires.range(qubit..control).count() as i64) + }; + + diagram.push_to_cell( + control, + column_index as u64, + DiagramElement::Ctrl { distance }, + ); + } + } + CircuitElement::Measurement { qubit } => { + diagram.push_to_cell(qubit, column_index as u64, DiagramElement::Meter) + } + } + + if circuit.settings.label_qubit_lines { + for (qubit, wire) in &mut diagram.wires { + wire.label_left = vec![DiagramElement::qubit(*qubit)] + } + } + } + + diagram + } +} + +/// Wire == row +#[derive(Debug, Default)] +struct DiagramWire { + pub label_left: Vec, + pub elements: BTreeMap>, // TODO: this could result in an invalid state, ie with lstick in the middle of a diagram (that's invalid, right?) +} + +impl DiagramWire { + fn push_at_column(&mut self, column: u64, element: DiagramElement) { + self.elements.entry(column).or_default().push(element); + } +} + +impl DiagramWire { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>, column_count: u64) -> std::fmt::Result { + if self.label_left.is_empty() { + write!(f, "{} &", DiagramElement::Qw)?; + } else { + write!(f, "{} &", DiagramElement::Lstick(self.label_left.clone()))?; + } + + let mut last_column_index: i64 = -1; + let mut elements = self.elements.iter().peekable(); + + while let Some((&column, cell_elements)) = elements.next() { + let gap = column as i64 - last_column_index; + + if cell_elements.is_empty() { + continue; + } + + for _ in 1..gap { + write!(f, " {} {}", DiagramElement::Qw, DiagramElement::Ampersand)?; + } + + for element in cell_elements { + write!(f, " {element}")?; + } + + if elements.peek().is_some() { + write!(f, " {}", DiagramElement::Ampersand)?; + } + + last_column_index = column as i64; + } + + if last_column_index <= column_count as i64 { + // Handle the first column specially; no leading ampersand needed + if last_column_index == -1 { + write!(f, " {}", DiagramElement::Qw)?; + last_column_index = 0; + } + + for _ in last_column_index..=(column_count as i64) { + write!(f, " {} {}", DiagramElement::Ampersand, DiagramElement::Qw,)?; + } + } + + Ok(()) + } +} + +fn get_set_min_and_max_values(set: &BTreeSet) -> Option<(&T, &T)> { + if set.is_empty() { + None + } else { + let min = set.iter().next().unwrap(); + let max = set.iter().next_back().unwrap(); + Some((min, max)) + } +} diff --git a/quil-rs/src/program/latex/mod.rs b/quil-rs/src/program/latex/mod.rs new file mode 100644 index 00000000..1b197519 --- /dev/null +++ b/quil-rs/src/program/latex/mod.rs @@ -0,0 +1,549 @@ +//! LaTeX circuit generation for quil programs. +//! +//! This module enables generating quantum circuits using the LaTeX subpackage +//! TikZ/[`Quantikz`] for a given quil [`Program`]. This feature is callable on +//! [`Program`] and returns a LaTeX string which can be rendered in a LaTeX +//! visualization tool. Be aware that not all Programs can be serialized as +//! LaTeX. If a [`Program`] contains a gate or modifier not mentioned in the +//! [Supported Gates and Modifiers](#supported-gates-and-modifiers) section +//! below, unexpected results may occur, one of which includes producing +//! incorrect quantum circuits, or an error will be returned detailing which +//! instruction or gate is unsupported in the Program being processed. +//! +//! # Supported Gates and Modifiers +//! +//! - Pauli Gates: `I`, `X`, `Y`, `Z` +//! - Hadamard Gate: `H` +//! - Phase Gate: `PHASE`, `S`, `T` +//! - Controlled Phase Gate: `CZ`, `CPHASE` +//! - Controlled X Gates: `CNOT`, `CCNOT` +//! - User-Defined Gates: `DEFGATE` +//! - Modifiers: `CONTROLLED`, `DAGGER` +//! +//! [`Quantikz`]: https://arxiv.org/pdf/1809.03842.pdf + +mod circuit; +mod diagram; + +use crate::Program; + +use self::circuit::Circuit; + +/// Supported Greek and alphanumeric symbols. +#[derive(Clone, Debug)] +enum Symbol { + Alpha, + Beta, + Gamma, + Phi, + Pi, + Text(String), +} + +impl std::fmt::Display for Symbol { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Symbol::Alpha => write!(f, r"\alpha"), + Symbol::Beta => write!(f, r"\beta"), + Symbol::Gamma => write!(f, r"\gamma"), + Symbol::Phi => write!(f, r"\phi"), + Symbol::Pi => write!(f, r"\pi"), + Symbol::Text(text) => write!(f, r#"\text{{{}}}"#, text), + } + } +} + +impl From for Symbol { + fn from(text: String) -> Self { + match text.as_str() { + "alpha" => Symbol::Alpha, + "beta" => Symbol::Beta, + "gamma" => Symbol::Gamma, + "phi" => Symbol::Phi, + "pi" => Symbol::Pi, + _ => Symbol::Text(text), + } + } +} + +/// RenderSettings contains the metadata that allows the user to customize how +/// the circuit is rendered or use the default implementation. +#[derive(Clone, Copy, Debug)] +pub struct RenderSettings { + /// Convert numerical constants, e.g. pi, to LaTeX form. + pub texify_numerical_constants: bool, + /// Include all qubits implicitly referenced in the Quil program. + pub impute_missing_qubits: bool, + /// Label qubit lines. + pub label_qubit_lines: bool, + /// Write controlled rotations in compact form. + pub abbreviate_controlled_rotations: bool, + /// Extend the length of open wires at the right of the diagram. + pub qubit_line_open_wire_length: u32, + /// Align measurement operations to appear at the end of the diagram. + pub right_align_terminal_measurements: bool, +} + +impl Default for RenderSettings { + /// Returns the default RenderSettings. + fn default() -> Self { + Self { + // true: pi is π. + texify_numerical_constants: true, + // true: `CNOT 0 2` would have three qubit lines: 0, 1, 2. + impute_missing_qubits: false, + // false: remove Lstick/Rstick from latex. + label_qubit_lines: true, + // true: `RX(pi)` displayed as `X_{\\pi}` instead of `R_X(\\pi)`. + abbreviate_controlled_rotations: false, + // 0: condenses the size of subdiagrams. + qubit_line_open_wire_length: 1, + // false: include Meter in the current column. + right_align_terminal_measurements: true, + } + } +} + +#[derive(Clone, Debug, thiserror::Error)] +pub enum LatexGenError { + #[error("Found a target qubit with no control qubit.")] + FoundTargetWithNoControl, + #[error("The FORKED modifier is unsupported.")] + UnsupportedModifierForked, + #[error("This instruction is unsupported: {instruction}.")] + UnsupportedInstruction { instruction: String }, + #[error("This gate is unsupported: {gate}.")] + UnsupportedGate { gate: String }, +} + +pub trait ToLatex { + fn to_latex(self, settings: RenderSettings) -> Result; +} + +impl ToLatex for Program { + /// Returns a Result containing a quil [`Program`] as a LaTeX string or a + /// [`LatexGenError`]. + /// + /// This implementation of Latex can be viewed as a self-contained partial + /// implementation of ``Quantikz`` with all available commands listed as + /// variants in a Command enum. View ``Quantikz`` documentation for more + /// information. + /// + /// # Arguments + /// `settings` - Customizes the rendering of a circuit. + /// + /// # Examples + /// ``` + /// // To LaTeX for the Bell State Program. + /// use quil_rs::{Program, program::latex::{RenderSettings, ToLatex}}; + /// use std::str::FromStr; + /// let program = Program::from_str("H 0\nCNOT 0 1").expect(""); + /// let latex = program.to_latex(RenderSettings::default()).expect(""); + /// ``` + /// + /// ``` + /// // To LaTeX for the Toffoli Gate Program. + /// use quil_rs::{Program, program::latex::{RenderSettings, ToLatex}}; + /// use std::str::FromStr; + /// let program = Program::from_str("CONTROLLED CNOT 2 1 0").expect(""); + /// let latex = program.to_latex(RenderSettings::default()).expect(""); + /// ``` + /// + /// Ryan: this should take &self, no need for latex generation to consume a program + /// esp if it fails to render + fn to_latex(self, settings: RenderSettings) -> Result { + let circuit = Circuit::try_from_program(&self, settings).unwrap(); // TODO: error + let diagram = diagram::Diagram::from(circuit); + Ok(diagram.to_string()) + } +} + +#[cfg(test)] +mod tests { + use super::{RenderSettings, ToLatex}; + use crate::Program; + use std::str::FromStr; + + /// Helper function takes instructions and return the LaTeX using the + /// Latex::to_latex method. + fn get_latex(instructions: &str, settings: RenderSettings) -> String { + let program = Program::from_str(instructions).expect("Program should be returned"); + program + .to_latex(settings) + .expect("Program conversion to LaTeX should succeed") + } + + #[test] + /// Test functionality of to_latex using default settings. + fn test_to_latex() { + let latex = get_latex( + "H 0\nCNOT 0 1", + RenderSettings { + impute_missing_qubits: true, + ..Default::default() + }, + ); + + println!("{latex}"); + } + + /// Test module for the Document + mod document { + use crate::program::latex::{tests::get_latex, RenderSettings}; + + #[test] + fn test_template() { + insta::assert_snapshot!(get_latex("", RenderSettings::default())); + } + } + + /// Test module for gates + mod gates { + use crate::program::latex::{tests::get_latex, RenderSettings}; + + #[test] + fn test_gate_x() { + insta::assert_snapshot!(get_latex("X 0", RenderSettings::default())); + } + + #[test] + fn test_gate_y() { + insta::assert_snapshot!(get_latex("Y 1", RenderSettings::default())); + } + + #[test] + fn test_gates_x_and_y_single_qubit() { + insta::assert_snapshot!(get_latex("X 0\nY 0", RenderSettings::default())); + } + + #[test] + fn test_gates_x_and_y_two_qubits() { + insta::assert_snapshot!(get_latex("X 0\nY 1", RenderSettings::default())); + } + + #[test] + fn test_gates_phase_pi_rotation() { + insta::assert_snapshot!(get_latex("PHASE(pi) 0", RenderSettings::default())); + } + + #[test] + fn test_gates_cnot_ctrl_0_targ_1() { + insta::assert_snapshot!(get_latex("CNOT 0 1", RenderSettings::default())); + } + + #[test] + fn test_gates_cnot_ctrl_1_targ_0() { + insta::assert_snapshot!(get_latex("CNOT 1 0", RenderSettings::default())); + } + + #[test] + #[should_panic] + fn test_gates_cnot_error_single_qubit() { + get_latex("CNOT 0 0", RenderSettings::default()); + } + + #[test] + fn test_gates_h_and_cnot_ctrl_0_targ_1() { + insta::assert_snapshot!(get_latex("H 0\nCNOT 0 1", RenderSettings::default())); + } + + #[test] + fn test_gates_h_and_cnot_ctrl_1_targ_0() { + insta::assert_snapshot!(get_latex("H 1\nCNOT 1 0", RenderSettings::default())); + } + + #[test] + fn test_gate_toffoli() { + insta::assert_snapshot!(get_latex("CCNOT 1 2 0", RenderSettings::default())); + } + + #[test] + fn test_gate_ccnot_and_controlled_cnot_equality() { + let ccnot = get_latex("CCNOT 1 2 0", RenderSettings::default()); + + let controlled = get_latex("CONTROLLED CNOT 1 2 0", RenderSettings::default()); + + assert_eq!(ccnot, controlled); + } + + #[test] + fn test_gate_cphase() { + insta::assert_snapshot!(get_latex("CPHASE(pi) 0 1", RenderSettings::default())); + } + + #[test] + fn test_gate_cz() { + insta::assert_snapshot!(get_latex("CZ 0 1", RenderSettings::default())); + } + } + + /// Test module for modifiers + mod modifiers { + use crate::program::latex::{tests::get_latex, RenderSettings}; + + #[test] + fn test_modifier_toffoli_gate() { + insta::assert_snapshot!(get_latex( + "CONTROLLED CNOT 2 1 0", + RenderSettings::default() + )); + } + + #[test] + fn test_modifier_controlled_cnot_and_ccnot_equality() { + let controlled = get_latex("CONTROLLED CNOT 2 1 0", RenderSettings::default()); + + let ccnot = get_latex("CCNOT 2 1 0", RenderSettings::default()); + + assert_eq!(controlled, ccnot); + } + + #[test] + fn test_modifier_dagger() { + insta::assert_snapshot!(get_latex("DAGGER X 0", RenderSettings::default())); + } + + #[test] + fn test_modifier_dagger_dagger() { + insta::assert_snapshot!(get_latex("DAGGER DAGGER Y 0", RenderSettings::default())); + } + + #[test] + fn test_modifier_dagger_cz() { + insta::assert_snapshot!(get_latex("DAGGER CZ 0 1", RenderSettings::default())); + } + } + + /// Test module for RenderSettings + mod settings { + use crate::program::latex::{tests::get_latex, RenderSettings}; + + #[test] + fn test_settings_texify_numerical_constants_true_supported_symbol() { + // default texify_numerical_constants is true + let settings = RenderSettings { + ..Default::default() + }; + insta::assert_snapshot!(get_latex("CPHASE(alpha) 0 1", settings)); + } + + #[test] + fn test_settings_texify_numerical_constants_false_supported_symbol() { + let settings = RenderSettings { + texify_numerical_constants: false, + ..Default::default() + }; + insta::assert_snapshot!(get_latex("CPHASE(alpha) 0 1", settings)); + } + + #[test] + fn test_settings_texify_numerical_constants_unsupported_symbol() { + // default texify_numerical_constants is true + let settings_true = RenderSettings { + ..Default::default() + }; + + let unsupported_true = get_latex("CPHASE(chi) 0 1", settings_true); + + let settings_false = RenderSettings { + texify_numerical_constants: false, + ..Default::default() + }; + + let unsupported_false = get_latex("CPHASE(chi) 0 1", settings_false); + + // unsupported symbols are treated as text regardless of setting + assert_eq!(unsupported_true, unsupported_false); + } + + #[test] + fn test_settings_label_qubit_lines_false() { + let settings = RenderSettings { + label_qubit_lines: false, + ..Default::default() + }; + insta::assert_snapshot!(get_latex("H 0\nCNOT 0 1", settings)); + } + + #[test] + fn test_settings_impute_missing_qubits_true_ctrl_less_than_targ() { + let settings = RenderSettings { + impute_missing_qubits: true, + ..Default::default() + }; + insta::assert_snapshot!(get_latex("H 0\nCNOT 0 3", settings)); + } + + #[test] + fn test_settings_impute_missing_qubits_true_ctrl_greater_than_targ() { + let settings = RenderSettings { + impute_missing_qubits: true, + ..Default::default() + }; + insta::assert_snapshot!(get_latex("H 5\nCNOT 5 2", settings)); + } + } + + /// Test various programs for LaTeX accuracy + mod programs { + use crate::program::latex::{tests::get_latex, RenderSettings}; + + #[test] + fn test_program_h0_cnot01_x1_cnot12() { + let settings = RenderSettings { + ..Default::default() + }; + insta::assert_snapshot!(get_latex("H 0\nCNOT 0 1\nX 1\nCNOT 1 2", settings)); + } + + #[test] + fn test_program_h5_cnot52_y2_cnot23() { + let settings = RenderSettings { + ..Default::default() + }; + insta::assert_snapshot!(get_latex("H 5\nCNOT 5 2\nY 2\nCNOT 2 3", settings)); + } + + #[test] + fn test_program_good_modifiers() { + let latex = get_latex( + r#"Y 0 +CONTROLLED Y 0 1 +CONTROLLED CONTROLLED Y 0 1 2 +CONTROLLED CONTROLLED CONTROLLED Y 0 1 2 3 + +DAGGER Y 0 +DAGGER DAGGER Y 0 +DAGGER DAGGER DAGGER Y 0 + +CONTROLLED DAGGER Y 0 1 +CONTROLLED DAGGER CONTROLLED Y 0 1 2 +CONTROLLED DAGGER CONTROLLED DAGGER Y 0 1 2 + +DEFGATE G: + 1, 0 + 0, 1 + +CONTROLLED G 0 1 +DAGGER G 0"#, + RenderSettings::default(), + ); + + insta::assert_snapshot!(latex); + } + + #[test] + fn test_program_good_simple_params() { + insta::assert_snapshot!(get_latex( + "CPHASE(1.0) 0 1\nCPHASE(1.0-2.0i) 1 0", + RenderSettings::default() + )); + } + + #[test] + fn test_program_good_complex_params() { + insta::assert_snapshot!(get_latex( + "CPHASE(pi/2) 1 0\nCPHASE(cos(sin(2*pi/3))*cis(-1)*exp(i*pi)) 3 4", + RenderSettings::default() + )); + } + + #[test] + fn test_program_good_basic_defgate() { + let latex = get_latex( + r#"DEFGATE H0: + 0.707, 0.707 + 0.707, -0.707 + +DEFGATE H1: + 1/sqrt(2), 1/sqrt(2) + 1/sqrt(2), -1/sqrt(2) + +H0 0 +H1 1"#, + RenderSettings::default(), + ); + + insta::assert_snapshot!(latex); + } + + #[test] + fn test_program_good_defgate_with_long_name() { + let latex = get_latex( + r#"DEFGATE ______________________________________ugly-python-convention______________________________________: + 1, 0 + 0, 1 + +______________________________________ugly-python-convention______________________________________ 0 +______________________________________ugly-python-convention______________________________________ 1"#, + RenderSettings::default(), + ); + + insta::assert_snapshot!(latex); + } + } + + /// Test module for unsupported programs + mod unsupported { + use crate::program::latex::{tests::get_latex, RenderSettings}; + + #[test] + #[should_panic] + fn test_supported_misc_instructions() { + get_latex("NOP\nWAIT\nRESET\nHALT", RenderSettings::default()); + } + + #[test] + #[should_panic] + fn test_supported_measure() { + get_latex( + "DECLARE ro BIT\nMEASURE 0\nMEASURE 1 ro[0]", + RenderSettings::default(), + ); + } + + #[test] + #[should_panic] + fn test_supported_program_defcircuit() { + get_latex( + r#"DEFCIRCUIT EULER(%alpha, %beta, %gamma) q: + RX(%alpha) q + RY(%beta) q + RZ(%gamma) q +EULER(pi, 2*pi, 3*pi/2) 0"#, + RenderSettings::default(), + ); + } + + #[test] + #[should_panic] + fn test_supported_gate_rotation() { + get_latex( + r#"DECLARE ro BIT[1] +DECLARE theta REAL[1] +RX(pi/2) 0 +RZ(theta) 0 +RY(-pi/2) 0"#, + RenderSettings::default(), + ); + } + + #[test] + #[should_panic] + fn test_supported_arithmetic_instruction() { + get_latex( + "DECLARE b BIT\nDECLARE theta REAL\nMOVE theta -3.14\nLT b theta -3.14", + RenderSettings::default(), + ); + } + + #[test] + #[should_panic] + fn test_supported_modifier_forked() { + get_latex( + "FORKED CONTROLLED FORKED RX(a,b,c,d) 0 1 2 3", + RenderSettings::default(), + ); + } + } +} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_cnot_target.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_cnot_target.snap new file mode 100644 index 00000000..b7baa2ee --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_cnot_target.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 213 +expression: "Command::get_command(Command::Targ)" +--- +\targ{} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_control.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_control.snap new file mode 100644 index 00000000..2a762b12 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_control.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 208 +expression: "Command::get_command(Command::Ctrl(0))" +--- +\ctrl{0} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_gate.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_gate.snap new file mode 100644 index 00000000..71a30ac3 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_gate.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 311 +expression: "Command::get_command(Command::Gate(\"X\".to_string()))" +--- +\gate{X} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_left_ket.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_left_ket.snap new file mode 100644 index 00000000..1b0e0582 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_left_ket.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 188 +expression: "Command::get_command(Command::Lstick(0))" +--- +\lstick{\ket{q_{0}}} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_nr.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_nr.snap new file mode 100644 index 00000000..85810332 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_nr.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 473 +expression: "r\"\\\\\"" +--- +\\ diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_phase.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_phase.snap new file mode 100644 index 00000000..c39e71bf --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_phase.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 903 +expression: "r#\"\\phase{\\pi}\"#" +--- +\phase{\pi} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_qw.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_qw.snap new file mode 100644 index 00000000..4c5f0b43 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_qw.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 198 +expression: "Command::get_command(Command::Qw)" +--- +\qw diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_super.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_super.snap new file mode 100644 index 00000000..85b08907 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__commands__command_super.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 909 +expression: "r#\"^{\\dagger}\"#" +--- +^{\dagger} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__body_default.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__body_default.snap new file mode 100644 index 00000000..4c720ae9 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__body_default.snap @@ -0,0 +1,6 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 219 +expression: "r\"\"" +--- + diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__footer.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__footer.snap new file mode 100644 index 00000000..a5a39950 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__footer.snap @@ -0,0 +1,7 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 224 +expression: "r\"\\end{tikzcd}\n\\end{document}\"" +--- +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__header.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__header.snap new file mode 100644 index 00000000..f5e7a774 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__header.snap @@ -0,0 +1,11 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 207 +expression: "r\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\"" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__template.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__template.snap new file mode 100644 index 00000000..baa6556b --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__document__template.snap @@ -0,0 +1,13 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 397 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_controlled.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_controlled.snap new file mode 100644 index 00000000..14a6b082 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_controlled.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex.rs +assertion_line: 104 +expression: latex +--- +\[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{2}}} & \gate{H} & \qw \\ +\lstick{\ket{q_{3}}} & \ctrl{-1} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_cphase.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_cphase.snap new file mode 100644 index 00000000..491baf03 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_cphase.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 841 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\phase{\\pi} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{1}}} & \phase{\pi} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_cz.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_cz.snap new file mode 100644 index 00000000..414cf613 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_cz.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 846 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\gate{Z} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{1}}} & \gate{Z} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_toffoli.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_toffoli.snap new file mode 100644 index 00000000..5aaf5810 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_toffoli.snap @@ -0,0 +1,16 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 723 +expression: "get_latex(\"CCNOT 1 2 0\", Settings::default())" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \targ{} & \qw \\ +\lstick{\ket{q_{1}}} & \ctrl{-1} & \qw \\ +\lstick{\ket{q_{2}}} & \ctrl{-2} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_x.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_x.snap new file mode 100644 index 00000000..d0f3d928 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_x.snap @@ -0,0 +1,14 @@ +--- +source: src/program/latex.rs +assertion_line: 77 +expression: "r\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{X} & \\qw\n\\end{tikzcd}\n\\end{document}\"" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{X} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_y.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_y.snap new file mode 100644 index 00000000..ac88ea92 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gate_y.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex.rs +assertion_line: 82 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{1}}} & \\gate{Y} & \\qw\n\\end{tikzcd}\n\\end{document}\n\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{1}}} & \gate{Y} & \qw +\end{tikzcd} +\end{document} + diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_cnot_ctrl_0_targ_1.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_cnot_ctrl_0_targ_1.snap new file mode 100644 index 00000000..26753a91 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_cnot_ctrl_0_targ_1.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 449 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\targ{} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{1}}} & \targ{} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_cnot_ctrl_1_targ_0.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_cnot_ctrl_1_targ_0.snap new file mode 100644 index 00000000..380d94b2 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_cnot_ctrl_1_targ_0.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 532 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\targ{} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\ctrl{-1} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \targ{} & \qw \\ +\lstick{\ket{q_{1}}} & \ctrl{-1} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_h_and_cnot_ctrl_0_targ_1.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_h_and_cnot_ctrl_0_targ_1.snap new file mode 100644 index 00000000..0cbecae8 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_h_and_cnot_ctrl_0_targ_1.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 583 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{H} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\qw & \\targ{} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{H} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{1}}} & \qw & \targ{} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_h_and_cnot_ctrl_1_targ_0.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_h_and_cnot_ctrl_1_targ_0.snap new file mode 100644 index 00000000..c8ff5398 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_h_and_cnot_ctrl_1_targ_0.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 588 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\qw & \\targ{} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\gate{H} & \\ctrl{-1} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \qw & \targ{} & \qw \\ +\lstick{\ket{q_{1}}} & \gate{H} & \ctrl{-1} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_phase_pi_rotation.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_phase_pi_rotation.snap new file mode 100644 index 00000000..aed319c5 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_phase_pi_rotation.snap @@ -0,0 +1,14 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 827 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\phase{\\pi} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \phase{\pi} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_x_and_y_single_qubit.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_x_and_y_single_qubit.snap new file mode 100644 index 00000000..ec23cf73 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_x_and_y_single_qubit.snap @@ -0,0 +1,14 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 434 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{X} & \\gate{Y} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{X} & \gate{Y} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_x_and_y_two_qubits.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_x_and_y_two_qubits.snap new file mode 100644 index 00000000..f8fc7c46 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__gates_x_and_y_two_qubits.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 978 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{X} & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\qw & \\gate{Y} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{X} & \qw & \qw \\ +\lstick{\ket{q_{1}}} & \qw & \gate{Y} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__text_gates_x_and_y_single_qubit.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__text_gates_x_and_y_single_qubit.snap new file mode 100644 index 00000000..5f2c719e --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__gates__text_gates_x_and_y_single_qubit.snap @@ -0,0 +1,14 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 366 +expression: "r\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{X} & \\gate{Y} & \\qw \\\\\n\\end{tikzcd}\n\\end{document}\".to_string()" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{X} & \gate{Y} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger.snap new file mode 100644 index 00000000..e1681412 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger.snap @@ -0,0 +1,14 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 936 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{X^{\\dagger}} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{X^{\dagger}} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger_cz.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger_cz.snap new file mode 100644 index 00000000..70f79e41 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger_cz.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 958 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\gate{Z^{\\dagger}} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{1}}} & \gate{Z^{\dagger}} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger_dagger.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger_dagger.snap new file mode 100644 index 00000000..80614e75 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_dagger_dagger.snap @@ -0,0 +1,14 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 942 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{Y^{\\dagger}^{\\dagger}} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{Y^{\dagger}^{\dagger}} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_toffoli_gate.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_toffoli_gate.snap new file mode 100644 index 00000000..c56ba8ef --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__modifiers__modifier_toffoli_gate.snap @@ -0,0 +1,16 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 750 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\targ{} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\ctrl{-1} & \\qw \\\\\n\\lstick{\\ket{q_{2}}} & \\ctrl{-2} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \targ{} & \qw \\ +\lstick{\ket{q_{1}}} & \ctrl{-1} & \qw \\ +\lstick{\ket{q_{2}}} & \ctrl{-2} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_basic_defgate.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_basic_defgate.snap new file mode 100644 index 00000000..01fcbbcf --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_basic_defgate.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 1276 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{H0} & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\qw & \\gate{H1} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{H0} & \qw & \qw \\ +\lstick{\ket{q_{1}}} & \qw & \gate{H1} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_complex_params.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_complex_params.snap new file mode 100644 index 00000000..b63be7b9 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_complex_params.snap @@ -0,0 +1,16 @@ +--- +source: quil-rs/src/program/latex/mod.rs +expression: "get_latex(\"CPHASE(pi/2) 1 0\\nCPHASE(cos(sin(2*pi/3))*cis(-1)*exp(i*pi)) 3 4\",\n RenderSettings::default())" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \phase{\text{pi/2}} & \qw & \qw \\ +\lstick{\ket{q_{1}}} & \ctrl{-1} & \qw & \qw \\ +\lstick{\ket{q_{3}}} & \qw & \ctrl{1} & \qw \\ +\lstick{\ket{q_{4}}} & \qw & \phase{\text{(cos(sin((2*pi)/3))*cis(-1))*exp(1.0i*pi)}} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_defgate_with_long_name.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_defgate_with_long_name.snap new file mode 100644 index 00000000..1d20ddad --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_defgate_with_long_name.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 1318 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{______________________________________ugly-python-convention______________________________________} & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\qw & \\gate{______________________________________ugly-python-convention______________________________________} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{______________________________________ugly-python-convention______________________________________} & \qw & \qw \\ +\lstick{\ket{q_{1}}} & \qw & \gate{______________________________________ugly-python-convention______________________________________} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_modifiers.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_modifiers.snap new file mode 100644 index 00000000..06daf2db --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_modifiers.snap @@ -0,0 +1,17 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 1005 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{Y} & \\ctrl{1} & \\ctrl{2} & \\ctrl{3} & \\gate{Y^{\\dagger}} & \\gate{Y^{\\dagger}^{\\dagger}} & \\gate{Y^{\\dagger}^{\\dagger}^{\\dagger}} & \\ctrl{1} & \\ctrl{2} & \\ctrl{2} & \\ctrl{1} & \\gate{G^{\\dagger}} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\qw & \\gate{Y} & \\ctrl{1} & \\ctrl{2} & \\qw & \\qw & \\qw & \\gate{Y^{\\dagger}} & \\ctrl{1} & \\ctrl{1} & \\gate{G} & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{2}}} & \\qw & \\qw & \\gate{Y} & \\ctrl{1} & \\qw & \\qw & \\qw & \\qw & \\gate{Y^{\\dagger}} & \\gate{Y^{\\dagger}^{\\dagger}} & \\qw & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{3}}} & \\qw & \\qw & \\qw & \\gate{Y} & \\qw & \\qw & \\qw & \\qw & \\qw & \\qw & \\qw & \\qw & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{Y} & \ctrl{1} & \ctrl{2} & \ctrl{3} & \gate{Y^{\dagger}} & \gate{Y^{\dagger}^{\dagger}} & \gate{Y^{\dagger}^{\dagger}^{\dagger}} & \ctrl{1} & \ctrl{2} & \ctrl{2} & \ctrl{1} & \gate{G^{\dagger}} & \qw \\ +\lstick{\ket{q_{1}}} & \qw & \gate{Y} & \ctrl{1} & \ctrl{2} & \qw & \qw & \qw & \gate{Y^{\dagger}} & \ctrl{1} & \ctrl{1} & \gate{G} & \qw & \qw \\ +\lstick{\ket{q_{2}}} & \qw & \qw & \gate{Y} & \ctrl{1} & \qw & \qw & \qw & \qw & \gate{Y^{\dagger}} & \gate{Y^{\dagger}^{\dagger}} & \qw & \qw & \qw \\ +\lstick{\ket{q_{3}}} & \qw & \qw & \qw & \gate{Y} & \qw & \qw & \qw & \qw & \qw & \qw & \qw & \qw & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_simple_params.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_simple_params.snap new file mode 100644 index 00000000..fddaa156 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_good_simple_params.snap @@ -0,0 +1,14 @@ +--- +source: quil-rs/src/program/latex/mod.rs +expression: "get_latex(\"CPHASE(1.0) 0 1\\nCPHASE(1.0-2.0i) 1 0\", RenderSettings::default())" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \ctrl{1} & \phase{\text{1 - 2.0i}} & \qw \\ +\lstick{\ket{q_{1}}} & \phase{\text{1}} & \ctrl{-1} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_h0_cnot01_x1_cnot12.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_h0_cnot01_x1_cnot12.snap new file mode 100644 index 00000000..b5a11844 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_h0_cnot01_x1_cnot12.snap @@ -0,0 +1,16 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 799 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{H} & \\ctrl{1} & \\qw & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\qw & \\targ{} & \\gate{X} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{2}}} & \\qw & \\qw & \\qw & \\targ{} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{H} & \ctrl{1} & \qw & \qw & \qw \\ +\lstick{\ket{q_{1}}} & \qw & \targ{} & \gate{X} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{2}}} & \qw & \qw & \qw & \targ{} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_h5_cnot52_y2_cnot23.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_h5_cnot52_y2_cnot23.snap new file mode 100644 index 00000000..75ed071b --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__programs__program_h5_cnot52_y2_cnot23.snap @@ -0,0 +1,16 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 804 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{2}}} & \\qw & \\targ{} & \\gate{Y} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{3}}} & \\qw & \\qw & \\qw & \\targ{} & \\qw \\\\\n\\lstick{\\ket{q_{5}}} & \\gate{H} & \\ctrl{-2} & \\qw & \\qw & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{2}}} & \qw & \targ{} & \gate{Y} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{3}}} & \qw & \qw & \qw & \targ{} & \qw \\ +\lstick{\ket{q_{5}}} & \gate{H} & \ctrl{-2} & \qw & \qw & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_impute_missing_qubits_true_ctrl_greater_than_targ.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_impute_missing_qubits_true_ctrl_greater_than_targ.snap new file mode 100644 index 00000000..a2725f66 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_impute_missing_qubits_true_ctrl_greater_than_targ.snap @@ -0,0 +1,17 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 777 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{2}}} & \\qw & \\targ{} & \\qw \\\\\n\\lstick{\\ket{q_{3}}} & \\qw & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{4}}} & \\qw & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{5}}} & \\gate{H} & \\ctrl{-3} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{2}}} & \qw & \targ{} & \qw \\ +\lstick{\ket{q_{3}}} & \qw & \qw & \qw \\ +\lstick{\ket{q_{4}}} & \qw & \qw & \qw \\ +\lstick{\ket{q_{5}}} & \gate{H} & \ctrl{-3} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_impute_missing_qubits_true_ctrl_less_than_targ.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_impute_missing_qubits_true_ctrl_less_than_targ.snap new file mode 100644 index 00000000..e0d93ceb --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_impute_missing_qubits_true_ctrl_less_than_targ.snap @@ -0,0 +1,17 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 712 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\gate{H} & \\ctrl{3} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\qw & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{2}}} & \\qw & \\qw & \\qw \\\\\n\\lstick{\\ket{q_{3}}} & \\qw & \\targ{} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \gate{H} & \ctrl{3} & \qw \\ +\lstick{\ket{q_{1}}} & \qw & \qw & \qw \\ +\lstick{\ket{q_{2}}} & \qw & \qw & \qw \\ +\lstick{\ket{q_{3}}} & \qw & \targ{} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_label_qubit_lines_false.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_label_qubit_lines_false.snap new file mode 100644 index 00000000..ac3540f6 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_label_qubit_lines_false.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 689 +expression: "r#\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\qw & \\gate{H} & \\ctrl{1} & \\qw \\\\\n\\qw & \\qw & \\targ{} & \\qw\n\\end{tikzcd}\n\\end{document}\"#" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\qw & \gate{H} & \ctrl{1} & \qw \\ +\qw & \qw & \targ{} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_texify_numerical_constants_false_supported_symbol.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_texify_numerical_constants_false_supported_symbol.snap new file mode 100644 index 00000000..9e8e6df9 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_texify_numerical_constants_false_supported_symbol.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 1064 +expression: "r\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\phase{\\text{alpha}} & \\qw\n\\end{tikzcd}\n\\end{document}\"" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{1}}} & \phase{\text{alpha}} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_texify_numerical_constants_true_supported_symbol.snap b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_texify_numerical_constants_true_supported_symbol.snap new file mode 100644 index 00000000..3e921b01 --- /dev/null +++ b/quil-rs/src/program/latex/snapshots/quil_rs__program__latex__tests__settings__settings_texify_numerical_constants_true_supported_symbol.snap @@ -0,0 +1,15 @@ +--- +source: src/program/latex/mod.rs +assertion_line: 1044 +expression: "r\"\\documentclass[convert={density=300,outext=.png}]{standalone}\n\\usepackage[margin=1in]{geometry}\n\\usepackage{tikz}\n\\usetikzlibrary{quantikz}\n\\begin{document}\n\\begin{tikzcd}\n\\lstick{\\ket{q_{0}}} & \\ctrl{1} & \\qw \\\\\n\\lstick{\\ket{q_{1}}} & \\phase{\\alpha} & \\qw\n\\end{tikzcd}\n\\end{document}\"" +--- +\documentclass[convert={density=300,outext=.png}]{standalone} +\usepackage[margin=1in]{geometry} +\usepackage{tikz} +\usetikzlibrary{quantikz} +\begin{document} +\begin{tikzcd} +\lstick{\ket{q_{0}}} & \ctrl{1} & \qw \\ +\lstick{\ket{q_{1}}} & \phase{\alpha} & \qw +\end{tikzcd} +\end{document} diff --git a/quil-rs/src/program/mod.rs b/quil-rs/src/program/mod.rs index e5b3bc1e..a587b66d 100644 --- a/quil-rs/src/program/mod.rs +++ b/quil-rs/src/program/mod.rs @@ -29,18 +29,19 @@ use crate::instruction::{ use crate::parser::{lex, parse_instructions, ParseError}; use crate::quil::Quil; -pub use self::calibration::Calibrations; -pub use self::calibration_set::CalibrationSet; -pub use self::error::{disallow_leftover, map_parsed, recover, ParseProgramError, SyntaxError}; -pub use self::frame::FrameSet; -pub use self::frame::MatchedFrames; -pub use self::memory::{MemoryAccess, MemoryAccesses, MemoryRegion}; +pub use calibration::Calibrations; +pub use calibration_set::CalibrationSet; +pub use error::{disallow_leftover, map_parsed, recover, ParseProgramError, SyntaxError}; +pub use frame::FrameSet; +pub use frame::MatchedFrames; +pub use memory::{MemoryAccess, MemoryAccesses, MemoryRegion}; pub mod analysis; mod calibration; mod calibration_set; mod error; pub(crate) mod frame; +pub mod latex; mod memory; pub mod scheduling; pub mod type_check; diff --git a/quil-rs/src/program/snapshots/quil_rs__program__tests__wrap_in_loop.snap b/quil-rs/src/program/snapshots/quil_rs__program__tests__wrap_in_loop.snap index 7d7f44e0..27458827 100644 --- a/quil-rs/src/program/snapshots/quil_rs__program__tests__wrap_in_loop.snap +++ b/quil-rs/src/program/snapshots/quil_rs__program__tests__wrap_in_loop.snap @@ -10,15 +10,14 @@ DEFWAVEFORM custom: 1, 2 DEFCAL I 0: DELAY 0 1 -MOVE shot_count[0] 10 +MOVE shot_count 10 LABEL @loop-start -MEASURE q ro[0] +MEASURE q ro JUMP-UNLESS @end-reset ro[0] X q LABEL @end-reset I 0 -SUB shot_count[0] 1 +SUB shot_count 1 JUMP-UNLESS @loop-end shot_count[0] JUMP @loop-start LABEL @loop-end - diff --git a/quil-rs/src/waveform/templates.rs b/quil-rs/src/waveform/templates.rs index 0cc3b5a1..c6f49cc5 100644 --- a/quil-rs/src/waveform/templates.rs +++ b/quil-rs/src/waveform/templates.rs @@ -30,7 +30,7 @@ pub fn apply_phase_and_detuning( /// To handle accumulated floating point errors in sweeps above typical floating point imprecision /// we make epsilon 10x larger than floating point epsilon. fn ceiling_with_epsilon(value: f64) -> f64 { - let truncated = value - (value * 10.0 * std::f64::EPSILON); + let truncated = value - (value * 10.0 * f64::EPSILON); truncated.ceil() } @@ -297,8 +297,8 @@ mod tests { #[rstest::rstest] #[case(0.0, 0.0)] - #[case(0.0-std::f64::EPSILON, 0.0)] - #[case(0.0+std::f64::EPSILON, 1.0)] + #[case(0.0 - f64::EPSILON, 0.0)] + #[case(0.0 + f64::EPSILON, 1.0)] // Based on a past edge case #[case(8.800_000_000_000_001e-8 * 1.0e9, 88.0)] fn ceiling_with_epsilon(#[case] value: f64, #[case] expected: f64) { diff --git a/quil-rs/tests/snapshots/calibration_test__calibration_measure.quil.snap b/quil-rs/tests/snapshots/calibration_test__calibration_measure.quil.snap index e27a6cb7..43c692bc 100644 --- a/quil-rs/tests/snapshots/calibration_test__calibration_measure.quil.snap +++ b/quil-rs/tests/snapshots/calibration_test__calibration_measure.quil.snap @@ -1,13 +1,13 @@ --- source: quil-rs/tests/calibration_test.rs -expression: program.to_string() +expression: program.to_quil_or_debug() --- DEFCAL MEASURE 0 addr: FENCE 0 DECLARE q0_unclassified REAL[2] PULSE 0 "rf_f12" gaussian(detuning: 0, duration: 6e-8, fwhm: 1.6e-8, phase: 0, scale: 0.5, t0: 3e-8) NONBLOCKING PULSE 0 "ro_tx" flat(detuning: 0, duration: 1.6e-6, iq: 1, phase: 0, scale: 0.1) - NONBLOCKING CAPTURE 0 "ro_rx" boxcar_kernel(detuning: 0, duration: 1.6e-6, phase: 0, scale: 1) q0_unclassified[0] + NONBLOCKING CAPTURE 0 "ro_rx" boxcar_kernel(detuning: 0, duration: 1.6e-6, phase: 0, scale: 1) q0_unclassified PRAGMA FILTER-NODE q0_unclassified "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q0_ro_rx/filter','publish':true,'params':{},'_type':'FilterNode'}" PRAGMA LOAD-MEMORY q0_unclassified "q0_unclassified[0]" PRAGMA FILTER-NODE q0_classified "{'module':'standard.filters.classifiers','filter_type':'SingleQLinear','source':'q0_ro_rx/filter','publish':false,'params':{'a':[1.0,0.0],'threshold':0.01},'_type':'FilterNode'}" @@ -20,7 +20,7 @@ DEFCAL MEASURE 10 addr: DECLARE q10_unclassified REAL[2] PULSE 10 "rf_f12" gaussian(detuning: 0, duration: 7e-8, fwhm: 1.7e-8, phase: 0, scale: 0.5, t0: 3e-8) NONBLOCKING PULSE 10 "ro_tx" flat(detuning: 0, duration: 1.6e-6, iq: 1, phase: 0, scale: 0.1) - NONBLOCKING CAPTURE 10 "ro_rx" boxcar_kernel(detuning: 0, duration: 1.6e-6, phase: 0, scale: 1) q10_unclassified[0] + NONBLOCKING CAPTURE 10 "ro_rx" boxcar_kernel(detuning: 0, duration: 1.6e-6, phase: 0, scale: 1) q10_unclassified PRAGMA FILTER-NODE q10_unclassified "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q10_ro_rx/filter','publish':true,'params':{},'_type':'FilterNode'}" PRAGMA LOAD-MEMORY q10_unclassified "q10_unclassified[0]" PRAGMA FILTER-NODE q10_classified "{'module':'standard.filters.classifiers','filter_type':'SingleQLinear','source':'q10_ro_rx/filter','publish':false,'params':{'a':[1.0,0.0],'threshold':0.01},'_type':'FilterNode'}" @@ -33,12 +33,10 @@ DEFCAL MEASURE 100 addr: DECLARE q100_unclassified REAL[2] PULSE 100 "rf_f12" gaussian(detuning: 0, duration: 8e-8, fwhm: 1.8e-8, phase: 0, scale: 0.5, t0: 3e-8) NONBLOCKING PULSE 100 "ro_tx" flat(detuning: 0, duration: 1.6e-6, iq: 1, phase: 0, scale: 0.1) - NONBLOCKING CAPTURE 100 "ro_rx" boxcar_kernel(detuning: 0, duration: 1.6e-6, phase: 0, scale: 1) q100_unclassified[0] + NONBLOCKING CAPTURE 100 "ro_rx" boxcar_kernel(detuning: 0, duration: 1.6e-6, phase: 0, scale: 1) q100_unclassified PRAGMA FILTER-NODE q100_unclassified "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q100_ro_rx/filter','publish':true,'params':{},'_type':'FilterNode'}" PRAGMA LOAD-MEMORY q100_unclassified "q100_unclassified[0]" PRAGMA FILTER-NODE q100_classified "{'module':'standard.filters.classifiers','filter_type':'SingleQLinear','source':'q10_ro_rx/filter','publish':false,'params':{'a':[1.0,0.0],'threshold':0.01},'_type':'FilterNode'}" PRAGMA FILTER-NODE q100 "{'module':'standard.filters.io','filter_type':'DataBuffer','source':'q100_classified','publish':true,'params':{},'_type':'FilterNode'}" PRAGMA LOAD-MEMORY q100 "addr" FENCE 100 - -