From e35a088551ce8cfae3b78119f57bdebbf1af35d5 Mon Sep 17 00:00:00 2001 From: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:43:30 +0100 Subject: [PATCH 01/11] Updated to pyo3 0.15.0 and updated version numbers (#124) * Temporary change of qoqo_calculator * Removed qoqo_calculator branch dependency * Increased version numbers and updated changelog * Fixed input type for DeviceTrait * Fixed unittest * Simplified two qubit gate matrix unittests * Updated to pyo3 0.15.0 * Fixed typo in ci workflow * Removed faulty 3.10 (python) support, will address later --- .github/workflows/build_and_deploy.yml | 9 +- .github/workflows/ci_tests.yml | 12 +- CHANGELOG.md | 4 + Cargo.lock | 52 +- qoqo-macros/Cargo.toml | 2 +- qoqo/Cargo.toml | 12 +- qoqo/qoqo/DEPENDENCIES | 1790 ++++++------- roqoqo-derive/Cargo.toml | 2 +- roqoqo-test/Cargo.toml | 4 +- roqoqo/Cargo.toml | 4 +- roqoqo/coveragehtml/amber.png | Bin 0 -> 141 bytes roqoqo/coveragehtml/emerald.png | Bin 0 -> 141 bytes roqoqo/coveragehtml/gcov.css | 519 ++++ roqoqo/coveragehtml/glass.png | Bin 0 -> 167 bytes roqoqo/coveragehtml/index-sort-f.html | 113 + roqoqo/coveragehtml/index-sort-l.html | 113 + roqoqo/coveragehtml/index.html | 113 + roqoqo/coveragehtml/ruby.png | Bin 0 -> 141 bytes roqoqo/coveragehtml/snow.png | Bin 0 -> 141 bytes .../src/backends.rs.func-sort-c.html | 100 + roqoqo/coveragehtml/src/backends.rs.func.html | 100 + roqoqo/coveragehtml/src/backends.rs.gcov.html | 253 ++ .../src/circuit.rs.func-sort-c.html | 308 +++ roqoqo/coveragehtml/src/circuit.rs.func.html | 308 +++ roqoqo/coveragehtml/src/circuit.rs.gcov.html | 875 ++++++ .../src/devices.rs.func-sort-c.html | 76 + roqoqo/coveragehtml/src/devices.rs.func.html | 76 + roqoqo/coveragehtml/src/devices.rs.gcov.html | 216 ++ roqoqo/coveragehtml/src/index-sort-f.html | 133 + roqoqo/coveragehtml/src/index-sort-l.html | 133 + roqoqo/coveragehtml/src/index.html | 133 + .../coveragehtml/src/lib.rs.func-sort-c.html | 128 + roqoqo/coveragehtml/src/lib.rs.func.html | 128 + roqoqo/coveragehtml/src/lib.rs.gcov.html | 278 ++ ...s_rotation_measurement.rs.func-sort-c.html | 108 + .../basis_rotation_measurement.rs.func.html | 108 + .../basis_rotation_measurement.rs.gcov.html | 330 +++ ...s_rotation_measurement.rs.func-sort-c.html | 104 + ...ed_basis_rotation_measurement.rs.func.html | 104 + ...ed_basis_rotation_measurement.rs.gcov.html | 220 ++ .../cheated_measurement.rs.func-sort-c.html | 116 + .../cheated_measurement.rs.func.html | 116 + .../cheated_measurement.rs.gcov.html | 281 ++ ...l_register_measurement.rs.func-sort-c.html | 100 + ...lassical_register_measurement.rs.func.html | 100 + ...lassical_register_measurement.rs.gcov.html | 161 ++ .../src/measurements/index-sort-f.html | 133 + .../src/measurements/index-sort-l.html | 133 + .../coveragehtml/src/measurements/index.html | 133 + ...t_auxiliary_data_input.rs.func-sort-c.html | 196 ++ ...surement_auxiliary_data_input.rs.func.html | 196 ++ ...surement_auxiliary_data_input.rs.gcov.html | 472 ++++ .../define_operations.rs.func-sort-c.html | 348 +++ .../operations/define_operations.rs.func.html | 348 +++ .../operations/define_operations.rs.gcov.html | 263 ++ .../src/operations/index-sort-f.html | 153 ++ .../src/operations/index-sort-l.html | 153 ++ roqoqo/coveragehtml/src/operations/index.html | 153 ++ ...measurement_operations.rs.func-sort-c.html | 408 +++ .../measurement_operations.rs.func.html | 408 +++ .../measurement_operations.rs.gcov.html | 415 +++ .../src/operations/mod.rs.func-sort-c.html | 104 + .../src/operations/mod.rs.func.html | 104 + .../src/operations/mod.rs.gcov.html | 754 ++++++ ..._qubit_gate_operations.rs.func-sort-c.html | 144 + .../multi_qubit_gate_operations.rs.func.html | 144 + .../multi_qubit_gate_operations.rs.gcov.html | 164 ++ .../pragma_operations.rs.func-sort-c.html | 1212 +++++++++ .../operations/pragma_operations.rs.func.html | 1212 +++++++++ .../operations/pragma_operations.rs.gcov.html | 1148 ++++++++ ..._qubit_gate_operations.rs.func-sort-c.html | 1328 ++++++++++ .../single_qubit_gate_operations.rs.func.html | 1328 ++++++++++ .../single_qubit_gate_operations.rs.gcov.html | 1623 ++++++++++++ ..._qubit_gate_operations.rs.func-sort-c.html | 1792 +++++++++++++ .../two_qubit_gate_operations.rs.func.html | 1792 +++++++++++++ .../two_qubit_gate_operations.rs.gcov.html | 2345 +++++++++++++++++ .../src/quantum_program.rs.func-sort-c.html | 96 + .../src/quantum_program.rs.func.html | 96 + .../src/quantum_program.rs.gcov.html | 241 ++ roqoqo/coveragehtml/updown.png | Bin 0 -> 117 bytes .../operations/two_qubit_gate_operations.rs | 84 +- 81 files changed, 26464 insertions(+), 1001 deletions(-) create mode 100644 roqoqo/coveragehtml/amber.png create mode 100644 roqoqo/coveragehtml/emerald.png create mode 100644 roqoqo/coveragehtml/gcov.css create mode 100644 roqoqo/coveragehtml/glass.png create mode 100644 roqoqo/coveragehtml/index-sort-f.html create mode 100644 roqoqo/coveragehtml/index-sort-l.html create mode 100644 roqoqo/coveragehtml/index.html create mode 100644 roqoqo/coveragehtml/ruby.png create mode 100644 roqoqo/coveragehtml/snow.png create mode 100644 roqoqo/coveragehtml/src/backends.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/backends.rs.func.html create mode 100644 roqoqo/coveragehtml/src/backends.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/circuit.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/circuit.rs.func.html create mode 100644 roqoqo/coveragehtml/src/circuit.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/devices.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/devices.rs.func.html create mode 100644 roqoqo/coveragehtml/src/devices.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/index-sort-f.html create mode 100644 roqoqo/coveragehtml/src/index-sort-l.html create mode 100644 roqoqo/coveragehtml/src/index.html create mode 100644 roqoqo/coveragehtml/src/lib.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/lib.rs.func.html create mode 100644 roqoqo/coveragehtml/src/lib.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.func.html create mode 100644 roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.func.html create mode 100644 roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.func.html create mode 100644 roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.func.html create mode 100644 roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/measurements/index-sort-f.html create mode 100644 roqoqo/coveragehtml/src/measurements/index-sort-l.html create mode 100644 roqoqo/coveragehtml/src/measurements/index.html create mode 100644 roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.func.html create mode 100644 roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/operations/define_operations.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/operations/define_operations.rs.func.html create mode 100644 roqoqo/coveragehtml/src/operations/define_operations.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/operations/index-sort-f.html create mode 100644 roqoqo/coveragehtml/src/operations/index-sort-l.html create mode 100644 roqoqo/coveragehtml/src/operations/index.html create mode 100644 roqoqo/coveragehtml/src/operations/measurement_operations.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/operations/measurement_operations.rs.func.html create mode 100644 roqoqo/coveragehtml/src/operations/measurement_operations.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/operations/mod.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/operations/mod.rs.func.html create mode 100644 roqoqo/coveragehtml/src/operations/mod.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.func.html create mode 100644 roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/operations/pragma_operations.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/operations/pragma_operations.rs.func.html create mode 100644 roqoqo/coveragehtml/src/operations/pragma_operations.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.func.html create mode 100644 roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.func.html create mode 100644 roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.gcov.html create mode 100644 roqoqo/coveragehtml/src/quantum_program.rs.func-sort-c.html create mode 100644 roqoqo/coveragehtml/src/quantum_program.rs.func.html create mode 100644 roqoqo/coveragehtml/src/quantum_program.rs.gcov.html create mode 100644 roqoqo/coveragehtml/updown.png diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index af927125..f919e300 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -43,7 +43,8 @@ jobs: {py: 3.6, interpreter: "python3.6"}, {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, - {py: 3.9, interpreter: "python3.9"} + {py: 3.9, interpreter: "python3.9"}, + {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 @@ -85,7 +86,8 @@ jobs: {py: 3.6, interpreter: "python3.6"}, {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, - {py: 3.9, interpreter: "python3.9"} + {py: 3.9, interpreter: "python3.9"}, + {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 @@ -123,7 +125,8 @@ jobs: {py: 3.6, interpreter: "python3.6"}, {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, - {py: 3.9, interpreter: "python3.9"} + {py: 3.9, interpreter: "python3.9"}, + {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index ccd6eb87..e49827ee 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -32,7 +32,8 @@ jobs: {py: 3.6, interpreter: "python3.6"}, {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, - {py: 3.9, interpreter: "python3.9"} + {py: 3.9, interpreter: "python3.9"}, + # {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 @@ -63,7 +64,8 @@ jobs: {py: 3.6, interpreter: "python3.6"}, {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, - {py: 3.9, interpreter: "python3.9"} + {py: 3.9, interpreter: "python3.9"}, + # {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 @@ -99,7 +101,8 @@ jobs: {py: 3.6, interpreter: "python3.6"}, {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, - {py: 3.9, interpreter: "python3.9"} + {py: 3.9, interpreter: "python3.9"}, + # {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 @@ -131,7 +134,8 @@ jobs: {py: 3.6, interpreter: "python3.6"}, {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, - {py: 3.9, interpreter: "python3.9"} + {py: 3.9, interpreter: "python3.9"}, + # {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index d34cc743..5ac56719 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This changelog track changes to the qoqo project starting at version 0.5.0 ## Not released +## 0.8.1 +### Changed 0.8.1 + +* Updated to pyo3 0.15.0 ## 0.8.0 diff --git a/Cargo.lock b/Cargo.lock index fe058ca1..f4003e13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -165,9 +165,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.105" +version = "0.2.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013" +checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219" [[package]] name = "libm" @@ -277,9 +277,9 @@ dependencies = [ [[package]] name = "numpy" -version = "0.14.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c15af63aa0c74e0f7230d4e95d9a3d71a23449905f30f50b055df9a6a6a3e6" +checksum = "e590538dba8432d54d3587b06df73d7c044e83cfa4b200cbc7d0567f924ac0a7" dependencies = [ "cfg-if 0.1.10", "libc", @@ -332,9 +332,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" +checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" [[package]] name = "paste-impl" @@ -368,9 +368,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.14.5" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35100f9347670a566a67aa623369293703322bb9db77d99d7df7313b575ae0c8" +checksum = "64664505ce285a59b8b7e940fbe54ad65b1758a0810eddc5bc26df6f6ec8c557" dependencies = [ "cfg-if 1.0.0", "indoc", @@ -385,18 +385,18 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.14.5" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d12961738cacbd7f91b7c43bc25cfeeaa2698ad07a04b3be0aa88b950865738f" +checksum = "5f1e4a72de84cdcd69f62211b62f62753d0c11b7b5715f3467f3754dab22a7ca" dependencies = [ "once_cell", ] [[package]] name = "pyo3-macros" -version = "0.14.5" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0bc5215d704824dfddddc03f93cb572e1155c68b6761c37005e1c288808ea8" +checksum = "244f21d0a3887a9c02018b94e3b78d693dc7eca5c56839b7796a499cc364deb4" dependencies = [ "pyo3-macros-backend", "quote", @@ -405,9 +405,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.14.5" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71623fc593224afaab918aa3afcaf86ed2f43d34f6afde7f3922608f253240df" +checksum = "b3d3d18ac41d05199bb82645d56e39f8c8b4909a0137c6f2640f03685b29f672" dependencies = [ "proc-macro2", "pyo3-build-config", @@ -417,7 +417,7 @@ dependencies = [ [[package]] name = "qoqo" -version = "0.8.0" +version = "0.8.1" dependencies = [ "bincode", "nalgebra", @@ -440,7 +440,7 @@ dependencies = [ [[package]] name = "qoqo-macros" -version = "0.8.0" +version = "0.8.1" dependencies = [ "proc-macro2", "quote", @@ -449,9 +449,9 @@ dependencies = [ [[package]] name = "qoqo_calculator" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4924da2cc11cc4a5385eebda81918e3bf17ba61e26d766e0646b4f334747b4ce" +checksum = "2d04936ed2ab44b6cd825aa98b63e8a38b524b2c3a6f2704e15afe861395d0b2" dependencies = [ "num-complex", "serde", @@ -460,9 +460,9 @@ dependencies = [ [[package]] name = "qoqo_calculator_pyo3" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef8106b00d8e1091eaa088eaf0b7d4cac2d127c06b24c54a24e65d48ecdfb5a" +checksum = "e43ab27618dbbfba6285d98da4da99fe22ecc9e22138ec20b9449343ebc905b3" dependencies = [ "num-complex", "pyo3", @@ -547,7 +547,7 @@ dependencies = [ [[package]] name = "roqoqo" -version = "0.8.0" +version = "0.8.1" dependencies = [ "bincode", "dyn-clone", @@ -570,7 +570,7 @@ dependencies = [ [[package]] name = "roqoqo-derive" -version = "0.8.0" +version = "0.8.1" dependencies = [ "proc-macro2", "quote", @@ -579,7 +579,7 @@ dependencies = [ [[package]] name = "roqoqo-test" -version = "0.8.0" +version = "0.8.1" dependencies = [ "nalgebra", "ndarray", @@ -634,9 +634,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" +checksum = "e466864e431129c7e0d3476b92f20458e5879919a0596c6472738d9fa2d342f8" dependencies = [ "itoa", "ryu", @@ -661,7 +661,7 @@ dependencies = [ "approx", "num-complex", "num-traits", - "paste 1.0.5", + "paste 1.0.6", "wide", ] diff --git a/qoqo-macros/Cargo.toml b/qoqo-macros/Cargo.toml index 2f93518f..0da312f9 100644 --- a/qoqo-macros/Cargo.toml +++ b/qoqo-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "qoqo-macros" -version = "0.8.0" +version = "0.8.1" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" readme = "../README.md" diff --git a/qoqo/Cargo.toml b/qoqo/Cargo.toml index d316bb8b..0bc5a3fc 100644 --- a/qoqo/Cargo.toml +++ b/qoqo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "qoqo" -version = "0.8.0" +version = "0.8.1" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" homepage = "https://github.com/HQSquantumsimulations/qoqo" @@ -22,7 +22,7 @@ doctest = false crate-type = ["cdylib", "rlib"] [dependencies.pyo3] -version = "0.14" +version = "0.15" features = ["num-complex"] [dependencies] @@ -30,11 +30,11 @@ serde = { version = "1.0", features = ["derive"] } ndarray = "0.15" num-complex = "0.4" thiserror = "1.0" -qoqo_calculator = { version="0.3" } -qoqo_calculator_pyo3 = {version="0.4", default-features=false} +qoqo_calculator = { version="0.5" } +qoqo_calculator_pyo3 = {version="0.5", default-features=false} qoqo-macros = {version="0.8", path="../qoqo-macros"} roqoqo = {version="0.8", path="../roqoqo", features=["serialize", "overrotate"]} -numpy = "=0.14" +numpy = "=0.15" bincode = "1.3" serde_json = "1.0" @@ -55,7 +55,7 @@ extension-module = ["pyo3/extension-module"]#, "qoqo_calculator_pyo3/extension-m default = ["extension-module"] [package.metadata.maturin] -requires-dist = ["numpy", "qoqo_calculator_pyo3>=0.4"] +requires-dist = ["numpy", "qoqo_calculator_pyo3>=0.5"] maintainer = "HQS Quantum Simulations GmbH" maintainer-email = "info@quantumsimulations.de" requires-python = ">=3.6" \ No newline at end of file diff --git a/qoqo/qoqo/DEPENDENCIES b/qoqo/qoqo/DEPENDENCIES index 70a91d00..643931ec 100644 --- a/qoqo/qoqo/DEPENDENCIES +++ b/qoqo/qoqo/DEPENDENCIES @@ -217,6 +217,35 @@ https://github.com/cuviper/autocfg by Josh Stone Automatic cfg for Rust compiler features License: Apache-2.0 OR MIT +---------------------------------------------------- +LICENSE-MIT: + +Copyright (c) 2018 Josh Stone + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -422,35 +451,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Copyright (c) 2018 Josh Stone - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== bincode 1.3.3 @@ -491,6 +491,35 @@ by The Rust Project Developers A macro to generate structures which behave like bitflags. License: MIT/Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Copyright (c) 2014 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -696,35 +725,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Copyright (c) 2014 The Rust Project Developers - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== bytemuck 1.7.2 @@ -732,6 +732,34 @@ https://github.com/Lokathor/bytemuck by Lokathor A crate for mucking around with piles of bytes. License: Zlib OR Apache-2.0 OR MIT +---------------------------------------------------- +LICENSE-MIT: + +MIT License + +Copyright (c) 2019 Daniel "Lokathor" Gee. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +---------------------------------------------------- +LICENSE-ZLIB: + +Copyright (c) 2019 Daniel "Lokathor" Gee. + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. + ---------------------------------------------------- LICENSE-APACHE: @@ -797,34 +825,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-ZLIB: - -Copyright (c) 2019 Daniel "Lokathor" Gee. - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - ----------------------------------------------------- -LICENSE-MIT: - -MIT License - -Copyright (c) 2019 Daniel "Lokathor" Gee. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ==================================================== cfg-if 0.1.10 @@ -835,6 +835,35 @@ parameters. Structured like an if-else chain, the first matching branch is the item that gets emitted. License: MIT/Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Copyright (c) 2014 Alex Crichton + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -1040,6 +1069,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +cfg-if 1.0.0 +https://github.com/alexcrichton/cfg-if +by Alex Crichton +A macro to ergonomically define an item depending on a large number of #[cfg] +parameters. Structured like an if-else chain, the first matching branch is the +item that gets emitted. + +License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -1069,16 +1108,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -cfg-if 1.0.0 -https://github.com/alexcrichton/cfg-if -by Alex Crichton -A macro to ergonomically define an item depending on a large number of #[cfg] -parameters. Structured like an if-else chain, the first matching branch is the -item that gets emitted. - -License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -1284,10 +1313,18 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +getrandom 0.2.3 +https://github.com/rust-random/getrandom +by The Rand Project Developers +A small cross-platform library for retrieving random data from system source +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2014 Alex Crichton +Copyright 2018 Developers of the Rand project +Copyright (c) 2014 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -1313,13 +1350,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -getrandom 0.2.3 -https://github.com/rust-random/getrandom -by The Rand Project Developers -A small cross-platform library for retrieving random data from system source -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -1525,12 +1555,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +indoc 0.3.6 +https://github.com/dtolnay/indoc +by David Tolnay +Indented document literals +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright 2018 Developers of the Rand project -Copyright (c) 2014 The Rust Project Developers - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the @@ -1555,13 +1589,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -indoc 0.3.6 -https://github.com/dtolnay/indoc -by David Tolnay -Indented document literals -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -1767,7 +1794,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- + +==================================================== +indoc-impl 0.3.6 +https://github.com/dtolnay/indoc +by David Tolnay +Indented document literals +License: MIT OR Apache-2.0 +---------------------------------------------------- LICENSE-MIT: Permission is hereby granted, free of charge, to any @@ -1794,13 +1828,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -indoc-impl 0.3.6 -https://github.com/dtolnay/indoc -by David Tolnay -Indented document literals -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -2006,33 +2033,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== instant 0.1.12 @@ -2078,6 +2078,33 @@ https://github.com/dtolnay/itoa by David Tolnay Fast functions for printing integer primitives to an io::Write License: MIT OR Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -2283,9 +2310,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +libc 0.2.107 +https://github.com/rust-lang/libc +by The Rust Project Developers +Raw FFI bindings to platform libraries like libc. + +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: +Copyright (c) 2014-2020 The Rust Project Developers + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the @@ -2310,14 +2347,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -libc 0.2.105 -https://github.com/rust-lang/libc -by The Rust Project Developers -Raw FFI bindings to platform libraries like libc. - -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -2523,10 +2552,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +libm 0.2.1 +https://github.com/rust-lang/libm +by Jorge Aparicio +libm in pure Rust +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2014-2020 The Rust Project Developers +Copyright (c) 2018 Jorge Aparicio Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -2552,13 +2588,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -libm 0.2.1 -https://github.com/rust-lang/libm -by Jorge Aparicio -libm in pure Rust -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -2764,10 +2793,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +lock_api 0.4.5 +https://github.com/Amanieu/parking_lot +by Amanieu d'Antras +Wrappers to create fully-featured Mutex and RwLock types. Compatible with no_std. +License: Apache-2.0/MIT ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2018 Jorge Aparicio +Copyright (c) 2016 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -2793,13 +2829,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -lock_api 0.4.5 -https://github.com/Amanieu/parking_lot -by Amanieu d'Antras -Wrappers to create fully-featured Mutex and RwLock types. Compatible with no_std. -License: Apache-2.0/MIT ---------------------------------------------------- LICENSE-APACHE: @@ -3005,10 +3034,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +matrixmultiply 0.3.1 +https://github.com/bluss/matrixmultiply/ +by bluss, R. Janis Goldschmidt +General matrix multiplication for f32 and f64 matrices. Operates on matrices with general layout (they can use arbitrary row and column stride). Detects and uses AVX or SSE2 on x86 platforms transparently for higher performance. Uses a microkernel strategy, so that the implementation is easy to parallelize and optimize. + +Supports multithreading. +License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2016 The Rust Project Developers +Copyright (c) 2016 - 2018 Ulrik Sverdrup "bluss" Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -3034,15 +3072,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -matrixmultiply 0.3.1 -https://github.com/bluss/matrixmultiply/ -by bluss, R. Janis Goldschmidt -General matrix multiplication for f32 and f64 matrices. Operates on matrices with general layout (they can use arbitrary row and column stride). Detects and uses AVX or SSE2 on x86 platforms transparently for higher performance. Uses a microkernel strategy, so that the implementation is easy to parallelize and optimize. - -Supports multithreading. -License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -3248,35 +3277,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Copyright (c) 2016 - 2018 Ulrik Sverdrup "bluss" - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== nalgebra 0.29.0 @@ -3503,6 +3503,37 @@ https://github.com/rust-ndarray/ndarray by Ulrik Sverdrup "bluss", Jim Turner An n-dimensional array for general elements and for numerics. Lightweight array views and slicing; views support chunking and splitting. License: MIT OR Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Copyright (c) 2015 - 2021 Ulrik Sverdrup "bluss", + Jim Turner, + and ndarray developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -3708,12 +3739,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +num-complex 0.4.0 +https://github.com/rust-num/num-complex +by The Rust Project Developers +Complex numbers implementation for Rust +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2015 - 2021 Ulrik Sverdrup "bluss", - Jim Turner, - and ndarray developers +Copyright (c) 2014 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -3739,13 +3775,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -num-complex 0.4.0 -https://github.com/rust-num/num-complex -by The Rust Project Developers -Complex numbers implementation for Rust -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -3951,6 +3980,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +num-integer 0.1.44 +https://github.com/rust-num/num-integer +by The Rust Project Developers +Integer traits and functions +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -3980,13 +4016,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -num-integer 0.1.44 -https://github.com/rust-num/num-integer -by The Rust Project Developers -Integer traits and functions -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -4192,6 +4221,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +num-rational 0.4.0 +https://github.com/rust-num/num-rational +by The Rust Project Developers +Rational numbers implementation for Rust +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -4221,13 +4257,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -num-rational 0.4.0 -https://github.com/rust-num/num-rational -by The Rust Project Developers -Rational numbers implementation for Rust -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -4433,6 +4462,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +num-traits 0.2.14 +https://github.com/rust-num/num-traits +by The Rust Project Developers +Numeric traits for generic mathematics +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -4462,15 +4498,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -num-traits 0.2.14 -https://github.com/rust-num/num-traits -by The Rust Project Developers -Numeric traits for generic mathematics -License: MIT OR Apache-2.0 ----------------------------------------------------- -LICENSE-APACHE: +---------------------------------------------------- +LICENSE-APACHE: Apache License Version 2.0, January 2004 @@ -4674,39 +4703,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Copyright (c) 2014 The Rust Project Developers - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== -numpy 0.14.1 -https://github.com/rust-numpy/rust-numpy +numpy 0.15.0 +https://github.com/PyO3/rust-numpy by Toshiki Teramura , Yuji Kanagawa Rust binding of NumPy C-API License: BSD-2-Clause @@ -4746,6 +4746,33 @@ https://github.com/matklad/once_cell by Aleksey Kladov Single assignment cells and lazy values. License: MIT OR Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -4951,9 +4978,18 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +parking_lot 0.11.2 +https://github.com/Amanieu/parking_lot +by Amanieu d'Antras +More compact and efficient implementations of the standard synchronization primitives. +License: Apache-2.0/MIT ---------------------------------------------------- LICENSE-MIT: +Copyright (c) 2016 The Rust Project Developers + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the @@ -4978,13 +5014,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -parking_lot 0.11.2 -https://github.com/Amanieu/parking_lot -by Amanieu d'Antras -More compact and efficient implementations of the standard synchronization primitives. -License: Apache-2.0/MIT ---------------------------------------------------- LICENSE-APACHE: @@ -5190,6 +5219,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +parking_lot_core 0.8.5 +https://github.com/Amanieu/parking_lot +by Amanieu d'Antras +An advanced API for creating custom synchronization primitives. +License: Apache-2.0/MIT ---------------------------------------------------- LICENSE-MIT: @@ -5219,13 +5255,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -parking_lot_core 0.8.5 -https://github.com/Amanieu/parking_lot -by Amanieu d'Antras -An advanced API for creating custom synchronization primitives. -License: Apache-2.0/MIT ---------------------------------------------------- LICENSE-APACHE: @@ -5431,10 +5460,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +paste 0.1.18 +https://github.com/dtolnay/paste +by David Tolnay +Macros for all your token pasting needs +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2016 The Rust Project Developers +Copyright (c) 2018 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -5460,13 +5496,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -paste 0.1.18 -https://github.com/dtolnay/paste -by David Tolnay -Macros for all your token pasting needs -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -5672,6 +5701,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +paste 1.0.6 +https://github.com/dtolnay/paste +by David Tolnay +Macros for all your token pasting needs +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -5701,13 +5737,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -paste 1.0.5 -https://github.com/dtolnay/paste -by David Tolnay -Macros for all your token pasting needs -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -5913,6 +5942,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +paste-impl 0.1.18 +https://github.com/dtolnay/paste +by David Tolnay +Implementation detail of the `paste` crate +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -5942,13 +5978,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -paste-impl 0.1.18 -https://github.com/dtolnay/paste -by David Tolnay -Implementation detail of the `paste` crate -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -6154,10 +6183,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +ppv-lite86 0.2.15 +https://github.com/cryptocorrosion/cryptocorrosion +by The CryptoCorrosion Contributors +Implementation of the crypto-simd API for x86 +License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2018 +Copyright (c) 2019 The CryptoCorrosion Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -6183,13 +6219,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -ppv-lite86 0.2.15 -https://github.com/cryptocorrosion/cryptocorrosion -by The CryptoCorrosion Contributors -Implementation of the crypto-simd API for x86 -License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -6395,10 +6424,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +proc-macro-hack 0.5.19 +https://github.com/dtolnay/proc-macro-hack +by David Tolnay +Procedural macros in expression position +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2019 The CryptoCorrosion Contributors +Copyright (c) 2018 David Tolnay Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -6424,13 +6460,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -proc-macro-hack 0.5.19 -https://github.com/dtolnay/proc-macro-hack -by David Tolnay -Procedural macros in expression position -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -6636,10 +6665,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +proc-macro2 1.0.32 +https://github.com/dtolnay/proc-macro2 +by David Tolnay , Alex Crichton +A substitute implementation of the compiler's `proc_macro` API to decouple +token-based libraries from the procedural macro use case. + +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2018 David Tolnay +Copyright (c) 2014 Alex Crichton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -6665,15 +6703,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -proc-macro2 1.0.32 -https://github.com/dtolnay/proc-macro2 -by David Tolnay , Alex Crichton -A substitute implementation of the compiler's `proc_macro` API to decouple -token-based libraries from the procedural macro use case. - -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -6879,38 +6908,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Copyright (c) 2014 Alex Crichton - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== -pyo3 0.14.5 +pyo3 0.15.0 https://github.com/pyo3/pyo3 by PyO3 Project and Contributors Bindings to Python interpreter @@ -7110,7 +7110,7 @@ LICENSE: ==================================================== -pyo3-build-config 0.14.5 +pyo3-build-config 0.15.0 https://github.com/pyo3/pyo3 by PyO3 Project and Contributors Build configuration for the PyO3 ecosystem @@ -7310,7 +7310,7 @@ LICENSE: ==================================================== -pyo3-macros 0.14.5 +pyo3-macros 0.15.0 https://github.com/pyo3/pyo3 by PyO3 Project and Contributors Proc macros for PyO3 package @@ -7510,7 +7510,7 @@ LICENSE: ==================================================== -pyo3-macros-backend 0.14.5 +pyo3-macros-backend 0.15.0 https://github.com/pyo3/pyo3 by PyO3 Project and Contributors Code generation for PyO3 package @@ -8133,14 +8133,14 @@ LICENSE: ==================================================== -qoqo_calculator 0.3.0 +qoqo_calculator 0.5.0 https://github.com/HQSquantumsimulations/qoqo_calculator by HQS Quantum Simulations qoqo-calculator is the calculator backend of the qoqo quantum computing toolkit by HQS Quantum Simulations License: Apache-2.0 ==================================================== -qoqo_calculator_pyo3 0.4.0 +qoqo_calculator_pyo3 0.5.0 https://github.com/HQSquantumsimulations/qoqo_calculator_pyo3 by HQS Quantum Simulations Python interface to qoqo calculator, the calculator backend of the qoqo quantum computing toolkit by HQS Quantum Simulations @@ -8152,6 +8152,35 @@ https://github.com/dtolnay/quote by David Tolnay Quasi-quoting macro quote!(...) License: MIT OR Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Copyright (c) 2016 The Rust Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -8357,10 +8386,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +rand 0.8.4 +https://rust-random.github.io/book +by The Rand Project Developers, The Rust Project Developers +Random number generators and other randomness functionality. + +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2016 The Rust Project Developers +Copyright 2018 Developers of the Rand project +Copyright (c) 2014 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -8386,16 +8424,8 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -rand 0.8.4 -https://rust-random.github.io/book -by The Rand Project Developers, The Rust Project Developers -Random number generators and other randomness functionality. - -License: MIT OR Apache-2.0 ----------------------------------------------------- -LICENSE-APACHE: +---------------------------------------------------- +LICENSE-APACHE: Apache License Version 2.0, January 2004 @@ -8599,6 +8629,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +rand_chacha 0.3.1 +https://rust-random.github.io/book +by The Rand Project Developers, The Rust Project Developers, The CryptoCorrosion Contributors +ChaCha random number generator + +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -8629,14 +8667,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -rand_chacha 0.3.1 -https://rust-random.github.io/book -by The Rand Project Developers, The Rust Project Developers, The CryptoCorrosion Contributors -ChaCha random number generator - -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -8842,6 +8872,14 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +rand_core 0.6.3 +https://rust-random.github.io/book +by The Rand Project Developers, The Rust Project Developers +Core random number generator traits and tools for implementation. + +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -8872,14 +8910,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -rand_core 0.6.3 -https://rust-random.github.io/book -by The Rand Project Developers, The Rust Project Developers -Core random number generator traits and tools for implementation. - -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -9085,11 +9115,18 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +rand_distr 0.4.2 +https://rust-random.github.io/book +by The Rand Project Developers +Sampling from random number distributions + +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: Copyright 2018 Developers of the Rand project -Copyright (c) 2014 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -9115,14 +9152,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -rand_distr 0.4.2 -https://rust-random.github.io/book -by The Rand Project Developers -Sampling from random number distributions - -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -9314,6 +9343,14 @@ APPENDIX: How to apply the Apache License to your work. same "printed page" as the copyright notice for easier identification within third-party archives. + +==================================================== +rand_hc 0.3.1 +https://rust-random.github.io/book +by The Rand Project Developers +HC128 random number generator + +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -9343,14 +9380,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -rand_hc 0.3.1 -https://rust-random.github.io/book -by The Rand Project Developers -HC128 random number generator - -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -9556,10 +9585,21 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +rawpointer 0.2.1 +https://github.com/bluss/rawpointer/ +by bluss +Extra methods for raw pointers and `NonNull`. + +For example `.post_inc()` and `.pre_dec()` (c.f. `ptr++` and `--ptr`), +`offset` and `add` for `NonNull`, and the function `ptrdistance`. + +License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright 2018 Developers of the Rand project +Copyright (c) 2015 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -9585,17 +9625,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -rawpointer 0.2.1 -https://github.com/bluss/rawpointer/ -by bluss -Extra methods for raw pointers and `NonNull`. - -For example `.post_inc()` and `.pre_dec()` (c.f. `ptr++` and `--ptr`), -`offset` and `add` for `NonNull`, and the function `ptrdistance`. - -License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -9801,35 +9830,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Copyright (c) 2015 - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== redox_syscall 0.2.10 @@ -10505,6 +10505,33 @@ https://github.com/dtolnay/ryu by David Tolnay Fast floating point to string conversion License: Apache-2.0 OR BSL-1.0 +---------------------------------------------------- +LICENSE-BOOST: + +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -10710,33 +10737,6 @@ LICENSE-APACHE: See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-BOOST: - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== safe_arch 0.6.0 @@ -10771,6 +10771,35 @@ Defines the macros `defer!`, `defer_on_unwind!`, `defer_on_success!` as shorthands for guards with one of the implemented strategies. License: MIT/Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Copyright (c) 2016-2019 Ulrik Sverdrup "bluss" and scopeguard developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -10976,11 +11005,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +serde 1.0.130 +https://serde.rs +by Erick Tryzelaar , David Tolnay +A generic serialization/deserialization framework +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2016-2019 Ulrik Sverdrup "bluss" and scopeguard developers - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the @@ -11005,13 +11039,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -serde 1.0.130 -https://serde.rs -by Erick Tryzelaar , David Tolnay -A generic serialization/deserialization framework -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -11217,6 +11244,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +serde_derive 1.0.130 +https://serde.rs +by Erick Tryzelaar , David Tolnay +Macros 1.1 implementation of #[derive(Serialize, Deserialize)] +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -11244,13 +11278,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -serde_derive 1.0.130 -https://serde.rs -by Erick Tryzelaar , David Tolnay -Macros 1.1 implementation of #[derive(Serialize, Deserialize)] -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -11456,6 +11483,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +serde_json 1.0.69 +https://github.com/serde-rs/json +by Erick Tryzelaar , David Tolnay +A JSON serialization file format +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -11483,13 +11517,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -serde_json 1.0.68 -https://github.com/serde-rs/json -by Erick Tryzelaar , David Tolnay -A JSON serialization file format -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -11695,10 +11722,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: -Permission is hereby granted, free of charge, to any +==================================================== +serde_test 1.0.130 +https://serde.rs +by Erick Tryzelaar , David Tolnay +Token De/Serializer for testing De/Serialize implementations +License: MIT OR Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without @@ -11722,13 +11756,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -serde_test 1.0.130 -https://serde.rs -by Erick Tryzelaar , David Tolnay -Token De/Serializer for testing De/Serialize implementations -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -11934,33 +11961,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== simba 0.6.0 @@ -12180,6 +12180,35 @@ https://github.com/servo/rust-smallvec by The Servo Project Developers 'Small vector' optimization: store up to a small number of items on the stack License: MIT/Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Copyright (c) 2018 The Servo Project Developers + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -12385,11 +12414,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +syn 1.0.81 +https://github.com/dtolnay/syn +by David Tolnay +Parser for Rust source code +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: -Copyright (c) 2018 The Servo Project Developers - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the @@ -12414,13 +12448,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -syn 1.0.81 -https://github.com/dtolnay/syn -by David Tolnay -Parser for Rust source code -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -12626,33 +12653,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== test-case 1.2.1 @@ -12692,6 +12692,33 @@ https://github.com/dtolnay/thiserror by David Tolnay derive(Error) License: MIT OR Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -12897,6 +12924,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +thiserror-impl 1.0.30 +https://github.com/dtolnay/thiserror +by David Tolnay +Implementation detail of the `thiserror` crate +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -12924,13 +12958,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -thiserror-impl 1.0.30 -https://github.com/dtolnay/thiserror -by David Tolnay -Implementation detail of the `thiserror` crate -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -13136,33 +13163,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ==================================================== typenum 1.14.0 @@ -13174,6 +13174,35 @@ Typenum is a Rust library for type-level numbers evaluated at implementation is incomplete. License: MIT OR Apache-2.0 ---------------------------------------------------- +LICENSE-MIT: + +The MIT License (MIT) + +Copyright (c) 2014 Paho Lurie-Gregg + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +---------------------------------------------------- +LICENSE: + +MIT OR Apache-2.0 +---------------------------------------------------- LICENSE-APACHE: Apache License @@ -13377,35 +13406,6 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE: - -MIT OR Apache-2.0 ----------------------------------------------------- -LICENSE-MIT: - -The MIT License (MIT) - -Copyright (c) 2014 Paho Lurie-Gregg - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ==================================================== unicode-xid 0.2.2 @@ -13417,214 +13417,9 @@ Unicode Standard Annex #31. License: MIT OR Apache-2.0 ---------------------------------------------------- -LICENSE-APACHE: - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. +LICENSE-MIT: - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - ----------------------------------------------------- -LICENSE-MIT: - -Copyright (c) 2015 The Rust Project Developers +Copyright (c) 2015 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated @@ -13650,13 +13445,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -unindent 0.1.7 -https://github.com/dtolnay/indoc -by David Tolnay -Remove a column of leading whitespace from a string -License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -13862,6 +13650,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +unindent 0.1.7 +https://github.com/dtolnay/indoc +by David Tolnay +Remove a column of leading whitespace from a string +License: MIT OR Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -13889,13 +13684,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -version_check 0.9.3 -https://github.com/SergioBenitez/version_check -by Sergio Benitez -Tiny crate to check the version of the installed/running rustc. -License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-APACHE: @@ -14101,6 +13889,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +version_check 0.9.3 +https://github.com/SergioBenitez/version_check +by Sergio Benitez +Tiny crate to check the version of the installed/running rustc. +License: MIT/Apache-2.0 ---------------------------------------------------- LICENSE-MIT: @@ -14124,13 +13919,6 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -==================================================== -wasi 0.10.2+wasi-snapshot-preview1 -https://github.com/bytecodealliance/wasi -by The Cranelift Project Developers -Experimental WASI API bindings for Rust -License: Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT ---------------------------------------------------- LICENSE-APACHE: @@ -14336,6 +14124,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +==================================================== +wasi 0.10.2+wasi-snapshot-preview1 +https://github.com/bytecodealliance/wasi +by The Cranelift Project Developers +Experimental WASI API bindings for Rust +License: Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT ---------------------------------------------------- LICENSE-Apache-2.0_WITH_LLVM-exception: @@ -14587,6 +14382,211 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +---------------------------------------------------- +LICENSE-APACHE: + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + ==================================================== wide 0.7.1 @@ -14616,6 +14616,29 @@ https://github.com/retep998/winapi-rs by Peter Atashian Raw FFI bindings for all of Windows API. License: MIT/Apache-2.0 +---------------------------------------------------- +LICENSE-MIT: + +Copyright (c) 2015-2018 The winapi-rs Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ---------------------------------------------------- LICENSE-APACHE: @@ -14821,29 +14844,6 @@ LICENSE-APACHE: See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------- -LICENSE-MIT: - -Copyright (c) 2015-2018 The winapi-rs Developers - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ==================================================== winapi-i686-pc-windows-gnu 0.4.0 diff --git a/roqoqo-derive/Cargo.toml b/roqoqo-derive/Cargo.toml index 200169aa..5084e3f1 100644 --- a/roqoqo-derive/Cargo.toml +++ b/roqoqo-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "roqoqo-derive" -version = "0.8.0" +version = "0.8.1" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" edition = "2021" diff --git a/roqoqo-test/Cargo.toml b/roqoqo-test/Cargo.toml index 678d7b5d..b7560dfe 100644 --- a/roqoqo-test/Cargo.toml +++ b/roqoqo-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "roqoqo-test" -version = "0.8.0" +version = "0.8.1" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" edition = "2021" @@ -18,7 +18,7 @@ doctest = false crate-type = ["rlib"] [dependencies] -qoqo_calculator = { version="0.3" } +qoqo_calculator = { version="0.5" } roqoqo = {version="0.8", path="../roqoqo", features=["serialize"]} rand = "0.8" nalgebra = "0.29" diff --git a/roqoqo/Cargo.toml b/roqoqo/Cargo.toml index f8e3af65..9b420fd7 100644 --- a/roqoqo/Cargo.toml +++ b/roqoqo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "roqoqo" -version = "0.8.0" +version = "0.8.1" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" edition = "2021" @@ -27,7 +27,7 @@ ndarray = { version = "0.15" } num-complex = { version = "0.4"} thiserror = "1.0" dyn-clone = {version="1.0", optional=true} -qoqo_calculator = { version="0.3" } +qoqo_calculator = { version="0.5" } roqoqo-derive = {version="0.8", path="../roqoqo-derive"} typetag = {version="0.1", optional=true} nalgebra = "0.29" diff --git a/roqoqo/coveragehtml/amber.png b/roqoqo/coveragehtml/amber.png new file mode 100644 index 0000000000000000000000000000000000000000..2cab170d8359081983a4e343848dfe06bc490f12 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^G2tW}LqE04T&+ z;1OBOz`!j8!i<;h*8KqrvZOouIx;Y9?C1WI$O`1M1^9%x{(levWG?NMQuI!iC1^Jb!lvI6;R0X`wF(yt=9xVZRt1vCRixIA4P dLn>}1Cji+@42)0J?}79&c)I$ztaD0e0sy@GAL0N2 literal 0 HcmV?d00001 diff --git a/roqoqo/coveragehtml/gcov.css b/roqoqo/coveragehtml/gcov.css new file mode 100644 index 00000000..bfd0a83e --- /dev/null +++ b/roqoqo/coveragehtml/gcov.css @@ -0,0 +1,519 @@ +/* All views: initial background and text color */ +body +{ + color: #000000; + background-color: #FFFFFF; +} + +/* All views: standard link format*/ +a:link +{ + color: #284FA8; + text-decoration: underline; +} + +/* All views: standard link - visited format */ +a:visited +{ + color: #00CB40; + text-decoration: underline; +} + +/* All views: standard link - activated format */ +a:active +{ + color: #FF0040; + text-decoration: underline; +} + +/* All views: main title format */ +td.title +{ + text-align: center; + padding-bottom: 10px; + font-family: sans-serif; + font-size: 20pt; + font-style: italic; + font-weight: bold; +} + +/* All views: header item format */ +td.headerItem +{ + text-align: right; + padding-right: 6px; + font-family: sans-serif; + font-weight: bold; + vertical-align: top; + white-space: nowrap; +} + +/* All views: header item value format */ +td.headerValue +{ + text-align: left; + color: #284FA8; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; +} + +/* All views: header item coverage table heading */ +td.headerCovTableHead +{ + text-align: center; + padding-right: 6px; + padding-left: 6px; + padding-bottom: 0px; + font-family: sans-serif; + font-size: 80%; + white-space: nowrap; +} + +/* All views: header item coverage table entry */ +td.headerCovTableEntry +{ + text-align: right; + color: #284FA8; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #DAE7FE; +} + +/* All views: header item coverage table entry for high coverage rate */ +td.headerCovTableEntryHi +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #A7FC9D; +} + +/* All views: header item coverage table entry for medium coverage rate */ +td.headerCovTableEntryMed +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #FFEA20; +} + +/* All views: header item coverage table entry for ow coverage rate */ +td.headerCovTableEntryLo +{ + text-align: right; + color: #000000; + font-family: sans-serif; + font-weight: bold; + white-space: nowrap; + padding-left: 12px; + padding-right: 4px; + background-color: #FF0000; +} + +/* All views: header legend value for legend entry */ +td.headerValueLeg +{ + text-align: left; + color: #000000; + font-family: sans-serif; + font-size: 80%; + white-space: nowrap; + padding-top: 4px; +} + +/* All views: color of horizontal ruler */ +td.ruler +{ + background-color: #6688D4; +} + +/* All views: version string format */ +td.versionInfo +{ + text-align: center; + padding-top: 2px; + font-family: sans-serif; + font-style: italic; +} + +/* Directory view/File view (all)/Test case descriptions: + table headline format */ +td.tableHead +{ + text-align: center; + color: #FFFFFF; + background-color: #6688D4; + font-family: sans-serif; + font-size: 120%; + font-weight: bold; + white-space: nowrap; + padding-left: 4px; + padding-right: 4px; +} + +span.tableHeadSort +{ + padding-right: 4px; +} + +/* Directory view/File view (all): filename entry format */ +td.coverFile +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284FA8; + background-color: #DAE7FE; + font-family: monospace; +} + +/* Directory view/File view (all): bar-graph entry format*/ +td.coverBar +{ + padding-left: 10px; + padding-right: 10px; + background-color: #DAE7FE; +} + +/* Directory view/File view (all): bar-graph outline color */ +td.coverBarOutline +{ + background-color: #000000; +} + +/* Directory view/File view (all): percentage entry for files with + high coverage rate */ +td.coverPerHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #A7FC9D; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + high coverage rate */ +td.coverNumHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #A7FC9D; + white-space: nowrap; + font-family: sans-serif; +} + +/* Directory view/File view (all): percentage entry for files with + medium coverage rate */ +td.coverPerMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FFEA20; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + medium coverage rate */ +td.coverNumMed +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FFEA20; + white-space: nowrap; + font-family: sans-serif; +} + +/* Directory view/File view (all): percentage entry for files with + low coverage rate */ +td.coverPerLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FF0000; + font-weight: bold; + font-family: sans-serif; +} + +/* Directory view/File view (all): line count entry for files with + low coverage rate */ +td.coverNumLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FF0000; + white-space: nowrap; + font-family: sans-serif; +} + +/* File view (all): "show/hide details" link format */ +a.detail:link +{ + color: #B8D0FF; + font-size:80%; +} + +/* File view (all): "show/hide details" link - visited format */ +a.detail:visited +{ + color: #B8D0FF; + font-size:80%; +} + +/* File view (all): "show/hide details" link - activated format */ +a.detail:active +{ + color: #FFFFFF; + font-size:80%; +} + +/* File view (detail): test name entry */ +td.testName +{ + text-align: right; + padding-right: 10px; + background-color: #DAE7FE; + font-family: sans-serif; +} + +/* File view (detail): test percentage entry */ +td.testPer +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #DAE7FE; + font-family: sans-serif; +} + +/* File view (detail): test lines count entry */ +td.testNum +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #DAE7FE; + font-family: sans-serif; +} + +/* Test case descriptions: test name format*/ +dt +{ + font-family: sans-serif; + font-weight: bold; +} + +/* Test case descriptions: description table body */ +td.testDescription +{ + padding-top: 10px; + padding-left: 30px; + padding-bottom: 10px; + padding-right: 30px; + background-color: #DAE7FE; +} + +/* Source code view: function entry */ +td.coverFn +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284FA8; + background-color: #DAE7FE; + font-family: monospace; +} + +/* Source code view: function entry zero count*/ +td.coverFnLo +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FF0000; + font-weight: bold; + font-family: sans-serif; +} + +/* Source code view: function entry nonzero count*/ +td.coverFnHi +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #DAE7FE; + font-weight: bold; + font-family: sans-serif; +} + +/* Source code view: source code format */ +pre.source +{ + font-family: monospace; + white-space: pre; + margin-top: 2px; +} + +/* Source code view: line number format */ +span.lineNum +{ + background-color: #EFE383; +} + +/* Source code view: format for lines which were executed */ +td.lineCov, +span.lineCov +{ + background-color: #CAD7FE; +} + +/* Source code view: format for Cov legend */ +span.coverLegendCov +{ + padding-left: 10px; + padding-right: 10px; + padding-bottom: 2px; + background-color: #CAD7FE; +} + +/* Source code view: format for lines which were not executed */ +td.lineNoCov, +span.lineNoCov +{ + background-color: #FF6230; +} + +/* Source code view: format for NoCov legend */ +span.coverLegendNoCov +{ + padding-left: 10px; + padding-right: 10px; + padding-bottom: 2px; + background-color: #FF6230; +} + +/* Source code view (function table): standard link - visited format */ +td.lineNoCov > a:visited, +td.lineCov > a:visited +{ + color: black; + text-decoration: underline; +} + +/* Source code view: format for lines which were executed only in a + previous version */ +span.lineDiffCov +{ + background-color: #B5F7AF; +} + +/* Source code view: format for branches which were executed + * and taken */ +span.branchCov +{ + background-color: #CAD7FE; +} + +/* Source code view: format for branches which were executed + * but not taken */ +span.branchNoCov +{ + background-color: #FF6230; +} + +/* Source code view: format for branches which were not executed */ +span.branchNoExec +{ + background-color: #FF6230; +} + +/* Source code view: format for the source code heading line */ +pre.sourceHeading +{ + white-space: pre; + font-family: monospace; + font-weight: bold; + margin: 0px; +} + +/* All views: header legend value for low rate */ +td.headerValueLegL +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 4px; + padding-right: 2px; + background-color: #FF0000; + font-size: 80%; +} + +/* All views: header legend value for med rate */ +td.headerValueLegM +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 2px; + padding-right: 2px; + background-color: #FFEA20; + font-size: 80%; +} + +/* All views: header legend value for hi rate */ +td.headerValueLegH +{ + font-family: sans-serif; + text-align: center; + white-space: nowrap; + padding-left: 2px; + padding-right: 4px; + background-color: #A7FC9D; + font-size: 80%; +} + +/* All views except source code view: legend format for low coverage */ +span.coverLegendCovLo +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #FF0000; +} + +/* All views except source code view: legend format for med coverage */ +span.coverLegendCovMed +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #FFEA20; +} + +/* All views except source code view: legend format for hi coverage */ +span.coverLegendCovHi +{ + padding-left: 10px; + padding-right: 10px; + padding-top: 2px; + background-color: #A7FC9D; +} diff --git a/roqoqo/coveragehtml/glass.png b/roqoqo/coveragehtml/glass.png new file mode 100644 index 0000000000000000000000000000000000000000..e1abc00680a3093c49fdb775ae6bdb6764c95af2 GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)gaEa{HEjtmSN`?>!lvI6;R0X`wF z|Ns97GD8ntt^-nxB|(0{3=Yq3q=7g|-tI089jvk*Kn`btM`SSr1Gf+eGhVt|_XjA* zUgGKN%6^Gmn4d%Ph(nkFP>9RZ#WAE}PI3Z}&BVayv3^M*kj3EX>gTe~DWM4f=_Dpv literal 0 HcmV?d00001 diff --git a/roqoqo/coveragehtml/index-sort-f.html b/roqoqo/coveragehtml/index-sort-f.html new file mode 100644 index 00000000..3dc26306 --- /dev/null +++ b/roqoqo/coveragehtml/index-sort-f.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.lcov + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelHitTotalCoverage
Test:coverage.lcovLines:2922298198.0 %
Date:2021-11-09 13:25:48Functions:1330136197.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
src +
93.8%93.8%
+
93.8 %320 / 34183.9 %73 / 87
src/operations +
98.5%98.5%
+
98.5 %2132 / 216598.6 %1191 / 1208
src/measurements +
98.9%98.9%
+
98.9 %470 / 475100.0 %66 / 66
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/index-sort-l.html b/roqoqo/coveragehtml/index-sort-l.html new file mode 100644 index 00000000..8221fb59 --- /dev/null +++ b/roqoqo/coveragehtml/index-sort-l.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.lcov + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelHitTotalCoverage
Test:coverage.lcovLines:2922298198.0 %
Date:2021-11-09 13:25:48Functions:1330136197.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
src +
93.8%93.8%
+
93.8 %320 / 34183.9 %73 / 87
src/operations +
98.5%98.5%
+
98.5 %2132 / 216598.6 %1191 / 1208
src/measurements +
98.9%98.9%
+
98.9 %470 / 475100.0 %66 / 66
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/index.html b/roqoqo/coveragehtml/index.html new file mode 100644 index 00000000..4b97ecc8 --- /dev/null +++ b/roqoqo/coveragehtml/index.html @@ -0,0 +1,113 @@ + + + + + + + LCOV - coverage.lcov + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top levelHitTotalCoverage
Test:coverage.lcovLines:2922298198.0 %
Date:2021-11-09 13:25:48Functions:1330136197.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Directory Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
src +
93.8%93.8%
+
93.8 %320 / 34183.9 %73 / 87
src/measurements +
98.9%98.9%
+
98.9 %470 / 475100.0 %66 / 66
src/operations +
98.5%98.5%
+
98.5 %2132 / 216598.6 %1191 / 1208
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/ruby.png b/roqoqo/coveragehtml/ruby.png new file mode 100644 index 0000000000000000000000000000000000000000..991b6d4ec9e78be165e3ef757eed1aada287364d GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^FceV#7`HfI^%F z9+AZi4BSE>%y{W;-5;PJOS+@4BLl<6e(pbstUx|nfKQ0)e^Y%R^MdiLxj>4`)5S5Q b;#P73kj=!v_*DHKNFRfztDnm{r-UW|iOwIS literal 0 HcmV?d00001 diff --git a/roqoqo/coveragehtml/snow.png b/roqoqo/coveragehtml/snow.png new file mode 100644 index 0000000000000000000000000000000000000000..2cdae107fceec6e7f02ac7acb4a34a82a540caa5 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga>?NMQuI!iC1^MM!lvI6;R0X`wF|Ns97GD8ntt^-nBo-U3d c6}OTTfNUlP#;5A{K>8RwUHx3vIVCg!071?oo&W#< literal 0 HcmV?d00001 diff --git a/roqoqo/coveragehtml/src/backends.rs.func-sort-c.html b/roqoqo/coveragehtml/src/backends.rs.func-sort-c.html new file mode 100644 index 00000000..8d1d4edc --- /dev/null +++ b/roqoqo/coveragehtml/src/backends.rs.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.lcov - src/backends.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - backends.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:264261.9 %
Date:2021-11-09 13:25:48Functions:77100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement::<roqoqo::measurements::basis_rotation_measurement::BasisRotation>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement::<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement::<roqoqo::measurements::cheated_measurement::Cheated>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement_registers::<roqoqo::measurements::basis_rotation_measurement::BasisRotation>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement_registers::<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement_registers::<roqoqo::measurements::cheated_measurement::Cheated>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement_registers::<roqoqo::measurements::classical_register_measurement::ClassicalRegister>1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/backends.rs.func.html b/roqoqo/coveragehtml/src/backends.rs.func.html new file mode 100644 index 00000000..85f6becb --- /dev/null +++ b/roqoqo/coveragehtml/src/backends.rs.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.lcov - src/backends.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - backends.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:264261.9 %
Date:2021-11-09 13:25:48Functions:77100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement::<roqoqo::measurements::basis_rotation_measurement::BasisRotation>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement::<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement::<roqoqo::measurements::cheated_measurement::Cheated>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement_registers::<roqoqo::measurements::basis_rotation_measurement::BasisRotation>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement_registers::<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement_registers::<roqoqo::measurements::cheated_measurement::Cheated>1
<integration::quantum_program::TestBackend as roqoqo::backends::EvaluatingBackend>::run_measurement_registers::<roqoqo::measurements::classical_register_measurement::ClassicalRegister>1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/backends.rs.gcov.html b/roqoqo/coveragehtml/src/backends.rs.gcov.html new file mode 100644 index 00000000..431b64ac --- /dev/null +++ b/roqoqo/coveragehtml/src/backends.rs.gcov.html @@ -0,0 +1,253 @@ + + + + + + + LCOV - coverage.lcov - src/backends.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - backends.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:264261.9 %
Date:2021-11-09 13:25:48Functions:77100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : //! Traits defining the standard form of roqoqo backends.
+      14             : //!
+      15             : //! roqoqo can be used to implement interfaces and backends to quantum hardware, quantum simulators and other software packages.
+      16             : //! While roqoqo does not require a certain design for general interfaces or backends,
+      17             : //! roqoqo::backends provides a trait for implementing backends that produce measurement results which can be evaluated to
+      18             : //! expectation values.
+      19             : //! This trait is supposed to be implemented for backends connecting to quantum simulators or to real quantum hardware devices.
+      20             : //!
+      21             : //! Note: The following backends are implemented in roqoqo and supported by HQS Quantum Simulations GmbH.
+      22             : //!
+      23             : //! Evaluated backends:
+      24             : //! * `aqt`,
+      25             : //! * `MockedBackend` ( <https://github.com/HQSquantumsimulations/qoqo_mock> ),
+      26             : //! * `PyQuestBackend` ( <https://github.com/HQSquantumsimulations/qoqo_pyquest> ).
+      27             : //!
+      28             : //! Other backends:
+      29             : //! * `qasm` ( <https://github.com/HQSquantumsimulations/qoqo_qasm> ).
+      30             : 
+      31             : use std::collections::HashMap;
+      32             : 
+      33             : use crate::operations::Operation;
+      34             : use crate::registers::{BitOutputRegister, ComplexOutputRegister, FloatOutputRegister};
+      35             : use crate::Circuit;
+      36             : use crate::{
+      37             :     measurements::{Measure, MeasureExpectationValues},
+      38             :     RoqoqoBackendError,
+      39             : };
+      40             : 
+      41             : /// Result of functions running a full circuit and producing output registers.
+      42             : pub type RegisterResult = Result<
+      43             :     (
+      44             :         HashMap<String, BitOutputRegister>,
+      45             :         HashMap<String, FloatOutputRegister>,
+      46             :         HashMap<String, ComplexOutputRegister>,
+      47             :     ),
+      48             :     RoqoqoBackendError,
+      49             : >;
+      50             : 
+      51             : /// Trait for Backends that can evaluate measurements to expectation values.
+      52             : pub trait EvaluatingBackend: Sized {
+      53             :     /// Runs a circuit with the backend.
+      54             :     ///
+      55             :     /// A circuit is passed to the backend and executed.
+      56             :     /// During execution values are written to and read from classical registers
+      57             :     /// ([crate::registers::BitRegister], [crate::registers::FloatRegister] and [crate::registers::ComplexRegister]).
+      58             :     /// To produce sufficient statistics for evaluating expectationg values,
+      59             :     /// circuits have to be run multiple times.
+      60             :     /// The results of each repetition are concatenated in OutputRegisters
+      61             :     /// ([crate::registers::BitOutputRegister], [crate::registers::FloatOutputRegister] and [crate::registers::ComplexOutputRegister]).  
+      62             :     ///
+      63             :     ///
+      64             :     /// # Arguments
+      65             :     ///
+      66             :     /// * `circuit` - The circuit that is run on the backend.
+      67             :     ///
+      68             :     /// # Returns
+      69             :     ///
+      70             :     /// `RegisterResult` - The output registers written by the evaluated circuits.
+      71             :     fn run_circuit(&self, circuit: &Circuit) -> RegisterResult {
+      72             :         self.run_circuit_iterator(circuit.iter())
+      73             :     }
+      74             : 
+      75             :     /// Runs each operation obtained from an iterator over operations on the backend.
+      76             :     ///
+      77             :     /// An iterator over operations is passed to the backend and executed.
+      78             :     /// During execution values are written to and read from classical registers
+      79             :     /// ([crate::registers::BitRegister], [crate::registers::FloatRegister] and [crate::registers::ComplexRegister]).
+      80             :     /// To produce sufficient statistics for evaluating expectationg values,
+      81             :     /// circuits have to be run multiple times.
+      82             :     /// The results of each repetition are concatenated in OutputRegisters
+      83             :     /// ([crate::registers::BitOutputRegister], [crate::registers::FloatOutputRegister] and [crate::registers::ComplexOutputRegister]).  
+      84             :     ///
+      85             :     ///
+      86             :     /// # Arguments
+      87             :     ///
+      88             :     /// * `circuit` - The iterator over operations that is run on the backend (corresponds to a circuit).
+      89             :     ///
+      90             :     /// # Returns
+      91             :     ///
+      92             :     /// `RegisterResult` - The output registers written by the evaluated circuits.
+      93             :     fn run_circuit_iterator<'a>(
+      94             :         &self,
+      95             :         circuit: impl Iterator<Item = &'a Operation>,
+      96             :     ) -> RegisterResult;
+      97             : 
+      98             :     /// Runs all circuits corresponding to one measurement with the backend.
+      99             :     ///
+     100             :     /// An expectation value measurement in general involves several circuits.
+     101             :     /// Each circuit is passes to the backend and executed separately.
+     102             :     /// During execution values are written to and read from classical registers
+     103             :     /// ([crate::registers::BitRegister], [crate::registers::FloatRegister] and [crate::registers::ComplexRegister]).
+     104             :     /// To produce sufficient statistics for evaluating expectationg values,
+     105             :     /// circuits have to be run multiple times.
+     106             :     /// The results of each repetition are concatenated in OutputRegisters
+     107             :     /// ([crate::registers::BitOutputRegister], [crate::registers::FloatOutputRegister] and [crate::registers::ComplexOutputRegister]).  
+     108             :     /// At the end all OutputRegisters are combined in a single HashMap for each type of register.
+     109             :     ///
+     110             :     /// # Arguments
+     111             :     ///
+     112             :     /// * `measurement` - The measurement that is run on the backend.
+     113             :     ///
+     114             :     /// # Returns
+     115             :     ///
+     116             :     /// `RegisterResult` - The output registers written by the evaluated measurement circuits.
+     117           4 :     fn run_measurement_registers<T>(&self, measurement: &T) -> RegisterResult
+     118           4 :     where
+     119           4 :         T: Measure,
+     120           4 :     {
+     121           4 :         let mut bit_registers: HashMap<String, BitOutputRegister> = HashMap::new();
+     122           4 :         let mut float_registers: HashMap<String, FloatOutputRegister> = HashMap::new();
+     123           4 :         let mut complex_registers: HashMap<String, ComplexOutputRegister> = HashMap::new();
+     124             : 
+     125           4 :         for circuit in measurement.circuits() {
+     126           4 :             let (tmp_bit_reg, tmp_float_reg, tmp_complex_reg) = match measurement.constant_circuit()
+     127             :             {
+     128           4 :                 Some(x) => self.run_circuit_iterator(x.iter().chain(circuit.iter()))?,
+     129           0 :                 None => self.run_circuit_iterator(circuit.iter())?,
+     130             :             };
+     131             : 
+     132           4 :             for (key, mut val) in tmp_bit_reg.into_iter() {
+     133           0 :                 if let Some(x) = bit_registers.get_mut(&key) {
+     134           0 :                     x.append(&mut val);
+     135           0 :                 } else {
+     136           0 :                     let _ = bit_registers.insert(key, val);
+     137           0 :                 }
+     138             :             }
+     139           4 :             for (key, mut val) in tmp_float_reg.into_iter() {
+     140           0 :                 if let Some(x) = float_registers.get_mut(&key) {
+     141           0 :                     x.append(&mut val);
+     142           0 :                 } else {
+     143           0 :                     let _ = float_registers.insert(key, val);
+     144           0 :                 }
+     145             :             }
+     146           4 :             for (key, mut val) in tmp_complex_reg.into_iter() {
+     147           0 :                 if let Some(x) = complex_registers.get_mut(&key) {
+     148           0 :                     x.append(&mut val);
+     149           0 :                 } else {
+     150           0 :                     let _ = complex_registers.insert(key, val);
+     151           0 :                 }
+     152             :             }
+     153             :         }
+     154           4 :         Ok((bit_registers, float_registers, complex_registers))
+     155           4 :     }
+     156             :     /// Evaluates expectation values of a measurement with the backend.
+     157             :     ///
+     158             :     /// # Arguments
+     159             :     ///
+     160             :     /// * `measurement` - The measurement that is run on the backend.
+     161             :     ///
+     162             :     /// # Returns
+     163             :     ///
+     164             :     /// `Ok(Option<HashMap<String, f64>>)` - The HashMap of measurement results.
+     165             :     /// `Err(RoqoqoBackendError)` - The measurement run failed.
+     166           3 :     fn run_measurement<T>(
+     167           3 :         &self,
+     168           3 :         measurement: &T,
+     169           3 :     ) -> Result<Option<HashMap<String, f64>>, RoqoqoBackendError>
+     170           3 :     where
+     171           3 :         T: MeasureExpectationValues,
+     172           3 :     {
+     173           3 :         let (bit_registers, float_registers, complex_registers) =
+     174           3 :             self.run_measurement_registers(measurement)?;
+     175           3 :         Ok(measurement.evaluate(bit_registers, float_registers, complex_registers)?)
+     176           3 :     }
+     177             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/circuit.rs.func-sort-c.html b/roqoqo/coveragehtml/src/circuit.rs.func-sort-c.html new file mode 100644 index 00000000..c9a52048 --- /dev/null +++ b/roqoqo/coveragehtml/src/circuit.rs.func-sort-c.html @@ -0,0 +1,308 @@ + + + + + + + LCOV - coverage.lcov - src/circuit.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - circuit.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:24124598.4 %
Date:2021-11-09 13:25:48Functions:555993.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::circuit::Circuit as core::iter::traits::collect::Extend<_>>::extend::<_>0
<roqoqo::circuit::Circuit as core::iter::traits::collect::FromIterator<_>>::from_iter::<_>0
<roqoqo::circuit::Circuit as core::ops::arith::Add<_>>::add0
<roqoqo::circuit::Circuit>::is_parametrized::{closure#1}0
<roqoqo::circuit::Circuit as core::cmp::PartialEq>::eq1
<roqoqo::circuit::Circuit as core::cmp::PartialEq>::ne1
<roqoqo::circuit::Circuit as core::default::Default>::default1
<roqoqo::circuit::Circuit as core::fmt::Debug>::fmt1
<roqoqo::circuit::Circuit as core::fmt::Display>::fmt1
<roqoqo::circuit::Circuit as core::iter::traits::collect::Extend<roqoqo::operations::Operation>>::extend::<roqoqo::circuit::OperationIterator>1
<roqoqo::circuit::Circuit as core::iter::traits::collect::FromIterator<roqoqo::operations::Operation>>::from_iter::<roqoqo::circuit::OperationIterator>1
<roqoqo::circuit::Circuit as core::iter::traits::collect::IntoIterator>::into_iter1
<roqoqo::circuit::Circuit as core::ops::arith::Add<&roqoqo::circuit::Circuit>>::add1
<roqoqo::circuit::Circuit as core::ops::arith::Add<roqoqo::operations::Operation>>::add1
<roqoqo::circuit::Circuit as core::ops::arith::Add>::add1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<&roqoqo::circuit::Circuit>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::Operation>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::single_qubit_gate_operations::Hadamard>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::single_qubit_gate_operations::RotateX>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::single_qubit_gate_operations::RotateY>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::single_qubit_gate_operations::RotateZ>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::two_qubit_gate_operations::CNOT>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign>::add_assign1
<roqoqo::circuit::Circuit as core::ops::index::Index<usize>>::index1
<roqoqo::circuit::Circuit as core::ops::index::IndexMut<usize>>::index_mut1
<roqoqo::circuit::Circuit as roqoqo::circuit::AsVec<core::ops::range::Range<usize>>>::as_vec1
<roqoqo::circuit::Circuit as roqoqo::circuit::AsVec<core::ops::range::RangeFrom<usize>>>::as_vec1
<roqoqo::circuit::Circuit as roqoqo::circuit::AsVec<core::ops::range::RangeTo<usize>>>::as_vec1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::Operation>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::define_operations::DefinitionBit>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::define_operations::DefinitionFloat>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::define_operations::InputSymbolic>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::Hadamard>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::PauliX>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::PauliZ>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::RotateX>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::RotateY>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::RotateZ>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::two_qubit_gate_operations::CNOT>1
<roqoqo::circuit::Circuit>::count_occurences1
<roqoqo::circuit::Circuit>::count_occurences::{closure#0}1
<roqoqo::circuit::Circuit>::definitions1
<roqoqo::circuit::Circuit>::get1
<roqoqo::circuit::Circuit>::get_mut1
<roqoqo::circuit::Circuit>::get_operation_types1
<roqoqo::circuit::Circuit>::involved_qubits1
<roqoqo::circuit::Circuit>::is_empty1
<roqoqo::circuit::Circuit>::is_parametrized1
<roqoqo::circuit::Circuit>::is_parametrized::{closure#0}1
<roqoqo::circuit::Circuit>::iter1
<roqoqo::circuit::Circuit>::len1
<roqoqo::circuit::Circuit>::new1
<roqoqo::circuit::Circuit>::operations1
<roqoqo::circuit::Circuit>::remap_qubits1
<roqoqo::circuit::Circuit>::substitute_parameters1
<roqoqo::circuit::OperationIterator as core::clone::Clone>::clone1
<roqoqo::circuit::OperationIterator as core::fmt::Debug>::fmt1
<roqoqo::circuit::OperationIterator as core::iter::traits::iterator::Iterator>::next1
<roqoqo::circuit::Circuit as core::clone::Clone>::clone2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/circuit.rs.func.html b/roqoqo/coveragehtml/src/circuit.rs.func.html new file mode 100644 index 00000000..8411b89b --- /dev/null +++ b/roqoqo/coveragehtml/src/circuit.rs.func.html @@ -0,0 +1,308 @@ + + + + + + + LCOV - coverage.lcov - src/circuit.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - circuit.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:24124598.4 %
Date:2021-11-09 13:25:48Functions:555993.2 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::circuit::Circuit as core::clone::Clone>::clone2
<roqoqo::circuit::Circuit as core::cmp::PartialEq>::eq1
<roqoqo::circuit::Circuit as core::cmp::PartialEq>::ne1
<roqoqo::circuit::Circuit as core::default::Default>::default1
<roqoqo::circuit::Circuit as core::fmt::Debug>::fmt1
<roqoqo::circuit::Circuit as core::fmt::Display>::fmt1
<roqoqo::circuit::Circuit as core::iter::traits::collect::Extend<_>>::extend::<_>0
<roqoqo::circuit::Circuit as core::iter::traits::collect::Extend<roqoqo::operations::Operation>>::extend::<roqoqo::circuit::OperationIterator>1
<roqoqo::circuit::Circuit as core::iter::traits::collect::FromIterator<_>>::from_iter::<_>0
<roqoqo::circuit::Circuit as core::iter::traits::collect::FromIterator<roqoqo::operations::Operation>>::from_iter::<roqoqo::circuit::OperationIterator>1
<roqoqo::circuit::Circuit as core::iter::traits::collect::IntoIterator>::into_iter1
<roqoqo::circuit::Circuit as core::ops::arith::Add<&roqoqo::circuit::Circuit>>::add1
<roqoqo::circuit::Circuit as core::ops::arith::Add<_>>::add0
<roqoqo::circuit::Circuit as core::ops::arith::Add<roqoqo::operations::Operation>>::add1
<roqoqo::circuit::Circuit as core::ops::arith::Add>::add1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<&roqoqo::circuit::Circuit>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::Operation>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::single_qubit_gate_operations::Hadamard>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::single_qubit_gate_operations::RotateX>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::single_qubit_gate_operations::RotateY>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::single_qubit_gate_operations::RotateZ>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign<roqoqo::operations::two_qubit_gate_operations::CNOT>>::add_assign1
<roqoqo::circuit::Circuit as core::ops::arith::AddAssign>::add_assign1
<roqoqo::circuit::Circuit as core::ops::index::Index<usize>>::index1
<roqoqo::circuit::Circuit as core::ops::index::IndexMut<usize>>::index_mut1
<roqoqo::circuit::Circuit as roqoqo::circuit::AsVec<core::ops::range::Range<usize>>>::as_vec1
<roqoqo::circuit::Circuit as roqoqo::circuit::AsVec<core::ops::range::RangeFrom<usize>>>::as_vec1
<roqoqo::circuit::Circuit as roqoqo::circuit::AsVec<core::ops::range::RangeTo<usize>>>::as_vec1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::Operation>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::define_operations::DefinitionBit>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::define_operations::DefinitionFloat>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::define_operations::InputSymbolic>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::Hadamard>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::PauliX>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::PauliZ>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::RotateX>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::RotateY>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::single_qubit_gate_operations::RotateZ>1
<roqoqo::circuit::Circuit>::add_operation::<roqoqo::operations::two_qubit_gate_operations::CNOT>1
<roqoqo::circuit::Circuit>::count_occurences1
<roqoqo::circuit::Circuit>::count_occurences::{closure#0}1
<roqoqo::circuit::Circuit>::definitions1
<roqoqo::circuit::Circuit>::get1
<roqoqo::circuit::Circuit>::get_mut1
<roqoqo::circuit::Circuit>::get_operation_types1
<roqoqo::circuit::Circuit>::involved_qubits1
<roqoqo::circuit::Circuit>::is_empty1
<roqoqo::circuit::Circuit>::is_parametrized1
<roqoqo::circuit::Circuit>::is_parametrized::{closure#0}1
<roqoqo::circuit::Circuit>::is_parametrized::{closure#1}0
<roqoqo::circuit::Circuit>::iter1
<roqoqo::circuit::Circuit>::len1
<roqoqo::circuit::Circuit>::new1
<roqoqo::circuit::Circuit>::operations1
<roqoqo::circuit::Circuit>::remap_qubits1
<roqoqo::circuit::Circuit>::substitute_parameters1
<roqoqo::circuit::OperationIterator as core::clone::Clone>::clone1
<roqoqo::circuit::OperationIterator as core::fmt::Debug>::fmt1
<roqoqo::circuit::OperationIterator as core::iter::traits::iterator::Iterator>::next1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/circuit.rs.gcov.html b/roqoqo/coveragehtml/src/circuit.rs.gcov.html new file mode 100644 index 00000000..7785c439 --- /dev/null +++ b/roqoqo/coveragehtml/src/circuit.rs.gcov.html @@ -0,0 +1,875 @@ + + + + + + + LCOV - coverage.lcov - src/circuit.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - circuit.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:24124598.4 %
Date:2021-11-09 13:25:48Functions:555993.2 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use crate::operations::{Define, InvolveQubits, InvolvedQubits, Operate, Operation, Substitute};
+      14             : #[cfg(feature = "overrotate")]
+      15             : use crate::operations::{Rotate, Rotation};
+      16             : use crate::RoqoqoError;
+      17             : use qoqo_calculator::Calculator;
+      18             : #[cfg(feature = "overrotate")]
+      19             : use std::convert::TryFrom;
+      20             : use std::ops;
+      21             : use std::{
+      22             :     collections::{HashMap, HashSet},
+      23             :     usize,
+      24             : };
+      25             : use std::{
+      26             :     fmt::{Display, Formatter},
+      27             :     iter::{FromIterator, IntoIterator},
+      28             : };
+      29             : 
+      30             : /// Represents a quantum circuit in roqoqo.
+      31             : ///
+      32             : /// In roqoqo, single operations are collected in a circuit to build up a quantum program.
+      33             : /// Roqoqo circuits are strictly linear sequences of operations.
+      34             : /// The circuit struct behaves similar to a list and provides several standard
+      35             : /// functions of a Vec<Operation>, such as len(), is_empty(), get(), iter() and into_iter().
+      36             : ///
+      37             : /// # Example
+      38             : ///
+      39             : /// ```
+      40             : /// use roqoqo::Circuit;
+      41             : /// use roqoqo::operations::{Operation, RotateX};
+      42             : /// use qoqo_calculator::CalculatorFloat;
+      43             : /// // creating circuit
+      44             : /// let mut circuit = Circuit::new();
+      45             : /// // adding operation to circuit
+      46             : /// circuit.add_operation(RotateX::new(0,CalculatorFloat::from(0)));
+      47             : /// assert_eq!(circuit.len(), 1);
+      48             : /// // iterating over circuit I
+      49             : /// let operation_vector: Vec<&Operation>= circuit.iter().collect();
+      50             : /// // iterating over circuit II
+      51             : /// for op in circuit{
+      52             : ///    println!("{:?}", op);
+      53             : /// }
+      54             : /// // collecting operations into circuit
+      55             : /// let vector = vec![Operation::from(RotateX::new(0,CalculatorFloat::from(0))), Operation::from(RotateX::new(0,CalculatorFloat::from(0)))];
+      56             : /// let new_circuit: Circuit = vector.into_iter().collect();
+      57             : /// ```
+      58             : ///
+      59             : /// Similarly to single Operations, Circuits can be translated to other frameworks via interfaces.
+      60             : ///
+      61             : /// For Circuits the following functions are defined:
+      62             : /// * `new()`: creates an empty Circuit
+      63             : /// * `add_operation(operation)`: adds the specified operation to the Circuit
+      64             : /// * `get(index)`: returns the operation at the specified index in the Circuit
+      65             : /// * `get_mut(index)`: returns mutable reference to the operation at the specified index in the Circuit
+      66             : /// * `iter()`: creates an iterator of the Circuit
+      67             : /// * `len()`: returns the length of the Circuit
+      68             : /// * `is_empty()`: returns a boolean of whether the Circuit contains any definitions and operations or not
+      69             : /// * `involved_qubits()`: returns the qubits invovlved in the whole Circuit
+      70             : /// * `definitions()`: returns the definitions in the Circuit
+      71             : /// * `operations()`: returns the operations in the Circuit
+      72             : /// * `substitute_parameters(calculator)`: substitutes any symbolic parameters in (a copy of) the Circuit according to the specified Calculator
+      73             : /// * `remap_qubits(mapping)`: remaps the qubits in (a copy of) the Circuit according to the specified mapping
+      74             : /// * `count_occurences(operations)`: returns the number of operations in the Circuit with the specified operation tags
+      75             : /// * `get_operation_types()`: returns a list of all of the operations in the Circuit (in hqslang)
+      76             : /// * `from_iter(iterator)`: creates a Circuit from the items in the specified iterator
+      77             : /// * `extend(iterator)`: adds the operations in the specified iterator to the Circuit
+      78             : /// * `default()`: creates an empty Circuit
+      79             : /// * `[...]`: gets a slice of the Circuit (returned as a vector)
+      80             : /// * `+` and `+=`: add two circuits or an operation to the Circuit
+      81             : ///
+      82          79 : #[derive(Debug, Clone, PartialEq)]
+      83             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      84             : pub struct Circuit {
+      85             :     /// Definitions in the quantum circuit, must be unique.
+      86             :     definitions: Vec<Operation>,
+      87             :     /// Operations of the quantum circuit, do not have to be unique.
+      88             :     operations: Vec<Operation>,
+      89             : }
+      90             : 
+      91             : impl Circuit {
+      92             :     /// Creates an empty quantum Circuit.
+      93             :     ///
+      94             :     /// # Returns
+      95             :     ///
+      96             :     /// * `Self` - The empty Circuit.
+      97         266 :     pub fn new() -> Self {
+      98         266 :         Circuit {
+      99         266 :             definitions: Vec::new(),
+     100         266 :             operations: Vec::new(),
+     101         266 :         }
+     102         266 :     }
+     103             :     /// Adds an Operation to Circuit (self).
+     104             :     ///
+     105             :     /// # Arguments
+     106             :     ///
+     107             :     /// * `op` - The Operation to add to the Circuit.
+     108         354 :     pub fn add_operation<T>(&mut self, op: T)
+     109         354 :     where
+     110         354 :         T: Into<Operation>,
+     111         354 :     {
+     112         354 :         let input: Operation = op.into();
+     113         354 :         match &input {
+     114           5 :             Operation::DefinitionBit(_) => self.definitions.push(input),
+     115          10 :             Operation::DefinitionFloat(_) => {
+     116          10 :                 self.definitions.push(input);
+     117          10 :             }
+     118           1 :             Operation::DefinitionComplex(_) => {
+     119           1 :                 self.definitions.push(input);
+     120           1 :             }
+     121           1 :             Operation::DefinitionUsize(_) => {
+     122           1 :                 self.definitions.push(input);
+     123           1 :             }
+     124           3 :             Operation::InputSymbolic(_) => {
+     125           3 :                 self.definitions.push(input);
+     126           3 :             }
+     127         334 :             _ => self.operations.push(input),
+     128             :         }
+     129         354 :     }
+     130             : 
+     131             :     /// Returns a reference to the element at index similar to std::Vec get function.
+     132             :     ///
+     133             :     /// Contrary to std::Vec get function not implemented for slices  .
+     134             :     ///
+     135             :     /// # Arguments
+     136             :     ///
+     137             :     /// * `index` - The index of the Operation to get in the Circuit.
+     138             :     ///
+     139             :     /// # Returns
+     140             :     ///
+     141             :     /// * `Option<&Operation>` - The operation at the given index (if it exists).
+     142          19 :     pub fn get(&self, index: usize) -> Option<&Operation> {
+     143          19 :         let def_len = self.definitions.len();
+     144          19 :         if index >= self.definitions.len() {
+     145          11 :             self.operations.get(index - def_len)
+     146             :         } else {
+     147           8 :             self.definitions.get(index)
+     148             :         }
+     149          19 :     }
+     150             : 
+     151             :     /// Returns a mutable reference to the element at index similar to std::Vec get function.
+     152             :     ///
+     153             :     /// Contrary to std::Vec get function not implemented for slices.
+     154             :     ///
+     155             :     /// # Arguments
+     156             :     ///
+     157             :     /// * `index` - The index of the Operation to get in the Circuit.
+     158             :     ///
+     159             :     /// # Returns
+     160             :     ///
+     161             :     /// * `Option<mut &Operation>` - A mutable reference to the operation at the given index (if it exists).
+     162           2 :     pub fn get_mut(&mut self, index: usize) -> Option<&mut Operation> {
+     163           2 :         let def_len = self.definitions.len();
+     164           2 :         if index >= self.definitions.len() {
+     165           1 :             self.operations.get_mut(index - def_len)
+     166             :         } else {
+     167           1 :             self.definitions.get_mut(index)
+     168             :         }
+     169           2 :     }
+     170             : 
+     171             :     /// Creates an iterator of the Circuit.
+     172             :     ///
+     173             :     /// # Returns
+     174             :     ///
+     175             :     /// `Iterator<Item = &Operation>` - The Circuit in iterator form.
+     176          20 :     pub fn iter(&self) -> impl Iterator<Item = &Operation> {
+     177          20 :         self.definitions.iter().chain(self.operations.iter())
+     178          20 :     }
+     179             : 
+     180             :     /// Returns true if the Circuit contains symbolic variables.
+     181             :     ///
+     182             :     /// # Returns
+     183             :     ///
+     184             :     /// * `bool` - True if the Circuit contains symbolic values, false if it does not.
+     185           4 :     pub fn is_parametrized(&self) -> bool {
+     186           4 :         self.operations.iter().any(|o| o.is_parametrized())
+     187           3 :             || self.definitions.iter().any(|o| o.is_parametrized())
+     188           4 :     }
+     189             : 
+     190             :     /// Returns the length of the Circuit.
+     191             :     ///
+     192             :     /// # Returns
+     193             :     ///
+     194             :     /// * `usize` - The length of the Circuit.
+     195           4 :     pub fn len(&self) -> usize {
+     196           4 :         self.definitions.len() + self.operations.len()
+     197           4 :     }
+     198             : 
+     199             :     /// Returns true if the Circuit does not contain any operations and definitions.
+     200             :     ///
+     201             :     /// # Returns
+     202             :     ///
+     203             :     /// * `bool` - True if the Circuit is empty, false if it is not.
+     204           3 :     pub fn is_empty(&self) -> bool {
+     205           3 :         self.definitions.is_empty() && self.operations.is_empty()
+     206           3 :     }
+     207             : 
+     208             :     /// Returns qubits the Circuit acts on.
+     209             :     ///
+     210             :     /// # Returns
+     211             :     ///
+     212             :     /// * `InvolvedQubits` - The qubits involved in the Circuit.
+     213           5 :     pub fn involved_qubits(&self) -> InvolvedQubits {
+     214           5 :         let mut temp_involved: HashSet<usize> = HashSet::new();
+     215           5 :         for op in self.operations.iter() {
+     216           5 :             match &op.involved_qubits() {
+     217             :                 InvolvedQubits::All => {
+     218           1 :                     return InvolvedQubits::All;
+     219             :                 }
+     220           1 :                 InvolvedQubits::None => (),
+     221           3 :                 InvolvedQubits::Set(x) => temp_involved = temp_involved.union(x).cloned().collect(),
+     222             :             }
+     223             :         }
+     224           4 :         match temp_involved.is_empty() {
+     225           1 :             true => InvolvedQubits::None,
+     226           3 :             false => InvolvedQubits::Set(temp_involved),
+     227             :         }
+     228           5 :     }
+     229             : 
+     230             :     /// Returns reference to the vector of definitions in Circuit.
+     231             :     ///
+     232             :     /// Definitions need to be unique.
+     233             :     ///
+     234             :     /// # Returns
+     235             :     ///
+     236             :     /// * `&Vec<Operation>` - A vector of the definitions in the Circuit.
+     237           2 :     pub fn definitions(&self) -> &Vec<Operation> {
+     238           2 :         &self.definitions
+     239           2 :     }
+     240             : 
+     241             :     /// Returns reference to the vector of quantum operations in Circuit.
+     242             :     ///
+     243             :     /// Operations do not need to be unique.
+     244             :     ///
+     245             :     /// # Returns
+     246             :     ///
+     247             :     /// * `&Vec<Operation>` - A vector of the operations in the Circuit.
+     248          25 :     pub fn operations(&self) -> &Vec<Operation> {
+     249          25 :         &self.operations
+     250          25 :     }
+     251             : 
+     252             :     /// Substitutes the symbolic parameters in a clone of Circuit according to the calculator input.
+     253             :     ///
+     254             :     /// # Arguments
+     255             :     ///
+     256             :     /// * ``calculator` - The Calculator containing the substitutions to use in the Circuit.
+     257             :     ///
+     258             :     /// # Returns
+     259             :     ///
+     260             :     /// * `Ok(Self)` -  The Circuit with the parameters substituted.
+     261             :     /// * `Err(RoqoqoError)` - The subsitution failed.
+     262          24 :     pub fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+     263          24 :         let mut tmp_def: Vec<Operation> = Vec::new();
+     264           1 :         for def in self.definitions.iter() {
+     265           1 :             let tmp_op = def.substitute_parameters(calculator)?;
+     266           1 :             if let Operation::InputSymbolic(x) = &tmp_op {
+     267           1 :                 calculator.set_variable(x.name(), *x.input())
+     268           0 :             }
+     269           1 :             tmp_def.push(tmp_op);
+     270             :         }
+     271          24 :         let mut tmp_op: Vec<Operation> = Vec::new();
+     272          22 :         for op in self.operations.iter() {
+     273          22 :             tmp_op.push(op.substitute_parameters(calculator)?);
+     274             :         }
+     275          20 :         Ok(Self {
+     276          20 :             definitions: tmp_def,
+     277          20 :             operations: tmp_op,
+     278          20 :         })
+     279          24 :     }
+     280             :     /// Remaps the qubits in operations in clone of Circuit.
+     281             :     ///
+     282             :     /// # Arguments
+     283             :     ///
+     284             :     /// * ``mapping` - The HashMap containing the {qubit: qubit} mapping to use in the Circuit.
+     285             :     ///
+     286             :     /// # Returns
+     287             :     ///
+     288             :     /// * `Ok(Self)` -  The Circuit with the qubits remapped.
+     289             :     /// * `Err(RoqoqoError)` - The remapping failed.
+     290           8 :     pub fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+     291           8 :         let mut tmp_op: Vec<Operation> = Vec::new();
+     292           6 :         for op in self.operations.iter() {
+     293           6 :             tmp_op.push(op.remap_qubits(mapping)?);
+     294             :         }
+     295           8 :         Ok(Self {
+     296           8 :             definitions: self.definitions.clone(),
+     297           8 :             operations: tmp_op,
+     298           8 :         })
+     299           8 :     }
+     300             : 
+     301             :     /// Counts the number of occurences of a set of operation tags in the circuit.
+     302             :     ///
+     303             :     /// # Arguments
+     304             :     ///
+     305             :     /// `operations` - The list of operation tags that should be counted.
+     306             :     ///
+     307             :     /// # Returns
+     308             :     ///
+     309             :     /// * `usize` - The number of occurences of these operation tags.
+     310           4 :     pub fn count_occurences(&self, operations: &[&str]) -> usize {
+     311           4 :         let mut counter: usize = 0;
+     312          24 :         for op in self.iter() {
+     313          24 :             if operations.iter().any(|x| op.tags().contains(x)) {
+     314          12 :                 counter += 1
+     315          12 :             }
+     316             :         }
+     317           4 :         counter
+     318           4 :     }
+     319             : 
+     320             :     /// Returns a list of the hqslang names of all operations occuring in the circuit.
+     321             :     ///
+     322             :     /// # Returns
+     323             :     ///
+     324             :     /// * `HashSet<&str>` - The operation types in the Circuit.
+     325           2 :     pub fn get_operation_types(&self) -> HashSet<&str> {
+     326           2 :         let mut operations: HashSet<&str> = HashSet::new();
+     327          11 :         for op in self.iter() {
+     328          11 :             let _ = operations.insert(op.hqslang());
+     329          11 :         }
+     330           2 :         operations
+     331           2 :     }
+     332             : 
+     333             :     /// Returns clone of the circuit with all Overrotation Pragmas applied.
+     334             :     ///
+     335             :     /// # Returns
+     336             :     ///
+     337             :     /// * `Ok(Circuit)` - The Circuit with overrotations applied.
+     338             :     /// * `Err(RoqoqoError::OverrotationError)` - Applying overrotations failed.
+     339             :     ///
+     340             :     /// # Example
+     341             :     ///
+     342             :     /// ```
+     343             :     /// use roqoqo::Circuit;
+     344             :     /// use roqoqo::operations::{PragmaOverrotation, RotateX, RotateY};
+     345             :     /// let mut circuit = Circuit::new();
+     346             :     /// // Adding Overrotation of next RotateY operation acting on qubit 1
+     347             :     /// // overrotating parameter theta with a statistical value
+     348             :     /// // value is drawn from normal distribution with standard deviation 30.0
+     349             :     /// // and multiplied by amplitude 20.0
+     350             :     /// circuit += PragmaOverrotation::new("RotateY".to_string(), vec![1], 20.0, 30.0);
+     351             :     /// circuit += RotateX::new(0, 0.0.into());
+     352             :     /// circuit += RotateY::new(0, 1.0.into());
+     353             :     /// circuit += RotateY::new(1, 2.0.into());
+     354             :     /// circuit += RotateY::new(1, 3.0.into());
+     355             :     ///
+     356             :     /// let circuit_overrotated = circuit.overrotate().unwrap();
+     357             :     ///
+     358             :     /// println!("{}", circuit);
+     359             :     /// println!("{}", circuit_overrotated);
+     360             :     /// ```
+     361             :     ///
+     362             :     #[cfg(feature = "overrotate")]
+     363             :     pub fn overrotate(&self) -> Result<Self, RoqoqoError> {
+     364             :         let mut tmp_vec = self.operations.clone();
+     365             :         let mut return_circuit = Circuit {
+     366             :             definitions: self.definitions.clone(),
+     367             :             operations: Vec::new(),
+     368             :         };
+     369             :         let mut length = tmp_vec.len();
+     370             :         while length > 0 {
+     371             :             match tmp_vec
+     372             :                 .iter()
+     373             :                 .enumerate()
+     374             :                 .find(|(_, op)| op.hqslang() == "PragmaOverrotation")
+     375             :                 .map(|(i, op)| (i, op.clone()))
+     376             :             {
+     377             :                 Some((index, Operation::PragmaOverrotation(overrotation))) => {
+     378             :                     // for op in tmp_vec[..index].iter() {
+     379             :                     //     return_circuit.operations.push(op.clone())
+     380             :                     // }
+     381             :                     let hqslang = overrotation.gate_hqslang();
+     382             :                     match tmp_vec[index..].iter().enumerate().find(|(_, op)| {
+     383             :                         hqslang == op.hqslang()
+     384             :                             && overrotation.involved_qubits() == op.involved_qubits()
+     385             :                     }) {
+     386             :                         Some((ind, _)) => {
+     387             :                             let mut tmp_tmp_vec: Vec<Operation> = Vec::new();
+     388             :                             for (mov_ind, op) in tmp_vec.into_iter().enumerate() {
+     389             :                                 if mov_ind == index + ind {
+     390             :                                     println!("index: {}. op: {:?}", mov_ind, op.clone());
+     391             :                                     tmp_tmp_vec.push(
+     392             :                                         Rotation::try_from(op)?
+     393             :                                             .overrotate(
+     394             :                                                 overrotation.amplitude(),
+     395             :                                                 overrotation.variance(),
+     396             :                                             )
+     397             :                                             .into(),
+     398             :                                     )
+     399             :                                 } else if index != mov_ind {
+     400             :                                     tmp_tmp_vec.push(op)
+     401             :                                 }
+     402             :                             }
+     403             :                             tmp_vec = tmp_tmp_vec
+     404             :                         }
+     405             :                         None => {
+     406             :                             let mut tmp_tmp_vec: Vec<Operation> = Vec::new();
+     407             :                             for (mov_ind, op) in tmp_vec.into_iter().enumerate() {
+     408             :                                 if index != mov_ind {
+     409             :                                     tmp_tmp_vec.push(op)
+     410             :                                 }
+     411             :                             }
+     412             :                             tmp_vec = tmp_tmp_vec
+     413             :                         }
+     414             :                     }
+     415             :                 }
+     416             :                 _ => {
+     417             :                     for op in tmp_vec {
+     418             :                         return_circuit.operations.push(op)
+     419             :                     }
+     420             :                     tmp_vec = Vec::new();
+     421             :                 }
+     422             :             }
+     423             :             length = tmp_vec.len();
+     424             :         }
+     425             :         Ok(return_circuit)
+     426             :     }
+     427             : }
+     428             : 
+     429             : /// Implements Index Access for Circuit.
+     430             : ///
+     431             : /// # Panics
+     432             : ///
+     433             : /// Panics when index is out of range of operations in circuit.
+     434             : /// This is consistent with standard Vec behaviour
+     435             : /// and returning Option or Result enums instead would conflict with definition of Output type.
+     436             : impl ops::Index<usize> for Circuit {
+     437             :     type Output = Operation;
+     438             : 
+     439             :     /// Returns reference to Operation at index.
+     440             :     ///
+     441             :     /// # Arguments
+     442             :     ///
+     443             :     /// * `index` - The index of the operation.
+     444             :     ///
+     445             :     /// # Panics
+     446             :     ///
+     447             :     /// Panics when index is out of range of operations in circuit.
+     448           4 :     fn index(&self, index: usize) -> &Self::Output {
+     449           4 :         let def_len = self.definitions.len();
+     450           4 :         if index >= def_len {
+     451           2 :             &self.operations[index - def_len]
+     452             :         } else {
+     453           2 :             &self.definitions[index]
+     454             :         }
+     455           4 :     }
+     456             : }
+     457             : 
+     458             : impl ops::IndexMut<usize> for Circuit {
+     459             :     /// Returns reference to Operation at index.
+     460             :     ///
+     461             :     /// # Arguments
+     462             :     ///
+     463             :     /// * `index` - The index of the operation.
+     464             :     ///
+     465             :     /// # Panics
+     466             :     ///
+     467             :     /// Panics when index is out of range of operations in circuit.
+     468           2 :     fn index_mut(&mut self, index: usize) -> &mut Self::Output {
+     469           2 :         let def_len = self.definitions.len();
+     470           2 :         if index >= def_len {
+     471           1 :             &mut self.operations[index - def_len]
+     472             :         } else {
+     473           1 :             &mut self.definitions[index]
+     474             :         }
+     475           2 :     }
+     476             : }
+     477             : 
+     478             : impl IntoIterator for Circuit {
+     479             :     type Item = Operation;
+     480             :     type IntoIter = OperationIterator;
+     481             :     /// Returns the Circuit in Iterator form.
+     482             :     ///
+     483             :     /// # Returns
+     484             :     ///
+     485             :     /// * `Self::IntoIter` - The Circuit in Iterator form.
+     486           2 :     fn into_iter(self) -> Self::IntoIter {
+     487           2 :         Self::IntoIter {
+     488           2 :             definition_iter: self.definitions.into_iter(),
+     489           2 :             operation_iter: self.operations.into_iter(),
+     490           2 :         }
+     491           2 :     }
+     492             : }
+     493             : 
+     494             : impl<T> FromIterator<T> for Circuit
+     495             : where
+     496             :     T: Into<Operation>,
+     497             : {
+     498             :     /// Returns the circuit in Circuit form, from an Iterator form of the circuit.
+     499             :     ///
+     500             :     /// # Returns
+     501             :     ///
+     502             :     /// * `Self::IntoIter` - The Circuit in Circuit form.
+     503           1 :     fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
+     504           1 :         let mut circuit = Circuit::new();
+     505           2 :         for op in iter {
+     506           2 :             circuit.add_operation(op.into());
+     507           2 :         }
+     508           1 :         circuit
+     509           1 :     }
+     510             : }
+     511             : 
+     512             : impl<T> Extend<T> for Circuit
+     513             : where
+     514             :     T: Into<Operation>,
+     515             : {
+     516             :     /// Extends the Circuit by the specified operations (in Iterator form).
+     517             :     ///
+     518             :     /// # Arguments
+     519             :     ///
+     520             :     /// * `iter` - The iterator containing the operations by which to extend the Circuit.
+     521           1 :     fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
+     522           2 :         for op in iter {
+     523           2 :             self.add_operation(op.into());
+     524           2 :         }
+     525           1 :     }
+     526             : }
+     527             : 
+     528             : impl Default for Circuit {
+     529             :     /// Creates a default implementation of the Circuit, which is an empty Circuit.
+     530             :     ///
+     531             :     /// # Returns
+     532             :     ///
+     533             :     /// * `Self` - The default Circuit (empty).
+     534          14 :     fn default() -> Self {
+     535          14 :         Self::new()
+     536          14 :     }
+     537             : }
+     538             : 
+     539             : /// Trait for returning Vectors based on Range structs usually used for Index<> trait and slice access.
+     540             : ///
+     541             : /// Required because Circuit does not have a continuous internal vector representation of the values.
+     542             : /// Returns a Vec instead of slices.
+     543             : ///
+     544             : /// # Example
+     545             : ///
+     546             : /// ```
+     547             : /// use roqoqo::{Circuit, AsVec};
+     548             : /// use roqoqo::operations::{DefinitionFloat, Operation, RotateZ};
+     549             : /// use qoqo_calculator::CalculatorFloat;
+     550             : ///
+     551             : /// let mut circuit = Circuit::new();
+     552             : /// let definition = DefinitionFloat::new(String::from("ro"), 1, false);
+     553             : /// let rotatez0 = RotateZ::new(0, CalculatorFloat::from(0.0));
+     554             : /// circuit.add_operation(definition.clone());
+     555             : /// circuit.add_operation(rotatez0.clone());
+     556             : ///
+     557             : /// let vec_ops = vec![
+     558             : ///     Operation::from(definition.clone()),
+     559             : ///     Operation::from(rotatez0.clone()),
+     560             : /// ];
+     561             : ///
+     562             : /// assert_eq!(circuit.as_vec(0..1).clone(), Some(vec![vec_ops[0].clone()])); // Range
+     563             : /// assert_eq!(circuit.as_vec(0..).clone(), Some(vec_ops.clone())); // RangeTo
+     564             : /// assert_eq!(circuit.as_vec(..1).clone(), Some(vec![vec_ops[0].clone()])); // RangeFrom
+     565             : /// ```
+     566             : ///
+     567             : pub trait AsVec<T> {
+     568             :     /// Returns slice of Circuit as Vec<Operations>.
+     569             :     ///
+     570             :     /// # Arguments
+     571             :     ///
+     572             :     /// * `range` - The indices of the slice of the Circuit to be returned.
+     573             :     ///
+     574             :     /// # Returns
+     575             :     ///
+     576             :     /// * `Option<Vec<Operation>>` - A vector of the operations in the Circuit with the specified indices.
+     577             :     fn as_vec(&self, range: T) -> Option<Vec<Operation>>;
+     578             : }
+     579             : 
+     580             : impl AsVec<std::ops::Range<usize>> for Circuit {
+     581             :     /// Returns slice of Circuit as Vec<Operations>.
+     582             :     ///
+     583             :     /// # Arguments
+     584             :     ///
+     585             :     /// * `range` - The indices of the slice of the Circuit to be returned.
+     586             :     ///
+     587             :     /// # Returns
+     588             :     ///
+     589             :     /// * `Option<Vec<Operation>>` - A vector of the operations in the Circuit with the specified indices.
+     590           4 :     fn as_vec(&self, range: std::ops::Range<usize>) -> Option<Vec<Operation>> {
+     591           4 :         let mut return_vec: Vec<Operation>;
+     592           4 :         let def_len = self.definitions.len();
+     593           4 :         if range.end - def_len >= self.operations.len() {
+     594           1 :             return None;
+     595           3 :         }
+     596           3 :         if range.start < def_len {
+     597           2 :             if range.end < def_len {
+     598           0 :                 return_vec = self.definitions[range].to_vec();
+     599           2 :             } else {
+     600           2 :                 return_vec = self.definitions[range.start..].to_vec();
+     601           2 :                 let mut tmp_vec = self.operations[..range.end - def_len].to_vec();
+     602           2 :                 return_vec.append(&mut tmp_vec);
+     603           2 :             }
+     604           1 :         } else {
+     605           1 :             return_vec = self.operations[range.start - def_len..range.end - def_len].to_vec();
+     606           1 :         }
+     607           3 :         Some(return_vec)
+     608           4 :     }
+     609             : }
+     610             : 
+     611             : impl AsVec<std::ops::RangeTo<usize>> for Circuit {
+     612             :     /// Returns slice of Circuit as Vec<Operations>.
+     613             :     ///
+     614             :     /// # Arguments
+     615             :     ///
+     616             :     /// * `range` - The indices of the slice of the Circuit to be returned.
+     617             :     ///
+     618             :     /// # Returns
+     619             :     ///
+     620             :     /// * `Option<Vec<Operation>>` - A vector of the operations in the Circuit with the specified indices.
+     621           3 :     fn as_vec(&self, range: std::ops::RangeTo<usize>) -> Option<Vec<Operation>> {
+     622           3 :         let mut return_vec: Vec<Operation>;
+     623           3 :         let def_len = self.definitions.len();
+     624           3 :         if range.end - def_len >= self.operations.len() {
+     625           1 :             return None;
+     626           2 :         }
+     627           2 :         if range.end < def_len {
+     628           0 :             return_vec = self.definitions[range].to_vec();
+     629           2 :         } else {
+     630           2 :             return_vec = self.definitions.clone();
+     631           2 :             let mut tmp_vec = self.operations[..range.end - def_len].to_vec();
+     632           2 :             return_vec.append(&mut tmp_vec);
+     633           2 :         }
+     634           2 :         Some(return_vec)
+     635           3 :     }
+     636             : }
+     637             : 
+     638             : impl AsVec<std::ops::RangeFrom<usize>> for Circuit {
+     639             :     /// Returns slice of Circuit as Vec<Operations>.
+     640             :     ///
+     641             :     /// # Arguments
+     642             :     ///
+     643             :     /// * `range` - The indices of the slice of the Circuit to be returned.
+     644             :     ///
+     645             :     /// # Returns
+     646             :     ///
+     647             :     /// * `Option<Vec<Operation>>` - A vector of the operations in the Circuit with the specified indices.
+     648           2 :     fn as_vec(&self, range: std::ops::RangeFrom<usize>) -> Option<Vec<Operation>> {
+     649           2 :         let mut return_vec: Vec<Operation>;
+     650           2 :         let def_len = self.definitions.len();
+     651           2 :         if range.start < def_len {
+     652           1 :             return_vec = self.definitions[range.start..].to_vec();
+     653           1 :             let mut tmp_vec = self.operations.clone();
+     654           1 :             return_vec.append(&mut tmp_vec);
+     655           1 :         } else {
+     656           1 :             return_vec = self.operations[range.start - def_len..].to_vec();
+     657           1 :         }
+     658           2 :         Some(return_vec)
+     659           2 :     }
+     660             : }
+     661             : 
+     662             : /// Implements `+` (add) for Circuit and generic type `T`.
+     663             : ///
+     664             : /// # Arguments
+     665             : ///
+     666             : /// * `other` - Any type T that implements Into<Operation> trait.
+     667             : impl<T> ops::Add<T> for Circuit
+     668             : where
+     669             :     T: Into<Operation>,
+     670             : {
+     671             :     type Output = Self;
+     672           1 :     fn add(self, other: T) -> Self {
+     673           1 :         let mut return_circuit = self;
+     674           1 :         return_circuit.add_operation(other);
+     675           1 :         return_circuit
+     676           1 :     }
+     677             : }
+     678             : 
+     679             : /// Implements `+` (add) for two Circuits.
+     680             : ///
+     681             : /// # Arguments
+     682             : ///
+     683             : /// * `other` - The Circuit to be added.
+     684             : impl ops::Add<Circuit> for Circuit {
+     685             :     type Output = Self;
+     686           1 :     fn add(self, other: Circuit) -> Self {
+     687           1 :         Self {
+     688           1 :             definitions: self
+     689           1 :                 .definitions
+     690           1 :                 .into_iter()
+     691           1 :                 .chain(other.definitions.into_iter())
+     692           1 :                 .collect(),
+     693           1 :             operations: self
+     694           1 :                 .operations
+     695           1 :                 .into_iter()
+     696           1 :                 .chain(other.operations.into_iter())
+     697           1 :                 .collect(),
+     698           1 :         }
+     699           1 :     }
+     700             : }
+     701             : 
+     702             : /// Implements `+` (add) for Circuit and Circuit reference.
+     703             : ///
+     704             : /// # Arguments
+     705             : ///
+     706             : /// * `other` - The Circuit reference to be added.
+     707             : impl ops::Add<&Circuit> for Circuit {
+     708             :     type Output = Self;
+     709           1 :     fn add(self, other: &Circuit) -> Self {
+     710           1 :         Self {
+     711           1 :             definitions: self
+     712           1 :                 .definitions
+     713           1 :                 .into_iter()
+     714           1 :                 .chain(other.definitions.iter().cloned())
+     715           1 :                 .collect(),
+     716           1 :             operations: self
+     717           1 :                 .operations
+     718           1 :                 .into_iter()
+     719           1 :                 .chain(other.operations.iter().cloned())
+     720           1 :                 .collect(),
+     721           1 :         }
+     722           1 :     }
+     723             : }
+     724             : 
+     725             : /// Implements `+=` (add) for Circuit and generic type `T`.
+     726             : ///
+     727             : /// # Arguments
+     728             : ///
+     729             : /// * `other` - Any type T that implements Into<Operation> trait.
+     730             : impl<T> ops::AddAssign<T> for Circuit
+     731             : where
+     732             :     T: Into<Operation>,
+     733             : {
+     734         260 :     fn add_assign(&mut self, other: T) {
+     735         260 :         self.add_operation(other);
+     736         260 :     }
+     737             : }
+     738             : 
+     739             : /// Implements `+=` (add) for two Circuits.
+     740             : ///
+     741             : /// # Arguments
+     742             : ///
+     743             : /// * `other` - The Circuit to be appended.
+     744             : impl ops::AddAssign<Circuit> for Circuit {
+     745           1 :     fn add_assign(&mut self, other: Circuit) {
+     746           1 :         self.definitions.extend(other.definitions.into_iter());
+     747           1 :         self.operations.extend(other.operations.into_iter())
+     748           1 :     }
+     749             : }
+     750             : 
+     751             : /// Implements `+=` (add) for Circuits and Circuit reference.
+     752             : ///
+     753             : /// # Arguments
+     754             : ///
+     755             : /// * `other` - The Circuit to be appended.
+     756             : impl ops::AddAssign<&Circuit> for Circuit {
+     757           1 :     fn add_assign(&mut self, other: &Circuit) {
+     758           1 :         self.definitions.extend(other.definitions.iter().cloned());
+     759           1 :         self.operations.extend(other.operations.iter().cloned())
+     760           1 :     }
+     761             : }
+     762             : 
+     763             : /// Implements the Display trait for Circuit.
+     764             : impl Display for Circuit {
+     765           1 :     fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+     766           1 :         let mut s: String = String::new();
+     767           2 :         for op in self.iter() {
+     768           2 :             s.push_str(&format!("{:?}\n", op))
+     769             :         }
+     770           1 :         write!(f, "{}", s)
+     771           1 :     }
+     772             : }
+     773             : 
+     774             : /// Iterator over roqoqo operations.
+     775           4 : #[derive(Debug, Clone)]
+     776             : pub struct OperationIterator {
+     777             :     /// Definitions in the quantum circuit in Iterator form, must be unique.
+     778             :     definition_iter: std::vec::IntoIter<Operation>,
+     779             :     /// Operations in the quantum circuit in Iterator form, must not be unique.
+     780             :     operation_iter: std::vec::IntoIter<Operation>,
+     781             : }
+     782             : 
+     783             : impl Iterator for OperationIterator {
+     784             :     type Item = Operation;
+     785             :     /// Advances the iterator and returns the next value.
+     786             :     ///
+     787             :     /// Returns None when iteration is finished. Individual iterator implementations may choose to resume iteration,
+     788             :     /// and so calling next() again may or may not eventually start returning Some(Operation) again at some point.
+     789             :     ///
+     790             :     /// # Returns
+     791             :     ///
+     792             :     /// * `Option<Self::Item>` - The Operation that is next in the Iterator.
+     793          12 :     fn next(&mut self) -> Option<Self::Item> {
+     794          12 :         match self.definition_iter.next() {
+     795           0 :             Some(x) => Some(x),
+     796          12 :             None => self.operation_iter.next(),
+     797             :         }
+     798          12 :     }
+     799             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/devices.rs.func-sort-c.html b/roqoqo/coveragehtml/src/devices.rs.func-sort-c.html new file mode 100644 index 00000000..3137f417 --- /dev/null +++ b/roqoqo/coveragehtml/src/devices.rs.func-sort-c.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.lcov - src/devices.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - devices.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:55100.0 %
Date:2021-11-09 13:25:48Functions:11100.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<integration::devices::TestDevice as roqoqo::devices::Device>::change_device1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/devices.rs.func.html b/roqoqo/coveragehtml/src/devices.rs.func.html new file mode 100644 index 00000000..73b2bb08 --- /dev/null +++ b/roqoqo/coveragehtml/src/devices.rs.func.html @@ -0,0 +1,76 @@ + + + + + + + LCOV - coverage.lcov - src/devices.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - devices.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:55100.0 %
Date:2021-11-09 13:25:48Functions:11100.0 %
+
+ +
+ + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<integration::devices::TestDevice as roqoqo::devices::Device>::change_device1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/devices.rs.gcov.html b/roqoqo/coveragehtml/src/devices.rs.gcov.html new file mode 100644 index 00000000..b28aeb66 --- /dev/null +++ b/roqoqo/coveragehtml/src/devices.rs.gcov.html @@ -0,0 +1,216 @@ + + + + + + + LCOV - coverage.lcov - src/devices.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - devices.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:55100.0 %
Date:2021-11-09 13:25:48Functions:11100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : //! Traits defining the standard functions for roqoqo devices.
+      14             : //!
+      15             : //! Devices in roqoqo have two use cases:
+      16             : //!
+      17             : //! * Abstract devices: Contain abstract information for the model of a quantum computer and its parameters.
+      18             : //!     They can be used to determine which Operations are available on a specific device model.
+      19             : //!     A typical example are abstract linear chains of square lattices in which two-qubit operations are only
+      20             : //!     available between neighbouring qubits.  
+      21             : //!
+      22             : //!     The abstract devices can also encode a noise model. Roqoqo noise models are in general based on a (pseudo) time
+      23             : //!     needed to execute a quantum operation and Lindblad rates for the qubits in the device.
+      24             : //!     Specifically in the noise model each qubit undergoes a continuous Lindblad-type decoherence time evolution:
+      25             : //!
+      26             : //!     $$
+      27             : //!     \frac{d}{dt}\rho = \sum_{i,j=0}^{2} M_{i,j} L_{i} \rho L_{j}^{\dagger} - \frac{1}{2} \{ L_{j}^{\dagger} L_i, \rho \} \\\\
+      28             : //!         L_0 = \sigma^{+} \\\\
+      29             : //!         L_1 = \sigma^{-} \\\\
+      30             : //!         L_3 = \sigma^{z}
+      31             : //!     $$
+      32             : //!     Note that as long as gate times and decoherence rates are scaled inversely any kind of units can be used,
+      33             : //!     but we recommend using nanoseconds and inverse nanosecconds as units for gate times and decoherence rates.
+      34             : //!
+      35             : //!
+      36             : //! * Actual hardware devices: These devices are provided by roqoqo backends and contain the necessary information for
+      37             : //!     accessing the quantum computing hardware. The devices also encode a connectivity model
+      38             : //!
+      39             : 
+      40             : use ndarray::Array2;
+      41             : 
+      42             : use crate::RoqoqoBackendError;
+      43             : 
+      44             : /// Trait for roqoqo devices.
+      45             : ///
+      46             : /// Defines standard functions available for roqoqo devices.
+      47             : pub trait Device {
+      48             :     /// Returns the gate time of a single qubit operation if the single qubit operation is available on device.
+      49             :     ///
+      50             :     /// The base assumption
+      51             :     ///
+      52             :     /// # Arguments
+      53             :     ///
+      54             :     /// * `hqslang` - The hqslang name of a single qubit gate.
+      55             :     /// * `qubit` - The qubit the gate acts on
+      56             :     ///
+      57             :     /// # Returns
+      58             :     ///
+      59             :     /// * `Some<f64>` - The gate time.
+      60             :     /// * `None` - The gate is not available on the device.
+      61             :     fn single_qubit_gate_time(&self, hqslang: &str, qubit: &usize) -> Option<f64>;
+      62             : 
+      63             :     /// Returns the gate time of a two qubit operation if the two qubit operation is available on device-.
+      64             :     ///
+      65             :     ///
+      66             :     /// # Arguments
+      67             :     ///
+      68             :     /// * `hqslang` - The hqslang name of a two qubit gate.
+      69             :     /// * `control` - The control qubit the gate acts on
+      70             :     /// * `target` - The target qubit the gate acts on
+      71             :     ///
+      72             :     /// # Returns
+      73             :     ///
+      74             :     /// * `Some<f64>` - The gate time.
+      75             :     /// * `None` - The gate is not available on the device.
+      76             :     fn two_qubit_gate_time(&self, hqslang: &str, control: &usize, target: &usize) -> Option<f64>;
+      77             : 
+      78             :     /// Returns the gate time of a multi qubit operation if the multi qubit operation is available on device.
+      79             :     ///
+      80             :     ///
+      81             :     /// # Arguments
+      82             :     ///
+      83             :     /// * `hqslang` - The hqslang name of a multi qubit gate.
+      84             :     /// * `qubits` - The qubits the gate acts on
+      85             :     ///
+      86             :     /// # Returns
+      87             :     ///
+      88             :     /// * `Some<f64>` - The gate time.
+      89             :     /// * `None` - The gate is not available on the device.
+      90             :     fn multi_qubit_gate_time(&self, hqslang: &str, qubits: &[usize]) -> Option<f64>;
+      91             : 
+      92             :     /// Returns the matrix of the decoherence rates of the Lindblad equation.
+      93             :     ///
+      94             :     /// $$
+      95             :     /// \frac{d}{dt}\rho = \sum_{i,j=0}^{2} M_{i,j} L_{i} \rho L_{j}^{\dagger} - \frac{1}{2} \{ L_{j}^{\dagger} L_i, \rho \} \\\\
+      96             :     ///     L_0 = \sigma^{+} \\\\
+      97             :     ///     L_1 = \sigma^{-} \\\\
+      98             :     ///     L_3 = \sigma^{z}
+      99             :     /// $$
+     100             :     ///
+     101             :     /// # Arguments
+     102             :     ///
+     103             :     /// * `qubit` - The qubit for which the rate matrix M is returned
+     104             :     ///
+     105             :     /// # Returns
+     106             :     ///
+     107             :     /// * `Some<Array2<f64>>` - The decoherence rates.
+     108             :     /// * `None` - The qubit is not part of the device.
+     109             :     fn qubit_decoherence_rates(&self, qubit: &usize) -> Option<Array2<f64>>;
+     110             : 
+     111             :     /// Returns the number of qubits the device supports.
+     112             :     fn number_qubits(&self) -> usize;
+     113             : 
+     114             :     /// Changes the device topology based on a Pragma operation.
+     115             :     ///
+     116             :     /// Specific devices and backends can allow changes to the device topology.
+     117             :     /// These changes are represented by Pragma operations that are only available for
+     118             :     /// the corresponding backend.
+     119             :     /// This function provides a generic interface for changing the devices with the help of
+     120             :     /// these Pragma operations.
+     121             :     /// In normal operation the backend specific Pragma operations are wrapped in a [crate::operations::PragmaChangeDevice]
+     122             :     /// wrapper operation and encoded in binary form with the [bincode] crate.
+     123             :     /// This function takes the encoded binary representation, tries to deserialize it internally
+     124             :     ///  and applies the corresponding changes.
+     125             :     ///
+     126             :     /// For most devices the default behaviour is that the device cannot be changed
+     127             :     /// and the function returns a corresponding RoqoqoBackendError
+     128             :     ///
+     129             :     /// # Arguments
+     130             :     ///
+     131             :     /// * `hqslang` - The hqslang name of the wrapped operation
+     132             :     /// * `operation` - The Pragma operation encoded in binary form using the [bincode] crate
+     133             :     #[allow(unused_variables)]
+     134             :     #[allow(unused_mut)]
+     135           1 :     fn change_device(&mut self, hqslang: &str, operation: &[u8]) -> Result<(), RoqoqoBackendError> {
+     136           1 :         Err(RoqoqoBackendError::GenericError {
+     137           1 :             msg: "The device ".to_string(),
+     138           1 :         })
+     139           1 :     }
+     140             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/index-sort-f.html b/roqoqo/coveragehtml/src/index-sort-f.html new file mode 100644 index 00000000..b2851c19 --- /dev/null +++ b/roqoqo/coveragehtml/src/index-sort-f.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.lcov - src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - srcHitTotalCoverage
Test:coverage.lcovLines:32034193.8 %
Date:2021-11-09 13:25:48Functions:738783.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
lib.rs +
66.7%66.7%
+
66.7 %2 / 328.6 %4 / 14
circuit.rs +
98.4%98.4%
+
98.4 %241 / 24593.2 %55 / 59
devices.rs +
100.0%
+
100.0 %5 / 5100.0 %1 / 1
quantum_program.rs +
100.0%
+
100.0 %46 / 46100.0 %6 / 6
backends.rs +
61.9%61.9%
+
61.9 %26 / 42100.0 %7 / 7
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/index-sort-l.html b/roqoqo/coveragehtml/src/index-sort-l.html new file mode 100644 index 00000000..a946c76f --- /dev/null +++ b/roqoqo/coveragehtml/src/index-sort-l.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.lcov - src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - srcHitTotalCoverage
Test:coverage.lcovLines:32034193.8 %
Date:2021-11-09 13:25:48Functions:738783.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
backends.rs +
61.9%61.9%
+
61.9 %26 / 42100.0 %7 / 7
lib.rs +
66.7%66.7%
+
66.7 %2 / 328.6 %4 / 14
circuit.rs +
98.4%98.4%
+
98.4 %241 / 24593.2 %55 / 59
devices.rs +
100.0%
+
100.0 %5 / 5100.0 %1 / 1
quantum_program.rs +
100.0%
+
100.0 %46 / 46100.0 %6 / 6
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/index.html b/roqoqo/coveragehtml/src/index.html new file mode 100644 index 00000000..1b34298d --- /dev/null +++ b/roqoqo/coveragehtml/src/index.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.lcov - src + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - srcHitTotalCoverage
Test:coverage.lcovLines:32034193.8 %
Date:2021-11-09 13:25:48Functions:738783.9 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
backends.rs +
61.9%61.9%
+
61.9 %26 / 42100.0 %7 / 7
circuit.rs +
98.4%98.4%
+
98.4 %241 / 24593.2 %55 / 59
devices.rs +
100.0%
+
100.0 %5 / 5100.0 %1 / 1
lib.rs +
66.7%66.7%
+
66.7 %2 / 328.6 %4 / 14
quantum_program.rs +
100.0%
+
100.0 %46 / 46100.0 %6 / 6
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/lib.rs.func-sort-c.html b/roqoqo/coveragehtml/src/lib.rs.func-sort-c.html new file mode 100644 index 00000000..742cc0e6 --- /dev/null +++ b/roqoqo/coveragehtml/src/lib.rs.func-sort-c.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.lcov - src/lib.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - lib.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:2366.7 %
Date:2021-11-09 13:25:48Functions:41428.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::RoqoqoBackendError as core::cmp::PartialEq>::eq0
<roqoqo::RoqoqoBackendError as core::cmp::PartialEq>::ne0
<roqoqo::RoqoqoBackendError as core::convert::From<qoqo_calculator::CalculatorError>>::from0
<roqoqo::RoqoqoBackendError as core::convert::From<roqoqo::RoqoqoError>>::from0
<roqoqo::RoqoqoBackendError as core::fmt::Debug>::fmt0
<roqoqo::RoqoqoBackendError as core::fmt::Display>::fmt0
<roqoqo::RoqoqoBackendError as std::error::Error>::source0
<roqoqo::RoqoqoError as core::cmp::PartialEq>::ne0
<roqoqo::RoqoqoError as core::fmt::Display>::fmt0
<roqoqo::RoqoqoError as std::error::Error>::source0
<roqoqo::RoqoqoError as core::cmp::PartialEq>::eq1
<roqoqo::RoqoqoError as core::convert::From<qoqo_calculator::CalculatorError>>::from1
<roqoqo::RoqoqoError as core::fmt::Debug>::fmt1
roqoqo::main1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/lib.rs.func.html b/roqoqo/coveragehtml/src/lib.rs.func.html new file mode 100644 index 00000000..94e27396 --- /dev/null +++ b/roqoqo/coveragehtml/src/lib.rs.func.html @@ -0,0 +1,128 @@ + + + + + + + LCOV - coverage.lcov - src/lib.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - lib.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:2366.7 %
Date:2021-11-09 13:25:48Functions:41428.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::RoqoqoBackendError as core::cmp::PartialEq>::eq0
<roqoqo::RoqoqoBackendError as core::cmp::PartialEq>::ne0
<roqoqo::RoqoqoBackendError as core::convert::From<qoqo_calculator::CalculatorError>>::from0
<roqoqo::RoqoqoBackendError as core::convert::From<roqoqo::RoqoqoError>>::from0
<roqoqo::RoqoqoBackendError as core::fmt::Debug>::fmt0
<roqoqo::RoqoqoBackendError as core::fmt::Display>::fmt0
<roqoqo::RoqoqoBackendError as std::error::Error>::source0
<roqoqo::RoqoqoError as core::cmp::PartialEq>::eq1
<roqoqo::RoqoqoError as core::cmp::PartialEq>::ne0
<roqoqo::RoqoqoError as core::convert::From<qoqo_calculator::CalculatorError>>::from1
<roqoqo::RoqoqoError as core::fmt::Debug>::fmt1
<roqoqo::RoqoqoError as core::fmt::Display>::fmt0
<roqoqo::RoqoqoError as std::error::Error>::source0
roqoqo::main1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/lib.rs.gcov.html b/roqoqo/coveragehtml/src/lib.rs.gcov.html new file mode 100644 index 00000000..2e383d5a --- /dev/null +++ b/roqoqo/coveragehtml/src/lib.rs.gcov.html @@ -0,0 +1,278 @@ + + + + + + + LCOV - coverage.lcov - src/lib.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - lib.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:2366.7 %
Date:2021-11-09 13:25:48Functions:41428.6 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1           1 : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : #![deny(missing_docs)]
+      14             : #![warn(private_intra_doc_links)]
+      15             : #![warn(missing_crate_level_docs)]
+      16             : #![warn(missing_doc_code_examples)]
+      17             : #![warn(private_doc_tests)]
+      18             : #![deny(missing_debug_implementations)]
+      19             : 
+      20             : //! # roqoqo
+      21             : //!
+      22             : //! `Rust only Quantum Operation Quantum Operation` - the quantum computing toolkit by HQS Quantum Simulations.
+      23             : //!
+      24             : pub use qoqo_calculator::Calculator;
+      25             : use qoqo_calculator::CalculatorError;
+      26             : pub use qoqo_calculator::CalculatorFloat;
+      27             : use thiserror::Error;
+      28             : 
+      29             : /// roqoqo version information, used for roqoqo import/export checks
+      30             : pub const ROQOQO_VERSION: &str = env!("CARGO_PKG_VERSION");
+      31             : 
+      32             : /// Errors that can occur in roqoqo.
+      33          80 : #[derive(Error, Debug, PartialEq)]
+      34             : pub enum RoqoqoError {
+      35             :     /// Error when values of alpha and beta lead to an invalid unitary matrix.
+      36             :     #[error("Resulting gate matrix is not unitary. Please check values of alpha and beta: alpha_r: {alpha_r:?}, alpha_i: {alpha_i:?}, beta_r: {beta_r:?}, beta_i: {beta_i:?}, norm: {norm:?}.")]
+      37             :     UnitaryMatrixErrror {
+      38             :         /// Real part of diagonal element of (not) unitary matrix.
+      39             :         alpha_r: f64,
+      40             :         /// Imaginary part of diagonal element of (not) unitary matrix.
+      41             :         alpha_i: f64,
+      42             :         /// Real part of off-diagonal element of (not) unitary matrix.
+      43             :         beta_r: f64,
+      44             :         /// Real part of off-diagonal element of (not) unitary matrix.
+      45             :         beta_i: f64,
+      46             :         /// Norm of (not) unitary matrix.
+      47             :         norm: f64,
+      48             :     },
+      49             :     /// Error when remapping qubits fails because qubit in operation is not in keys of HashMap/dict.
+      50             :     #[error("Mapping of qubit {qubit:?} failed")]
+      51             :     QubitMappingError {
+      52             :         /// Qubit that can not be mapped.
+      53             :         qubit: usize,
+      54             :     },
+      55             :     /// Custom error for failed conversion between enums with the TryFrom trait.
+      56             :     #[error("Conversion from {start_type} to {end_type} failed")]
+      57             :     ConversionError {
+      58             :         /// Type from which should be converted.
+      59             :         start_type: &'static str,
+      60             :         /// Type into which should be converted.
+      61             :         end_type: &'static str,
+      62             :     },
+      63             :     /// Error using try from  
+      64             :     #[error("TryFrom conversion failed")]
+      65             :     TryFromError,
+      66             :     /// Custom error for failed multipliction of two gates acting on different qubits.
+      67             :     #[error("Qubits {squbit} and {oqubit} incompatible. Gates acting on different qubits can not be multiplied.")]
+      68             :     MultiplicationIncompatibleQubits {
+      69             :         /// Self qubit of the operation on the left hand.
+      70             :         squbit: usize,
+      71             :         /// Other qubit of the operation on the right hand.
+      72             :         oqubit: usize,
+      73             :     },
+      74             :     /// Error adding a PauliProduct involving qubits larger than number of qubit to measurement input.
+      75             :     #[error("Pauli product involves qubit {pp_qubit} but number qubits is lower {number_qubits}.")]
+      76             :     PauliProductExceedsQubits {
+      77             :         /// Qubit involved in Pauli product.
+      78             :         pp_qubit: usize,
+      79             :         /// Number of qubits in measurement.
+      80             :         number_qubits: usize,
+      81             :     },
+      82             :     /// Error when adding a new operator to expectation values.
+      83             :     #[error(
+      84             :         "Index of operator {index:?} exceeds Hilbert space dimension of {number_qubits} qubits."
+      85             :     )]
+      86             :     MismatchedOperatorDimension {
+      87             :         /// Index not matching dimensions.
+      88             :         index: (usize, usize),
+      89             :         /// Number of qubits in measurement.
+      90             :         number_qubits: usize,
+      91             :     },
+      92             :     /// Error when a complex register does not correspond to the expected dimension for cheated measurement.
+      93             :     #[error(
+      94             :         "Dimension of register {dim:?} exceeds Hilbert space dimension of {number_qubits} qubits."
+      95             :     )]
+      96             :     MismatchedRegisterDimension {
+      97             :         /// Index not matching dimensions.
+      98             :         dim: usize,
+      99             :         /// Number of qubits in measurement.
+     100             :         number_qubits: usize,
+     101             :     },
+     102             :     /// Error adding an expectation value, name of expectation value already take.
+     103             :     #[error("Name {name} of expectation value already taken.")]
+     104             :     ExpValUsedTwice {
+     105             :         /// Name of the expecataion value missing.
+     106             :         name: String,
+     107             :     },
+     108             :     /// Expected register is missing from the Output registers.
+     109             :     #[error("OutputRegister {name} is missing.")]
+     110             :     MissingRegister {
+     111             :         /// Name of the missing register.
+     112             :         name: String,
+     113             :     },
+     114             :     /// Error occured in basis rotation measurement.
+     115             :     #[error("Error occured in basis rotation measurement. {msg}")]
+     116             :     BasisRotationMeasurementError {
+     117             :         /// Error message.
+     118             :         msg: String,
+     119             :     },
+     120             :     /// Error serializing an internal roqoqo object
+     121             :     #[error("An error occured serializing a roqoqo object: {msg} ")]
+     122             :     SerializationError {
+     123             :         /// Error message
+     124             :         msg: String,
+     125             :     },
+     126             :     /// Generic error that does not fit in other error categories.
+     127             :     #[error("An error occured in roqoqo: {msg} ")]
+     128             :     GenericError {
+     129             :         /// Generic error message
+     130             :         msg: String,
+     131             :     },
+     132             :     // /// Rates matrix has negative eigenvalues, when they should be positive semi-definite.
+     133             :     // #[error("Rates matrix has a negative eigenvalue: {value}")]
+     134             :     // NegativeEigenvalue {
+     135             :     //     /// Negative eigenvalue.
+     136             :     //     value: f64,
+     137             :     // },
+     138             :     /// Transparent propagation of CalculatorError.
+     139             :     #[error(transparent)]
+     140             :     CalculatorError(#[from] CalculatorError),
+     141             : }
+     142             : 
+     143             : /// Errors that can occur in roqoqo backends.
+     144           0 : #[derive(Error, Debug, PartialEq)]
+     145             : pub enum RoqoqoBackendError {
+     146             :     /// Error operation not supported by backend
+     147             :     #[error("Operation {hqslang} not supported by backend {hqslang}: ")]
+     148             :     OperationNotInBackend {
+     149             :         /// Name of the backend.
+     150             :         backend: &'static str,
+     151             :         /// hqslang name of the operation.
+     152             :         hqslang: &'static str,
+     153             :     },
+     154             :     /// Error for backends missing authentification information.
+     155             :     #[error("Backend authentification information is missing: {msg} ")]
+     156             :     MissingAuthentification {
+     157             :         /// Error msg
+     158             :         msg: String,
+     159             :     },
+     160             :     /// Error when communicating with backend over the network.
+     161             :     #[error("NetworkError communicating with: {msg} ")]
+     162             :     NetworkError {
+     163             :         /// Error msg
+     164             :         msg: String,
+     165             :     },
+     166             :     /// Error when communicating with backend over the network.
+     167             :     #[error("Backend timed out: {msg} ")]
+     168             :     Timeout {
+     169             :         /// Error msg
+     170             :         msg: String,
+     171             :     },
+     172             :     /// Error when communicating with backend over the network.
+     173             :     #[error("The file at this location already exists: {path} ")]
+     174             :     FileAlreadyExists {
+     175             :         /// Path of file to be created
+     176             :         path: String,
+     177             :     },
+     178             :     /// Error when communicating with backend over the network.
+     179             :     #[error("An error occured in the backend: {msg} ")]
+     180             :     GenericError {
+     181             :         /// Generic error message
+     182             :         msg: String,
+     183             :     },
+     184             :     /// Transparent propagation of RoqoqoError.
+     185             :     #[error(transparent)]
+     186             :     RoqoqoError(#[from] RoqoqoError),
+     187             :     /// Transparent propagation of CalculatorError.
+     188             :     #[error(transparent)]
+     189             :     CalculatorError(#[from] CalculatorError),
+     190             : }
+     191             : 
+     192             : #[doc(hidden)]
+     193             : mod circuit;
+     194             : pub mod operations;
+     195             : pub mod prelude;
+     196             : pub use circuit::*;
+     197             : pub mod backends;
+     198             : pub mod devices;
+     199             : pub mod measurements;
+     200             : mod quantum_program;
+     201             : pub mod registers;
+     202             : pub use quantum_program::QuantumProgram;
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.func-sort-c.html b/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.func-sort-c.html new file mode 100644 index 00000000..069dd065 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.func-sort-c.html @@ -0,0 +1,108 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/basis_rotation_measurement.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - basis_rotation_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:14514798.6 %
Date:2021-11-09 13:25:48Functions:99100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as core::clone::Clone>::clone1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as core::cmp::PartialEq>::eq1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as core::cmp::PartialEq>::ne1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as core::fmt::Debug>::fmt1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::Measure>::circuits1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::Measure>::constant_circuit1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::Measure>::substitute_parameters1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::MeasureExpectationValues>::evaluate1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::MeasureExpectationValues>::evaluate::{closure#0}1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.func.html b/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.func.html new file mode 100644 index 00000000..926942a8 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.func.html @@ -0,0 +1,108 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/basis_rotation_measurement.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - basis_rotation_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:14514798.6 %
Date:2021-11-09 13:25:48Functions:99100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as core::clone::Clone>::clone1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as core::cmp::PartialEq>::eq1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as core::cmp::PartialEq>::ne1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as core::fmt::Debug>::fmt1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::Measure>::circuits1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::Measure>::constant_circuit1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::Measure>::substitute_parameters1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::MeasureExpectationValues>::evaluate1
<roqoqo::measurements::basis_rotation_measurement::BasisRotation as roqoqo::measurements::MeasureExpectationValues>::evaluate::{closure#0}1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.gcov.html b/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.gcov.html new file mode 100644 index 00000000..1a4e7225 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/basis_rotation_measurement.rs.gcov.html @@ -0,0 +1,330 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/basis_rotation_measurement.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - basis_rotation_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:14514798.6 %
Date:2021-11-09 13:25:48Functions:99100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use super::*;
+      14             : use ndarray::{Array1, Array2};
+      15             : #[cfg(feature = "serialize")]
+      16             : use serde::{Deserialize, Serialize};
+      17             : 
+      18             : /// Collected information for executing a basis rotation measurement.
+      19           2 : #[derive(Debug, PartialEq, Clone)]
+      20             : #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
+      21             : pub struct BasisRotation {
+      22             :     /// Constant Circuit that is executed before each Circuit in circuits.
+      23             :     pub constant_circuit: Option<Circuit>,
+      24             :     /// Collection of quantum circuits for the separate basis rotations.
+      25             :     pub circuits: Vec<Circuit>,
+      26             :     /// Additional input information required for measurement.
+      27             :     pub input: BasisRotationInput,
+      28             : }
+      29             : 
+      30             : impl Measure for BasisRotation {
+      31             :     /// Returns the constant Circuit that is executed before each Circuit in circuits.
+      32             :     ///
+      33             :     /// # Returns
+      34             :     ///
+      35             :     /// * `&Option<Circuit` - The constant Circuit (None if not defined).
+      36           3 :     fn constant_circuit(&self) -> &Option<Circuit> {
+      37           3 :         &self.constant_circuit
+      38           3 :     }
+      39             : 
+      40             :     /// Returns iterator over circuits for measurement.
+      41             :     ///
+      42             :     /// # Returns
+      43             :     ///
+      44             :     /// * `Box<dyn Iterator<Item = &'a Circuit> + 'a>` - The quantum circuits.
+      45           3 :     fn circuits<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Circuit> + 'a> {
+      46           3 :         Box::new(self.circuits.iter())
+      47           3 :     }
+      48             : 
+      49             :     /// Returns clone of Measurement with symbolic parameters replaced.
+      50             :     ///
+      51             :     /// # Arguments
+      52             :     ///
+      53             :     /// * `substituted_parameters` - The HashMap containing the substitutions to use in the Circuit.
+      54             :     ///
+      55             :     /// # Returns
+      56             :     ///
+      57             :     /// * `Ok(Self)` -  The Circuits with the parameters substituted.
+      58             :     /// * `Err(RoqoqoError)` - The subsitution failed.
+      59             :     ///
+      60           3 :     fn substitute_parameters(
+      61           3 :         &self,
+      62           3 :         substituted_parameters: HashMap<String, f64>,
+      63           3 :     ) -> Result<Self, RoqoqoError> {
+      64           3 :         let mut calculator = qoqo_calculator::Calculator::new();
+      65           9 :         for (name, val) in substituted_parameters.iter() {
+      66           6 :             calculator.set_variable(name, *val)
+      67             :         }
+      68           3 :         let new_constant_circuit = match &self.constant_circuit {
+      69           0 :             None => None,
+      70           3 :             Some(c) => Some(c.substitute_parameters(&mut calculator)?),
+      71             :         };
+      72           2 :         let mut new_circuits = Vec::new();
+      73           2 :         for circ in self.circuits.iter() {
+      74           2 :             let mut calculator = qoqo_calculator::Calculator::new();
+      75           6 :             for (name, val) in substituted_parameters.iter() {
+      76           4 :                 calculator.set_variable(name, *val)
+      77             :             }
+      78           2 :             new_circuits.push(circ.substitute_parameters(&mut calculator)?)
+      79             :         }
+      80           2 :         Ok(Self {
+      81           2 :             constant_circuit: new_constant_circuit,
+      82           2 :             circuits: new_circuits,
+      83           2 :             input: self.input.clone(),
+      84           2 :         })
+      85           3 :     }
+      86             : }
+      87             : 
+      88             : impl MeasureExpectationValues for BasisRotation {
+      89             :     // TODO add optional device later for use with flipped measurement
+      90             :     #[allow(unused_variables)]
+      91             :     /// Executes the basis rotation measurement.
+      92             :     ///
+      93             :     /// # Arguments
+      94             :     ///
+      95             :     /// * `bit_registers` - The classical bit registers as a HashMap with the register name as key.
+      96             :     /// * `float_registers` - The classical float registers as a HashMap with the register name as key.
+      97             :     /// * `complex_registers` - The classical complex registers as a HashMap with the register name as key.
+      98             :     ///
+      99             :     /// # Returns
+     100             :     ///
+     101             :     /// * `Ok(Some(HashMap<String, f64>))` - The measurement has been evaluated successfully. The HashMap contains the measured expectation values.
+     102             :     /// * `Ok(None)` - The measurement did not fail but is incomplete. A new round of measurements is needed
+     103             :     /// * `Err([RoqoqoError::BasisRotationMeasurementError])` - An error occured in basis rotation measurement.
+     104             :     ///
+     105          10 :     fn evaluate(
+     106          10 :         &self,
+     107          10 :         bit_registers: HashMap<String, BitOutputRegister>,
+     108          10 :         float_registers: HashMap<String, FloatOutputRegister>,
+     109          10 :         complex_registers: HashMap<String, ComplexOutputRegister>,
+     110          10 :     ) -> Result<Option<HashMap<String, f64>>, RoqoqoError> {
+     111          10 :         // todo replace with actual input
+     112          10 :         let measurement_fidelities = vec![1.0; self.input.number_qubits];
+     113          10 : 
+     114          10 :         // Setting up measurement correction factors for flipped measurement
+     115          10 :         let mut measurement_correction_factors: HashMap<String, Vec<f64>> = HashMap::new();
+     116          10 :         let flipped_and_extension: Vec<(bool, &'static str)>;
+     117          10 :         if self.input.use_flipped_measurement {
+     118             :             // helper vector to iterate over when evaluating the pauli products
+     119           3 :             flipped_and_extension = vec![(false, ""), (true, "_flipped")];
+     120           6 :             for (name, pauli_product_mask) in self.input.pauli_product_qubit_masks.iter() {
+     121           3 :                 let mut measurement_correction_factor: Vec<f64> =
+     122           3 :                     (0..self.input.number_pauli_products)
+     123           3 :                         .into_iter()
+     124           9 :                         .map(|_| 1.0)
+     125           3 :                         .collect();
+     126          12 :                 for (pp_index, indices) in pauli_product_mask.iter() {
+     127           9 :                     if !indices.is_empty() {
+     128           9 :                         for i in indices {
+     129           9 :                             measurement_correction_factor[*pp_index] *= measurement_fidelities[*i]
+     130             :                         }
+     131           3 :                     }
+     132             :                 }
+     133           3 :                 measurement_correction_factors.insert(name.clone(), measurement_correction_factor);
+     134             :             }
+     135           7 :         } else {
+     136           7 :             flipped_and_extension = vec![(false, "")];
+     137           7 :         }
+     138          10 :         let mut pauli_product_dict: HashMap<String, Array1<f64>> = HashMap::new();
+     139          25 :         for (register_name, mask) in self.input.pauli_product_qubit_masks.iter() {
+     140          33 :             for (flip_measurement, extension) in flipped_and_extension.iter() {
+     141          18 :                 let register = bit_registers
+     142          18 :                     .get(&format!("{}{}", register_name.as_str(), extension))
+     143          18 :                     .ok_or(RoqoqoError::BasisRotationMeasurementError {
+     144          18 :                         msg: format!(
+     145          18 :                             "bit register {}{} not found",
+     146          18 :                             register_name.as_str(),
+     147          18 :                             extension
+     148          18 :                         ),
+     149          18 :                     })?;
+     150          18 :                 let mut single_shot_pauli_products: Array2<f64> =
+     151          18 :                     Array2::zeros((register.len(), self.input.number_pauli_products));
+     152          60 :                 for (index, mask_val) in mask.iter() {
+     153          42 :                     if mask_val.is_empty() {
+     154          12 :                         single_shot_pauli_products.column_mut(*index).fill(1.0);
+     155          12 :                     } else {
+     156             :                         // Accessing column of single_shot_pauli_products that corresponds to pauli product designated by index
+     157          30 :                         let mut column = single_shot_pauli_products.column_mut(*index);
+     158             :                         // Iterate over all single shot readouts for all qubits and construct Pauli Product
+     159          90 :                         for (row_index, values) in register.iter().enumerate() {
+     160             :                             // Determine the value of the pauli product with the parity of the number of 0 and 1 measurements of the qubits
+     161             :                             // false is even parity and true is odd parity
+     162          90 :                             let mut parity = false;
+     163         144 :                             for i in mask_val.iter() {
+     164         144 :                                 // For flipped readout a false (0) qubit measurement will flip the parity
+     165         144 :                                 // For a not-flipped measurement a true (1) qubit measurement will flip the parity
+     166         144 :                                 if values[*i] ^ flip_measurement {
+     167          42 :                                     parity = !parity
+     168         102 :                                 }
+     169             :                             } // Map even parity measurement result to 1 and odd parity result to -1
+     170          90 :                             column[row_index] = match parity {
+     171          72 :                                 false => 1.0,
+     172          18 :                                 true => -1.0,
+     173             :                             };
+     174             :                         }
+     175             :                     }
+     176             :                 }
+     177          18 :                 let mut pauli_products_tmp: Array1<f64> =
+     178          18 :                     Array1::zeros(self.input.number_pauli_products);
+     179          66 :                 for i in 0..self.input.number_pauli_products {
+     180          66 :                     pauli_products_tmp[i] = single_shot_pauli_products.column(i).mean().ok_or(
+     181          66 :                         RoqoqoError::BasisRotationMeasurementError {
+     182          66 :                             msg: format!(
+     183          66 :                                 "Column {} out of index for sinlge_shot_pauli_products",
+     184          66 :                                 i
+     185          66 :                             ),
+     186          66 :                         },
+     187          66 :                     )?;
+     188             :                 }
+     189          18 :                 pauli_product_dict.insert(
+     190          18 :                     format!("{}{}", register_name.as_str(), extension),
+     191          18 :                     pauli_products_tmp,
+     192          18 :                 );
+     193             :             }
+     194             :         }
+     195             : 
+     196          10 :         let mut pauli_products: Array1<f64> = Array1::zeros(self.input.number_pauli_products);
+     197          25 :         for (register_name, _) in self.input.pauli_product_qubit_masks.iter() {
+     198          15 :             if !register_name.ends_with("flipped") {
+     199             :                 // Create temporary averaged vector of pauli_products
+     200             :                 // Averaging between normal and flipped readout when flipped measurement is used
+     201          15 :                 if self.input.use_flipped_measurement {
+     202           3 :                     let tmp_pauli_products = (&pauli_product_dict
+     203           3 :                         .get(register_name.as_str())
+     204           3 :                         .ok_or(RoqoqoError::BasisRotationMeasurementError {
+     205           3 :                             msg: format!("Register name {} not fount", register_name),
+     206           3 :                         })?
+     207           3 :                         .view()
+     208           3 :                         + &pauli_product_dict
+     209           3 :                             .get(format!("{}_flipped", register_name).as_str())
+     210           3 :                             .ok_or(RoqoqoError::BasisRotationMeasurementError {
+     211           3 :                                 msg: format!("Register name {}_flipped not fount", register_name),
+     212           3 :                             })?
+     213           3 :                             .view())
+     214           3 :                         / 2.0;
+     215           3 :                     // reinserting in dict of pauli products
+     216           3 :                     pauli_products += &tmp_pauli_products.view();
+     217             :                 } else {
+     218          12 :                     pauli_products += &pauli_product_dict
+     219          12 :                         .get(register_name.as_str())
+     220          12 :                         .ok_or(RoqoqoError::BasisRotationMeasurementError {
+     221          12 :                             msg: format!("Register name {} not fount", register_name),
+     222          12 :                         })?
+     223          12 :                         .view()
+     224             :                 }
+     225           0 :             }
+     226             :         }
+     227             :         // Evaluating expectation values
+     228          10 :         let mut results: HashMap<String, f64> = HashMap::new();
+     229             : 
+     230          40 :         for (name, evaluation) in self.input.measured_exp_vals.iter() {
+     231             :             results.insert(
+     232          30 :                 name.clone(),
+     233          30 :                 match evaluation {
+     234          28 :                     PauliProductsToExpVal::Linear(hm) => {
+     235          28 :                         let mut value: f64 = 0.0;
+     236          63 :                         for (index, coefficient) in hm {
+     237          35 :                             value += pauli_products[*index] * coefficient;
+     238          35 :                         }
+     239          28 :                         value
+     240             :                     }
+     241           2 :                     PauliProductsToExpVal::Symbolic(x) => {
+     242           2 :                         let mut calculator = qoqo_calculator::Calculator::new();
+     243           8 :                         for (ind, p) in pauli_products.iter().enumerate() {
+     244           8 :                             calculator.set_variable(format!("pauli_product_{}", ind).as_str(), *p);
+     245           8 :                         }
+     246           2 :                         calculator.parse_get(x.clone())?
+     247             :                     }
+     248             :                 },
+     249             :             );
+     250             :         }
+     251             : 
+     252          10 :         Ok(Some(results))
+     253          10 :     }
+     254             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.func-sort-c.html b/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.func-sort-c.html new file mode 100644 index 00000000..0d931f85 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.func-sort-c.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/cheated_basis_rotation_measurement.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - cheated_basis_rotation_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:596098.3 %
Date:2021-11-09 13:25:48Functions:88100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as core::clone::Clone>::clone1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as core::cmp::PartialEq>::eq1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as core::cmp::PartialEq>::ne1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as core::fmt::Debug>::fmt1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as roqoqo::measurements::Measure>::circuits1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as roqoqo::measurements::Measure>::constant_circuit1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as roqoqo::measurements::Measure>::substitute_parameters1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as roqoqo::measurements::MeasureExpectationValues>::evaluate1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.func.html b/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.func.html new file mode 100644 index 00000000..204dafd4 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.func.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/cheated_basis_rotation_measurement.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - cheated_basis_rotation_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:596098.3 %
Date:2021-11-09 13:25:48Functions:88100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as core::clone::Clone>::clone1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as core::cmp::PartialEq>::eq1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as core::cmp::PartialEq>::ne1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as core::fmt::Debug>::fmt1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as roqoqo::measurements::Measure>::circuits1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as roqoqo::measurements::Measure>::constant_circuit1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as roqoqo::measurements::Measure>::substitute_parameters1
<roqoqo::measurements::cheated_basis_rotation_measurement::CheatedBasisRotation as roqoqo::measurements::MeasureExpectationValues>::evaluate1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.gcov.html b/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.gcov.html new file mode 100644 index 00000000..93e72610 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/cheated_basis_rotation_measurement.rs.gcov.html @@ -0,0 +1,220 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/cheated_basis_rotation_measurement.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - cheated_basis_rotation_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:596098.3 %
Date:2021-11-09 13:25:48Functions:88100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use super::*;
+      14             : use ndarray::Array1;
+      15             : #[cfg(feature = "serialize")]
+      16             : use serde::{Deserialize, Serialize};
+      17             : 
+      18             : /// Collected information for executing a cheated basis rotation measurement.
+      19           2 : #[derive(Debug, PartialEq, Clone)]
+      20             : #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
+      21             : pub struct CheatedBasisRotation {
+      22             :     /// Constant Circuit that is executed before each Circuit in circuits.
+      23             :     pub constant_circuit: Option<Circuit>,
+      24             :     /// Collection of quantum circuits for the separate basis rotations.
+      25             :     pub circuits: Vec<Circuit>,
+      26             :     /// Additional input information required for measurement.
+      27             :     pub input: CheatedBasisRotationInput,
+      28             : }
+      29             : 
+      30             : impl Measure for CheatedBasisRotation {
+      31             :     /// Returns the constant Circuit that is executed before each Circuit in circuits.
+      32             :     ///
+      33             :     /// # Returns
+      34             :     ///
+      35             :     /// * `&Option<Circuit` - The constant Circuit (None if not defined).
+      36           3 :     fn constant_circuit(&self) -> &Option<Circuit> {
+      37           3 :         &self.constant_circuit
+      38           3 :     }
+      39             : 
+      40             :     /// Returns iterator over circuits for measurement.
+      41             :     ///
+      42             :     /// # Returns
+      43             :     ///
+      44             :     /// * `Box<dyn Iterator<Item = &'a Circuit> + 'a>` - The quantum circuits.
+      45           3 :     fn circuits<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Circuit> + 'a> {
+      46           3 :         Box::new(self.circuits.iter())
+      47           3 :     }
+      48             : 
+      49             :     /// Returns clone of Measurement with symbolic parameters replaced.
+      50             :     ///
+      51             :     /// # Arguments
+      52             :     ///
+      53             :     /// * `substituted_parameters` - The HashMap containing the substitutions to use in the Circuit.
+      54             :     ///
+      55             :     /// # Returns
+      56             :     ///
+      57             :     /// * `Ok(Self)` -  The Circuits with the parameters substituted.
+      58             :     /// * `Err(RoqoqoError)` - The subsitution failed.
+      59           3 :     fn substitute_parameters(
+      60           3 :         &self,
+      61           3 :         substituted_parameters: HashMap<String, f64>,
+      62           3 :     ) -> Result<Self, RoqoqoError> {
+      63           3 :         let mut calculator = qoqo_calculator::Calculator::new();
+      64           9 :         for (name, val) in substituted_parameters.iter() {
+      65           6 :             calculator.set_variable(name, *val)
+      66             :         }
+      67           3 :         let new_constant_circuit = match &self.constant_circuit {
+      68           0 :             None => None,
+      69           3 :             Some(c) => Some(c.substitute_parameters(&mut calculator)?),
+      70             :         };
+      71           2 :         let mut new_circuits = Vec::new();
+      72           2 :         for circ in self.circuits.iter() {
+      73           2 :             let mut calculator = qoqo_calculator::Calculator::new();
+      74           6 :             for (name, val) in substituted_parameters.iter() {
+      75           4 :                 calculator.set_variable(name, *val)
+      76             :             }
+      77           2 :             new_circuits.push(circ.substitute_parameters(&mut calculator)?)
+      78             :         }
+      79           2 :         Ok(Self {
+      80           2 :             constant_circuit: new_constant_circuit,
+      81           2 :             circuits: new_circuits,
+      82           2 :             input: self.input.clone(),
+      83           2 :         })
+      84           3 :     }
+      85             : }
+      86             : 
+      87             : impl MeasureExpectationValues for CheatedBasisRotation {
+      88             :     /// Executes the cheated basis rotation measurement
+      89             :     ///
+      90             :     /// # Arguments
+      91             :     ///
+      92             :     /// * `bit_registers` - The classical bit registers as a HashMap with the register name as key
+      93             :     /// * `float_registers` - The classical float registers as a HashMap with the register name as key
+      94             :     /// * `complex_registers` - The classical complex registers as a HashMap with the register name as key
+      95             :     ///
+      96             :     /// # Returns
+      97             :     ///
+      98             :     /// * `Ok(Some(HashMap<String, f64>))` - The measurement has been evaluated successfully. The HashMap contains the measured expectation values
+      99             :     /// * `Ok(None)` - The measurement did not fail but is incomplete. A new round of measurements is needed
+     100             :     /// * `Err(RoqoqoError)` - Calculator parsing error.
+     101             :     ///
+     102             :     #[allow(unused_variables)]
+     103           3 :     fn evaluate(
+     104           3 :         &self,
+     105           3 :         bit_registers: HashMap<String, BitOutputRegister>,
+     106           3 :         float_registers: HashMap<String, FloatOutputRegister>,
+     107           3 :         complex_registers: HashMap<String, ComplexOutputRegister>,
+     108           3 :     ) -> Result<Option<HashMap<String, f64>>, RoqoqoError> {
+     109           3 :         let mut pauli_products: Array1<f64> = Array1::zeros(self.input.pauli_product_keys.len());
+     110           9 :         for (register_name, register) in float_registers.iter() {
+     111           6 :             if let Some(index) = self.input.pauli_product_keys.get(register_name) {
+     112           6 :                 pauli_products[*index] = register[0][0];
+     113           6 :             }
+     114             :         }
+     115             :         // Evaluating expectation values
+     116           3 :         let mut results: HashMap<String, f64> = HashMap::new();
+     117             : 
+     118           6 :         for (name, evaluation) in self.input.measured_exp_vals.iter() {
+     119             :             results.insert(
+     120           3 :                 name.clone(),
+     121           3 :                 match evaluation {
+     122           2 :                     PauliProductsToExpVal::Linear(hm) => {
+     123           2 :                         let mut value: f64 = 0.0;
+     124           6 :                         for (index, coefficient) in hm {
+     125           4 :                             value += pauli_products[*index] * coefficient;
+     126           4 :                         }
+     127           2 :                         value
+     128             :                     }
+     129           1 :                     PauliProductsToExpVal::Symbolic(x) => {
+     130           1 :                         let mut calculator = qoqo_calculator::Calculator::new();
+     131           3 :                         for (ind, p) in pauli_products.iter().enumerate() {
+     132           3 :                             dbg!(ind);
+     133           3 :                             dbg!(p);
+     134           3 :                             calculator.set_variable(format!("pauli_product_{}", ind).as_str(), *p);
+     135           3 :                         }
+     136           1 :                         calculator.parse_get(x.clone())?
+     137             :                     }
+     138             :                 },
+     139             :             );
+     140             :         }
+     141             : 
+     142           3 :         Ok(Some(results))
+     143           3 :     }
+     144             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.func-sort-c.html b/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.func-sort-c.html new file mode 100644 index 00000000..23984f75 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.func-sort-c.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/cheated_measurement.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - cheated_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:10610799.1 %
Date:2021-11-09 13:25:48Functions:1111100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::cheated_measurement::Cheated as core::clone::Clone>::clone1
<roqoqo::measurements::cheated_measurement::Cheated as core::cmp::PartialEq>::eq1
<roqoqo::measurements::cheated_measurement::Cheated as core::cmp::PartialEq>::ne1
<roqoqo::measurements::cheated_measurement::Cheated as core::fmt::Debug>::fmt1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::Measure>::circuits1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::Measure>::constant_circuit1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::Measure>::substitute_parameters1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::MeasureExpectationValues>::evaluate1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::MeasureExpectationValues>::evaluate::{closure#0}1
roqoqo::measurements::cheated_measurement::sparse_matrix_matrix_expectation_value1
roqoqo::measurements::cheated_measurement::sparse_matrix_vector_expectation_value1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.func.html b/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.func.html new file mode 100644 index 00000000..3684e75f --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.func.html @@ -0,0 +1,116 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/cheated_measurement.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - cheated_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:10610799.1 %
Date:2021-11-09 13:25:48Functions:1111100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::cheated_measurement::Cheated as core::clone::Clone>::clone1
<roqoqo::measurements::cheated_measurement::Cheated as core::cmp::PartialEq>::eq1
<roqoqo::measurements::cheated_measurement::Cheated as core::cmp::PartialEq>::ne1
<roqoqo::measurements::cheated_measurement::Cheated as core::fmt::Debug>::fmt1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::Measure>::circuits1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::Measure>::constant_circuit1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::Measure>::substitute_parameters1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::MeasureExpectationValues>::evaluate1
<roqoqo::measurements::cheated_measurement::Cheated as roqoqo::measurements::MeasureExpectationValues>::evaluate::{closure#0}1
roqoqo::measurements::cheated_measurement::sparse_matrix_matrix_expectation_value1
roqoqo::measurements::cheated_measurement::sparse_matrix_vector_expectation_value1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.gcov.html b/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.gcov.html new file mode 100644 index 00000000..c398d0ea --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/cheated_measurement.rs.gcov.html @@ -0,0 +1,281 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/cheated_measurement.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - cheated_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:10610799.1 %
Date:2021-11-09 13:25:48Functions:1111100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use crate::measurements::{CheatedInput, Measure, MeasureExpectationValues};
+      14             : use crate::registers::{BitOutputRegister, ComplexOutputRegister, FloatOutputRegister};
+      15             : use crate::Circuit;
+      16             : use crate::RoqoqoError;
+      17             : use ndarray::{Array1, ArrayView1, ArrayView2};
+      18             : //use ndarray::{Array2};
+      19             : use num_complex::Complex64;
+      20             : //use sprs::{CsMat, TriMat};
+      21             : use std::collections::HashMap;
+      22             : 
+      23             : /// Cheated measurement using state obtained from simulator backend.
+      24             : ///
+      25             : /// Cheated measurements are only possible witch simulator backends that can return the state vector or the density matrix of the quantum computer.
+      26             : /// The expectation values are defined by a matrix representation of the measured observables.
+      27           2 : #[derive(Debug, PartialEq, Clone)]
+      28             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      29             : pub struct Cheated {
+      30             :     /// Constant Circuit that is executed before each Circuit in circuits.
+      31             :     pub constant_circuit: Option<Circuit>,
+      32             :     /// Collection of quantum circuits for the separate basis rotations.
+      33             :     pub circuits: Vec<Circuit>,
+      34             :     /// Additional input information required for measurement.
+      35             :     pub input: CheatedInput,
+      36             : }
+      37             : 
+      38             : impl Measure for Cheated {
+      39             :     /// Returns the constant Circuit that is executed before each Circuit in circuits.
+      40             :     ///
+      41             :     /// # Returns
+      42             :     ///
+      43             :     /// * `&Option<Circuit` - The constant Circuit (None if not defined).
+      44           3 :     fn constant_circuit(&self) -> &Option<Circuit> {
+      45           3 :         &self.constant_circuit
+      46           3 :     }
+      47             : 
+      48             :     /// Returns iterator over circuits for measurement.
+      49             :     ///
+      50             :     /// # Returns
+      51             :     ///
+      52             :     /// * `Box<dyn Iterator<Item = &'a Circuit> + 'a>` - The quantum circuits.
+      53           3 :     fn circuits<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Circuit> + 'a> {
+      54           3 :         Box::new(self.circuits.iter())
+      55           3 :     }
+      56             : 
+      57             :     /// Returns clone of Measurement with symbolic parameters replaced.
+      58             :     ///
+      59             :     /// # Arguments
+      60             :     ///
+      61             :     /// * `substituted_parameters` - The HashMap containing the substitutions to use in the Circuit.
+      62             :     ///
+      63             :     /// # Returns
+      64             :     ///
+      65             :     /// * `Ok(Self)` -  The Circuits with the parameters substituted.
+      66             :     /// * `Err(RoqoqoError)` - The subsitution failed.
+      67           3 :     fn substitute_parameters(
+      68           3 :         &self,
+      69           3 :         substituted_parameters: HashMap<String, f64>,
+      70           3 :     ) -> Result<Self, RoqoqoError> {
+      71           3 :         let mut calculator = qoqo_calculator::Calculator::new();
+      72           9 :         for (name, val) in substituted_parameters.iter() {
+      73           6 :             calculator.set_variable(name, *val)
+      74             :         }
+      75           3 :         let new_constant_circuit = match &self.constant_circuit {
+      76           0 :             None => None,
+      77           3 :             Some(c) => Some(c.substitute_parameters(&mut calculator)?),
+      78             :         };
+      79           2 :         let mut new_circuits = Vec::new();
+      80           2 :         for circ in self.circuits.iter() {
+      81           2 :             let mut calculator = qoqo_calculator::Calculator::new();
+      82           6 :             for (name, val) in substituted_parameters.iter() {
+      83           4 :                 calculator.set_variable(name, *val)
+      84             :             }
+      85           2 :             new_circuits.push(circ.substitute_parameters(&mut calculator)?)
+      86             :         }
+      87           2 :         Ok(Self {
+      88           2 :             constant_circuit: new_constant_circuit,
+      89           2 :             circuits: new_circuits,
+      90           2 :             input: self.input.clone(),
+      91           2 :         })
+      92           3 :     }
+      93             : }
+      94             : 
+      95             : impl MeasureExpectationValues for Cheated {
+      96             :     /// Executes the cheated measurement.
+      97             :     ///
+      98             :     /// # Arguments
+      99             :     ///
+     100             :     /// * `bit_registers` - The classical bit registers as a HashMap with the register name as key.
+     101             :     /// * `float_registers` - The classical float registers as a HashMap with the register name as key.
+     102             :     /// * `complex_registers` - The classical complex registers as a HashMap with the register name as key.
+     103             :     ///
+     104             :     /// # Returns
+     105             :     ///
+     106             :     /// * `Ok(Some(HashMap<String, f64>))` - The measurement has been evaluated successfully. The HashMap contains the measured expectation values.
+     107             :     /// * `Ok(None)` - The measurement did not fail but is incomplete. A new round of measurements is needed.
+     108             :     /// * `Err([RoqoqoError::MissingRegister])` - The OutputRegister is missing.
+     109             :     /// * `Err([RoqoqoError::MismatchedRegisterDimension])` - The dimension of register exceeds Hilbert space dimension of qubits.
+     110             :     #[allow(unused_variables)]
+     111           9 :     fn evaluate(
+     112           9 :         &self,
+     113           9 :         bit_registers: HashMap<String, BitOutputRegister>,
+     114           9 :         float_registers: HashMap<String, FloatOutputRegister>,
+     115           9 :         complex_registers: HashMap<String, ComplexOutputRegister>,
+     116           9 :     ) -> Result<Option<HashMap<String, f64>>, RoqoqoError> {
+     117           9 :         let dimension = 2_usize.pow(self.input.number_qubits as u32);
+     118           9 :         // Evaluating expectation values
+     119           9 :         let mut results: HashMap<String, f64> = HashMap::new();
+     120          21 :         for (name, (operator, readout)) in self.input.measured_operators.iter() {
+     121             :             // let row_inds: Vec<usize> = operator.iter().map(|(row, _, _)| row).cloned().collect();
+     122             :             // let col_inds: Vec<usize> = operator.iter().map(|(_, col, _)| col).cloned().collect();
+     123             :             // let data: Vec<Complex64> = operator.iter().map(|(_, _, val)| val).cloned().collect();
+     124             :             // let tmp_tri = TriMat::from_triplets((dimension, dimension), row_inds, col_inds, data);
+     125             :             // let matrix: CsMat<Complex64> = tmp_tri.to_csc();
+     126          13 :             let register_vec =
+     127          14 :                 complex_registers
+     128          14 :                     .get(readout)
+     129          14 :                     .ok_or_else(|| RoqoqoError::MissingRegister {
+     130           1 :                         name: readout.clone(),
+     131          14 :                     })?;
+     132          13 :             let mut local_results: Array1<f64> = Array1::zeros(register_vec.len());
+     133          17 :             for (index, register) in register_vec.iter().enumerate() {
+     134          17 :                 if register.len() == dimension {
+     135          12 :                     let vector: ArrayView1<Complex64> = ArrayView1::<Complex64>::from(register);
+     136          12 :                     // let complex_conj_vec: Vec<Complex64> =
+     137          12 :                     //     register.iter().map(|x| x.conj()).collect();
+     138          12 :                     // let complex_conj: ArrayView1<Complex64> =
+     139          12 :                     //     ArrayView1::<Complex64>::from(&complex_conj_vec);
+     140          12 :                     // let tmp_val: Complex64 = complex_conj.dot(&(&matrix * &vector));
+     141          12 :                     let tmp_val: Complex64 =
+     142          12 :                         sparse_matrix_vector_expectation_value(operator, &vector);
+     143          12 :                     local_results[index] = tmp_val.re;
+     144          12 :                 } else if register.len() == dimension * dimension {
+     145           4 :                     let vector: ArrayView2<Complex64> =
+     146           4 :                         ArrayView2::<Complex64>::from_shape((dimension, dimension), register)
+     147           4 :                             .expect("Unexpected error reshaping array");
+     148           4 :                     // let complex_conj_vec: Vec<Complex64> =
+     149           4 :                     //     register.iter().map(|x| x.conj()).collect();
+     150           4 :                     // let complex_conj: Array2<Complex64> = Array2::<Complex64>::from_shape_vec(
+     151           4 :                     //     (dimension, dimension),
+     152           4 :                     //     complex_conj_vec,
+     153           4 :                     // )
+     154           4 :                     // .expect("Unexpected error reshaping array");
+     155           4 :                     // let tmp_val: Complex64 =
+     156           4 :                     //     ((complex_conj.t()).dot(&(&matrix * &vector))).diag().sum();
+     157           4 :                     let tmp_val =
+     158           4 :                         sparse_matrix_matrix_expectation_value(operator, &vector, dimension);
+     159           4 :                     local_results[index] = tmp_val.re;
+     160           4 :                 } else {
+     161           1 :                     return Err(RoqoqoError::MismatchedRegisterDimension {
+     162           1 :                         dim: register.len(),
+     163           1 :                         number_qubits: self.input.number_qubits,
+     164           1 :                     });
+     165             :                 }
+     166             :             }
+     167             : 
+     168          12 :             results.insert(
+     169          12 :                 name.clone(),
+     170          12 :                 local_results.mean().expect(
+     171          12 :                     "Unexpectedly could not calculate mean of expectation values of register",
+     172          12 :                 ),
+     173          12 :             );
+     174             :         }
+     175           7 :         Ok(Some(results))
+     176           9 :     }
+     177             : }
+     178             : 
+     179             : #[inline]
+     180          12 : fn sparse_matrix_vector_expectation_value(
+     181          12 :     matrix: &[(usize, usize, Complex64)],
+     182          12 :     vector: &ArrayView1<Complex64>,
+     183          12 : ) -> Complex64 {
+     184          12 :     let mut val: Complex64 = Complex64::new(0.0, 0.0);
+     185          60 :     for (index_i, index_j, value) in matrix {
+     186          48 :         val += vector[*index_i].conj() * value * vector[*index_j]
+     187             :     }
+     188          12 :     val
+     189          12 : }
+     190             : 
+     191             : #[inline]
+     192           4 : fn sparse_matrix_matrix_expectation_value(
+     193           4 :     matrix: &[(usize, usize, Complex64)],
+     194           4 :     dense_matrix: &ArrayView2<Complex64>,
+     195           4 :     dimension: usize,
+     196           4 : ) -> Complex64 {
+     197           4 :     let mut val: Complex64 = Complex64::new(0.0, 0.0);
+     198          20 :     for (index_j, index_k, value) in matrix {
+     199          32 :         for index_i in 0..dimension {
+     200          32 :             val +=
+     201          32 :                 dense_matrix[(*index_j, index_i)].conj() * value * dense_matrix[(*index_k, index_i)]
+     202             :         }
+     203             :     }
+     204           4 :     val
+     205           4 : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.func-sort-c.html b/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.func-sort-c.html new file mode 100644 index 00000000..02e57926 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.func-sort-c.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/classical_register_measurement.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - classical_register_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:272896.4 %
Date:2021-11-09 13:25:48Functions:77100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as core::clone::Clone>::clone1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as core::cmp::PartialEq>::eq1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as core::cmp::PartialEq>::ne1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as core::fmt::Debug>::fmt1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as roqoqo::measurements::Measure>::circuits1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as roqoqo::measurements::Measure>::constant_circuit1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as roqoqo::measurements::Measure>::substitute_parameters1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.func.html b/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.func.html new file mode 100644 index 00000000..78e77c2d --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.func.html @@ -0,0 +1,100 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/classical_register_measurement.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - classical_register_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:272896.4 %
Date:2021-11-09 13:25:48Functions:77100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as core::clone::Clone>::clone1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as core::cmp::PartialEq>::eq1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as core::cmp::PartialEq>::ne1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as core::fmt::Debug>::fmt1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as roqoqo::measurements::Measure>::circuits1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as roqoqo::measurements::Measure>::constant_circuit1
<roqoqo::measurements::classical_register_measurement::ClassicalRegister as roqoqo::measurements::Measure>::substitute_parameters1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.gcov.html b/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.gcov.html new file mode 100644 index 00000000..35149060 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/classical_register_measurement.rs.gcov.html @@ -0,0 +1,161 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/classical_register_measurement.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - classical_register_measurement.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:272896.4 %
Date:2021-11-09 13:25:48Functions:77100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use crate::measurements::Measure;
+      14             : use crate::Circuit;
+      15             : use crate::RoqoqoError;
+      16             : use std::collections::HashMap;
+      17             : 
+      18             : /// Classical register measurement.
+      19             : ///
+      20             : /// Runs a sequence of circuits and returns the classical registers written during circuit execution.
+      21           2 : #[derive(Debug, PartialEq, Clone)]
+      22             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      23             : pub struct ClassicalRegister {
+      24             :     /// Constant Circuit that is executed before each Circuit in circuits.
+      25             :     pub constant_circuit: Option<Circuit>,
+      26             :     /// Collection of quantum circuits for the separate basis rotations.
+      27             :     pub circuits: Vec<Circuit>,
+      28             : }
+      29             : 
+      30             : impl Measure for ClassicalRegister {
+      31             :     /// Returns the constant Circuit that is executed before each Circuit in circuits.
+      32             :     ///
+      33             :     /// # Returns
+      34             :     ///
+      35             :     /// * `&Option<Circuit` - The constant Circuit (None if not defined).
+      36           3 :     fn constant_circuit(&self) -> &Option<Circuit> {
+      37           3 :         &self.constant_circuit
+      38           3 :     }
+      39             : 
+      40             :     /// Returns iterator over circuits for measurement.
+      41             :     ///
+      42             :     /// # Returns
+      43             :     ///
+      44             :     /// * `Box<dyn Iterator<Item = &'a Circuit> + 'a>` - The quantum circuits.
+      45           3 :     fn circuits<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Circuit> + 'a> {
+      46           3 :         Box::new(self.circuits.iter())
+      47           3 :     }
+      48             : 
+      49             :     /// Returns clone of Measurement with symbolic parameters replaced.
+      50             :     ///
+      51             :     /// # Arguments
+      52             :     ///
+      53             :     /// * `substituted_parameters` - The HashMap containing the substitutions to use in the Circuit.
+      54             :     ///
+      55             :     /// # Returns
+      56             :     ///
+      57             :     /// * `Ok(Self)` -  The Circuits with the parameters substituted.
+      58             :     /// * `Err(RoqoqoError)` - The substitution failed.
+      59             :     ///
+      60           3 :     fn substitute_parameters(
+      61           3 :         &self,
+      62           3 :         substituted_parameters: HashMap<String, f64>,
+      63           3 :     ) -> Result<Self, RoqoqoError> {
+      64           3 :         let mut calculator = qoqo_calculator::Calculator::new();
+      65           9 :         for (name, val) in substituted_parameters.iter() {
+      66           6 :             calculator.set_variable(name, *val)
+      67             :         }
+      68           3 :         let new_constant_circuit = match &self.constant_circuit {
+      69           0 :             None => None,
+      70           3 :             Some(c) => Some(c.substitute_parameters(&mut calculator)?),
+      71             :         };
+      72           2 :         let mut new_circuits = Vec::new();
+      73           2 :         for circ in self.circuits.iter() {
+      74           2 :             let mut calculator = qoqo_calculator::Calculator::new();
+      75           6 :             for (name, val) in substituted_parameters.iter() {
+      76           4 :                 calculator.set_variable(name, *val)
+      77             :             }
+      78           2 :             new_circuits.push(circ.substitute_parameters(&mut calculator)?)
+      79             :         }
+      80           2 :         Ok(Self {
+      81           2 :             constant_circuit: new_constant_circuit,
+      82           2 :             circuits: new_circuits,
+      83           2 :         })
+      84           3 :     }
+      85             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/index-sort-f.html b/roqoqo/coveragehtml/src/measurements/index-sort-f.html new file mode 100644 index 00000000..005da284 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/index-sort-f.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.lcov - src/measurements + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurementsHitTotalCoverage
Test:coverage.lcovLines:47047598.9 %
Date:2021-11-09 13:25:48Functions:6666100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
classical_register_measurement.rs +
96.4%96.4%
+
96.4 %27 / 28100.0 %7 / 7
cheated_basis_rotation_measurement.rs +
98.3%98.3%
+
98.3 %59 / 60100.0 %8 / 8
basis_rotation_measurement.rs +
98.6%98.6%
+
98.6 %145 / 147100.0 %9 / 9
cheated_measurement.rs +
99.1%99.1%
+
99.1 %106 / 107100.0 %11 / 11
measurement_auxiliary_data_input.rs +
100.0%
+
100.0 %133 / 133100.0 %31 / 31
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/index-sort-l.html b/roqoqo/coveragehtml/src/measurements/index-sort-l.html new file mode 100644 index 00000000..e4e9db65 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/index-sort-l.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.lcov - src/measurements + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurementsHitTotalCoverage
Test:coverage.lcovLines:47047598.9 %
Date:2021-11-09 13:25:48Functions:6666100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
classical_register_measurement.rs +
96.4%96.4%
+
96.4 %27 / 28100.0 %7 / 7
cheated_basis_rotation_measurement.rs +
98.3%98.3%
+
98.3 %59 / 60100.0 %8 / 8
basis_rotation_measurement.rs +
98.6%98.6%
+
98.6 %145 / 147100.0 %9 / 9
cheated_measurement.rs +
99.1%99.1%
+
99.1 %106 / 107100.0 %11 / 11
measurement_auxiliary_data_input.rs +
100.0%
+
100.0 %133 / 133100.0 %31 / 31
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/index.html b/roqoqo/coveragehtml/src/measurements/index.html new file mode 100644 index 00000000..69e69420 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/index.html @@ -0,0 +1,133 @@ + + + + + + + LCOV - coverage.lcov - src/measurements + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurementsHitTotalCoverage
Test:coverage.lcovLines:47047598.9 %
Date:2021-11-09 13:25:48Functions:6666100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
basis_rotation_measurement.rs +
98.6%98.6%
+
98.6 %145 / 147100.0 %9 / 9
cheated_basis_rotation_measurement.rs +
98.3%98.3%
+
98.3 %59 / 60100.0 %8 / 8
cheated_measurement.rs +
99.1%99.1%
+
99.1 %106 / 107100.0 %11 / 11
classical_register_measurement.rs +
96.4%96.4%
+
96.4 %27 / 28100.0 %7 / 7
measurement_auxiliary_data_input.rs +
100.0%
+
100.0 %133 / 133100.0 %31 / 31
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.func-sort-c.html b/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.func-sort-c.html new file mode 100644 index 00000000..057cc143 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.func-sort-c.html @@ -0,0 +1,196 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/measurement_auxiliary_data_input.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - measurement_auxiliary_data_input.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:133133100.0 %
Date:2021-11-09 13:25:48Functions:3131100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput as core::cmp::PartialEq>::eq1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput as core::cmp::PartialEq>::ne1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput as core::fmt::Debug>::fmt1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_linear_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_pauli_product1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_pauli_product::{closure#0}1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_pauli_product::{closure#1}1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_symbolic_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::new1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::cmp::PartialEq>::eq1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::cmp::PartialEq>::ne1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::default::Default>::default1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::fmt::Debug>::fmt1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::add_linear_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::add_pauli_product1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::add_pauli_product::{closure#0}1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::add_symbolic_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::new1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput as core::cmp::PartialEq>::eq1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput as core::cmp::PartialEq>::ne1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput as core::fmt::Debug>::fmt1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput>::add_operator_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput>::add_operator_exp_val::{closure#0}1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput>::new1
<roqoqo::measurements::measurement_auxiliary_data_input::PauliProductsToExpVal as core::clone::Clone>::clone1
<roqoqo::measurements::measurement_auxiliary_data_input::PauliProductsToExpVal as core::cmp::PartialEq>::eq1
<roqoqo::measurements::measurement_auxiliary_data_input::PauliProductsToExpVal as core::cmp::PartialEq>::ne1
<roqoqo::measurements::measurement_auxiliary_data_input::PauliProductsToExpVal as core::fmt::Debug>::fmt1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput as core::clone::Clone>::clone2
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::clone::Clone>::clone2
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput as core::clone::Clone>::clone2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.func.html b/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.func.html new file mode 100644 index 00000000..11cd3d26 --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.func.html @@ -0,0 +1,196 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/measurement_auxiliary_data_input.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - measurement_auxiliary_data_input.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:133133100.0 %
Date:2021-11-09 13:25:48Functions:3131100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput as core::clone::Clone>::clone2
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput as core::cmp::PartialEq>::eq1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput as core::cmp::PartialEq>::ne1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput as core::fmt::Debug>::fmt1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_linear_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_pauli_product1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_pauli_product::{closure#0}1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_pauli_product::{closure#1}1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::add_symbolic_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::BasisRotationInput>::new1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::clone::Clone>::clone2
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::cmp::PartialEq>::eq1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::cmp::PartialEq>::ne1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::default::Default>::default1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput as core::fmt::Debug>::fmt1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::add_linear_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::add_pauli_product1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::add_pauli_product::{closure#0}1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::add_symbolic_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedBasisRotationInput>::new1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput as core::clone::Clone>::clone2
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput as core::cmp::PartialEq>::eq1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput as core::cmp::PartialEq>::ne1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput as core::fmt::Debug>::fmt1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput>::add_operator_exp_val1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput>::add_operator_exp_val::{closure#0}1
<roqoqo::measurements::measurement_auxiliary_data_input::CheatedInput>::new1
<roqoqo::measurements::measurement_auxiliary_data_input::PauliProductsToExpVal as core::clone::Clone>::clone1
<roqoqo::measurements::measurement_auxiliary_data_input::PauliProductsToExpVal as core::cmp::PartialEq>::eq1
<roqoqo::measurements::measurement_auxiliary_data_input::PauliProductsToExpVal as core::cmp::PartialEq>::ne1
<roqoqo::measurements::measurement_auxiliary_data_input::PauliProductsToExpVal as core::fmt::Debug>::fmt1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.gcov.html b/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.gcov.html new file mode 100644 index 00000000..a1eeae5e --- /dev/null +++ b/roqoqo/coveragehtml/src/measurements/measurement_auxiliary_data_input.rs.gcov.html @@ -0,0 +1,472 @@ + + + + + + + LCOV - coverage.lcov - src/measurements/measurement_auxiliary_data_input.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/measurements - measurement_auxiliary_data_input.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:133133100.0 %
Date:2021-11-09 13:25:48Functions:3131100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use crate::CalculatorFloat;
+      14             : use crate::RoqoqoError;
+      15             : use num_complex::Complex64;
+      16             : use std::collections::HashMap;
+      17             : 
+      18             : /// Provides PauliProductMasks for all Pauli Products measured from one readout register.
+      19             : pub type SingleReadoutPauliProductMasks = HashMap<usize, PauliProductMask>;
+      20             : 
+      21             : /// Provides Mask for a single PauliProduct.
+      22             : pub type PauliProductMask = Vec<usize>;
+      23             : 
+      24             : /// Defines how Pauli Products expectation values are post-processed into observable expectation value.
+      25           2 : #[derive(Debug, Clone, PartialEq)]
+      26             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      27             : pub enum PauliProductsToExpVal {
+      28             :     /// Expectation value of observable is a linear combination of Pauli Product expectation values.
+      29             :     ///
+      30             :     /// Only scalar real expectation values are supported.  
+      31             :     /// For complex observables or vector/matrix observables
+      32             :     /// components have to be postprocessed separately.
+      33             :     Linear(HashMap<usize, f64>),
+      34             :     /// Expectation value of observable is derived from symbolic expression.
+      35             :     ///
+      36             :     /// Symbolic expression is given by [qoqo_calculator::CalculatorFloat]
+      37             :     /// The i-th PauliProduct us hardcoded as the variable `pauli_product_i`
+      38             :     /// in the string expression of CalculatorFloat.
+      39             :     Symbolic(CalculatorFloat),
+      40             : }
+      41             : 
+      42             : /// Provides Necessary Information to run a [crate::measurements::BasisRotation] measurement.
+      43             : ///
+      44             : /// BasisRotationInput is the input struct for a BasisRotation measurement, dictating which expectation
+      45             : /// values are measured by BasisRotation. These expecation values are defined as
+      46             : /// expectation values of pauli products.
+      47           5 : #[derive(Debug, Clone, PartialEq)]
+      48             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      49             : pub struct BasisRotationInput {
+      50             :     /// Collection of PauliProductMasks for each readout register in Measurement.
+      51             :     pub pauli_product_qubit_masks: HashMap<String, SingleReadoutPauliProductMasks>,
+      52             :     /// Number of qubits that are measured.
+      53             :     pub number_qubits: usize,
+      54             :     /// Number of Pauli Products that are measured.
+      55             :     pub number_pauli_products: usize,
+      56             :     /// Collection of names and construction methods of  expectation values.
+      57             :     ///
+      58             :     /// The construction methods are given by [PauliProductsToExpVal] enums.
+      59             :     pub measured_exp_vals: HashMap<String, PauliProductsToExpVal>,
+      60             :     /// Determines whether measurement errors are symmetrized.
+      61             :     ///
+      62             :     /// Measurement errors are symmetrized by repeating measurement with final flip of all qubits.
+      63             :     pub use_flipped_measurement: bool,
+      64             : }
+      65             : 
+      66             : impl BasisRotationInput {
+      67             :     /// Creates new BasisRotationInput.
+      68             :     ///
+      69             :     /// The BasisRotationInput starts with just the number of qubtis and flipped measurements set.
+      70             :     /// The pauli_product_qubit_masks and measured_exp_vals start empty
+      71             :     /// and can be extended with [BasisRotationInput::add_pauli_product],
+      72             :     /// [BasisRotationInput::add_linear_exp_val] and [BasisRotationInput::add_symbolic_exp_val].
+      73             :     ///
+      74             :     /// # Arguments
+      75             :     ///
+      76             :     /// * `number_qubits` - The number of qubits in the BasisRotation measurement.
+      77             :     /// * `use_flipped_measurement` - Whether or not to use flipped measurements.
+      78             :     ///
+      79          19 :     pub fn new(number_qubits: usize, use_flipped_measurement: bool) -> Self {
+      80          19 :         Self {
+      81          19 :             pauli_product_qubit_masks: HashMap::new(),
+      82          19 :             number_qubits,
+      83          19 :             number_pauli_products: 0,
+      84          19 :             measured_exp_vals: HashMap::new(),
+      85          19 :             use_flipped_measurement,
+      86          19 :         }
+      87          19 :     }
+      88             : 
+      89             :     /// Adds measured Pauli product to BasisRotationInput and returns index of Pauli product.
+      90             :     ///
+      91             :     /// When the pauli product is already in the measurement input the function only returns
+      92             :     /// it index.
+      93             :     ///
+      94             :     /// # Arguments
+      95             :     ///
+      96             :     /// * `readout` - The name of the readout register the pauli_product is defined on.
+      97             :     /// * `pauli_product_mask` - The list of the qubits involved in the Pauli product measurement.
+      98             :     ///
+      99             :     /// # Returns
+     100             :     ///
+     101             :     /// * `Ok(usize)` - The index of the added Pauli product in the list of all Pauli products.
+     102             :     /// * `Err([RoqoqoError::PauliProductExceedsQubits])` - The pauli product involves a qubit exceeding the maximum number of qubits.
+     103             :     pub fn add_pauli_product(
+     104             :         &mut self,
+     105             :         readout: String,
+     106             :         pauli_product_mask: PauliProductMask,
+     107             :     ) -> Result<usize, RoqoqoError> {
+     108          41 :         if let Some(i) = &pauli_product_mask
+     109          41 :             .iter()
+     110          47 :             .find(|i| i >= &&self.number_qubits)
+     111             :         {
+     112           1 :             return Err(RoqoqoError::PauliProductExceedsQubits {
+     113           1 :                 pp_qubit: **i,
+     114           1 :                 number_qubits: self.number_qubits,
+     115           1 :             });
+     116          40 :         }
+     117             : 
+     118             :         // Readout already in pauli_product_qubit_masks
+     119          40 :         if let Some(m) = self.pauli_product_qubit_masks.get_mut(&readout) {
+     120             :             // Check if PauliProduct has already been added
+     121          33 :             if let Some((k, _)) = m.iter().find(|(_, v)| v == &&pauli_product_mask) {
+     122           1 :                 return Ok(*k);
+     123          21 :             }
+     124          21 :             m.insert(self.number_pauli_products, pauli_product_mask);
+     125          18 :         } else {
+     126          18 :             // Readout not yet in pauli_product_qubit_masks
+     127          18 :             let mut new_map = HashMap::new();
+     128          18 :             new_map.insert(self.number_pauli_products, pauli_product_mask);
+     129          18 :             self.pauli_product_qubit_masks.insert(readout, new_map);
+     130          18 :         }
+     131          39 :         self.number_pauli_products += 1;
+     132          39 : 
+     133          39 :         Ok(self.number_pauli_products - 1)
+     134          41 :     }
+     135             : 
+     136             :     /// Adds linear definition of expectation value to measurement input.
+     137             :     ///
+     138             :     /// Adds an expectation value that is defined by a linear combination
+     139             :     /// of expectation values of Pauli products.
+     140             :     ///
+     141             :     /// # Arguments
+     142             :     ///
+     143             :     /// * `name` - The name of the expectation value.
+     144             :     /// * `linear` - The linear combination of expectation values as a map between Pauli product index and coefficient.
+     145             :     ///
+     146             :     /// # Returns
+     147             :     ///
+     148             :     /// * `Ok()` - The value was successfully added.
+     149             :     /// * `Err([RoqoqoError::ExpValUsedTwice])` - The name of expectation value is already taken.
+     150          29 :     pub fn add_linear_exp_val(
+     151          29 :         &mut self,
+     152          29 :         name: String,
+     153          29 :         linear: HashMap<usize, f64>,
+     154          29 :     ) -> Result<(), RoqoqoError> {
+     155          29 :         if self
+     156          29 :             .measured_exp_vals
+     157          29 :             .insert(name.clone(), PauliProductsToExpVal::Linear(linear))
+     158          29 :             .is_some()
+     159             :         {
+     160           1 :             return Err(RoqoqoError::ExpValUsedTwice { name });
+     161          28 :         }
+     162          28 :         Ok(())
+     163          29 :     }
+     164             : 
+     165             :     /// Adds symbolic definition of expectation value to measurement input.
+     166             :     ///
+     167             :     /// Adds an expectation value that is defined by a symbolic combination
+     168             :     /// of expectation values of Pauli products.
+     169             :     ///
+     170             :     /// # Arguments
+     171             :     ///
+     172             :     /// * `name` - The name of the expectation value.
+     173             :     /// * `symbolic` - The symbolic expression for the expectation values
+     174             :     ///                given by [qoqo_calculator::CalculatorFloat].
+     175             :     ///
+     176             :     /// The i-th PauliProduct is hardcoded as variable `pauli_product_i`
+     177             :     /// in the string expression of CalculatorFloat.
+     178             :     ///
+     179             :     /// # Returns
+     180             :     ///
+     181             :     /// * `Ok()` - The value was successfully added.
+     182             :     /// * `Err([RoqoqoError::ExpValUsedTwice])` - The name of expectation value is already taken.
+     183           4 :     pub fn add_symbolic_exp_val(
+     184           4 :         &mut self,
+     185           4 :         name: String,
+     186           4 :         symbolic: CalculatorFloat,
+     187           4 :     ) -> Result<(), RoqoqoError> {
+     188           4 :         if self
+     189           4 :             .measured_exp_vals
+     190           4 :             .insert(name.clone(), PauliProductsToExpVal::Symbolic(symbolic))
+     191           4 :             .is_some()
+     192             :         {
+     193           1 :             return Err(RoqoqoError::ExpValUsedTwice { name });
+     194           3 :         }
+     195           3 :         Ok(())
+     196           4 :     }
+     197             : }
+     198             : 
+     199             : /// Provides necessary information to run a [crate::measurements::CheatedBasisRotation] measurement.
+     200             : ///
+     201             : /// Is used by the full measurement struct [crate::measurements::CheatedBasisRotation].
+     202           5 : #[derive(Debug, Clone, PartialEq)]
+     203             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     204             : pub struct CheatedBasisRotationInput {
+     205             :     /// Collection of names and construction methods of  expectation values.
+     206             :     ///
+     207             :     /// The construction methods are given by [PauliProductsToExpVal] enums.
+     208             :     pub measured_exp_vals: HashMap<String, PauliProductsToExpVal>,
+     209             :     /// Mapping the pauli product indices to the readout keys.
+     210             :     pub pauli_product_keys: HashMap<String, usize>,
+     211             : }
+     212             : 
+     213             : impl Default for CheatedBasisRotationInput {
+     214             :     /// Creates a default (here, new) instance of CheatedBasisRotationInput.
+     215           1 :     fn default() -> Self {
+     216           1 :         Self::new()
+     217           1 :     }
+     218             : }
+     219             : 
+     220             : impl CheatedBasisRotationInput {
+     221             :     /// Creates new CheatedBasisRotationInput.
+     222             :     ///
+     223             :     /// # Returns
+     224             :     ///
+     225             :     /// * `Self` - The new instance of CheatedBasisRotationInput with measured_exp_vals = an empty
+     226             :     ///            HashMap and pauli_product_keys = an empty HashMap.
+     227          14 :     pub fn new() -> Self {
+     228          14 :         Self {
+     229          14 :             measured_exp_vals: HashMap::new(),
+     230          14 :             pauli_product_keys: HashMap::new(),
+     231          14 :         }
+     232          14 :     }
+     233             : 
+     234             :     /// Adds measured Pauli product to CheatedBasisRotationInput and returns index of Pauli product.
+     235             :     ///
+     236             :     /// When the pauli product is already in the measurement input the function only returns
+     237             :     /// it index.
+     238             :     ///
+     239             :     /// # Arguments
+     240             :     ///
+     241             :     /// * `readout` - The name of the readout register containing the the pauli_product expecation value.
+     242             :     ///
+     243             :     /// # Returns
+     244             :     ///
+     245             :     /// * `usize` - The index of the added Pauli product in the list of all Pauli products.
+     246             :     pub fn add_pauli_product(&mut self, readout: String) -> usize {
+     247          12 :         if let Some((_, v)) = self.pauli_product_keys.iter().find(|(k, _)| k == &&readout) {
+     248           1 :             return *v;
+     249          11 :         }
+     250          11 :         self.pauli_product_keys
+     251          11 :             .insert(readout, self.pauli_product_keys.len());
+     252          11 :         self.pauli_product_keys.len() - 1
+     253          12 :     }
+     254             : 
+     255             :     /// Adds linear definition of expectation value to measurement input.
+     256             :     ///
+     257             :     /// Adds an expectation value that is defined by a linear combination
+     258             :     /// of expectation values of Pauli products.
+     259             :     ///
+     260             :     /// # Arguments
+     261             :     ///
+     262             :     /// * `name` - The name of the expectation value.
+     263             :     /// * `linear` - The linear combination of expectation values as a map between Pauli product index and coefficient.
+     264             :     ///
+     265             :     /// # Returns
+     266             :     ///
+     267             :     /// * `Ok()` - The value was successfully added.
+     268             :     /// * `Err([RoqoqoError::ExpValUsedTwice])` - The name of expectation value already taken.
+     269           3 :     pub fn add_linear_exp_val(
+     270           3 :         &mut self,
+     271           3 :         name: String,
+     272           3 :         linear: HashMap<usize, f64>,
+     273           3 :     ) -> Result<(), RoqoqoError> {
+     274           3 :         if self
+     275           3 :             .measured_exp_vals
+     276           3 :             .insert(name.clone(), PauliProductsToExpVal::Linear(linear))
+     277           3 :             .is_some()
+     278             :         {
+     279           1 :             return Err(RoqoqoError::ExpValUsedTwice { name });
+     280           2 :         }
+     281           2 :         Ok(())
+     282           3 :     }
+     283             : 
+     284             :     /// Adds linear definition of expectation value to measurement input.
+     285             :     ///
+     286             :     /// Adds an expectation value that is defined by a linear combination
+     287             :     /// of expectation values of Pauli products.
+     288             :     ///
+     289             :     /// # Arguments
+     290             :     ///
+     291             :     /// * `name` - The name of the expectation value.
+     292             :     /// * `symbolic` - The symbolic expression for the expectation values
+     293             :     ///                given by [qoqo_calculator::CalculatorFloat].
+     294             :     ///
+     295             :     /// The i-th PauliProducts are hardcoded as variables pauli_product_i
+     296             :     /// in the string expression of CalculatorFloat.
+     297             :     ///
+     298             :     /// # Returns
+     299             :     ///
+     300             :     /// * `Ok()` - The value was successfully added.
+     301             :     /// * `Err([RoqoqoError::ExpValUsedTwice])` - The name of expectation value already taken.
+     302           3 :     pub fn add_symbolic_exp_val(
+     303           3 :         &mut self,
+     304           3 :         name: String,
+     305           3 :         symbolic: CalculatorFloat,
+     306           3 :     ) -> Result<(), RoqoqoError> {
+     307           3 :         if self
+     308           3 :             .measured_exp_vals
+     309           3 :             .insert(name.clone(), PauliProductsToExpVal::Symbolic(symbolic))
+     310           3 :             .is_some()
+     311             :         {
+     312           1 :             return Err(RoqoqoError::ExpValUsedTwice { name });
+     313           2 :         }
+     314           2 :         Ok(())
+     315           3 :     }
+     316             : }
+     317             : 
+     318             : /// Provides necessary information to run a [crate::measurements::Cheated] measurement.
+     319             : ///
+     320             : /// Is used by the full measurement struct [crate::measurements::Cheated].
+     321           5 : #[derive(Debug, Clone, PartialEq)]
+     322             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     323             : pub struct CheatedInput {
+     324             :     /// Map of expectation values and corresponding operator Matrices on the Hilbert Space.
+     325             :     pub measured_operators: HashMap<String, (OperatorSparseVec, String)>,
+     326             :     /// Number of qubits that defines the dimension of the Hilbertspace.
+     327             :     pub number_qubits: usize,
+     328             : }
+     329             : 
+     330             : /// Represents Operator acting on Hilbert space as a sparse list of two indices and a value.
+     331             : ///
+     332             : /// The vector contains the triplets of non-zero elements of the sparse matrix
+     333             : /// representing the operator on the Hilbert space.
+     334             : /// The first element is the row index, the second the column index and the last the
+     335             : /// complex value of the non-zero entry.
+     336             : pub type OperatorSparseVec = Vec<(usize, usize, Complex64)>;
+     337             : 
+     338             : impl CheatedInput {
+     339             :     /// Creates new CheatedInput.
+     340             :     ///
+     341             :     /// # Arguments
+     342             :     ///
+     343             :     /// * `number_qubits` - The number of qubits in the Cheated measurement.
+     344             :     ///
+     345             :     /// # Returns
+     346             :     ///
+     347             :     /// * `Self` - The new instance of CheatedInput with measured_operators = an empty HashMap and the
+     348             :     ///            specified number of qubits in input.
+     349          16 :     pub fn new(number_qubits: usize) -> Self {
+     350          16 :         Self {
+     351          16 :             measured_operators: HashMap::new(),
+     352          16 :             number_qubits,
+     353          16 :         }
+     354          16 :     }
+     355             : 
+     356             :     /// Adds expectation value of an operator to measurement input.
+     357             :     ///
+     358             :     /// Adds an expectation value of a quantum operator defined by a complex matrix.
+     359             :     ///
+     360             :     /// # Arguments
+     361             :     ///
+     362             :     /// * `name` - The name. of the expectation value
+     363             :     /// * `operator` - The measured operator on the Hilbert space given as a list of sparse matrix entries of the form (row, col, value).
+     364             :     /// * `readout` - The name of the readout register that contains the density matrix or satevector.
+     365             :     ///
+     366             :     /// # Returns
+     367             :     ///
+     368             :     /// * `Ok()` - The operator was successfully added.
+     369             :     /// * `Err([RoqoqoError::MismatchedOperatorDimension])` - The index of operator exceeds Hilbert space dimension of qubits.
+     370             :     /// * `Err([RoqoqoError::ExpValUsedTwice])` - The name of expectation value already taken.
+     371          19 :     pub fn add_operator_exp_val(
+     372          19 :         &mut self,
+     373          19 :         name: String,
+     374          19 :         operator: OperatorSparseVec,
+     375          19 :         readout: String,
+     376          19 :     ) -> Result<(), RoqoqoError> {
+     377          19 :         let dimension = 2_usize.pow(self.number_qubits as u32);
+     378          19 :         if let Some((x, y, _)) = operator
+     379          19 :             .iter()
+     380          61 :             .find(|(x, y, _)| x >= &dimension || y >= &dimension)
+     381             :         {
+     382           1 :             return Err(RoqoqoError::MismatchedOperatorDimension {
+     383           1 :                 index: (*x, *y),
+     384           1 :                 number_qubits: self.number_qubits,
+     385           1 :             });
+     386          18 :         }
+     387          18 :         if self
+     388          18 :             .measured_operators
+     389          18 :             .insert(name.clone(), (operator, readout))
+     390          18 :             .is_some()
+     391             :         {
+     392           1 :             return Err(RoqoqoError::ExpValUsedTwice { name });
+     393          17 :         }
+     394          17 :         Ok(())
+     395          19 :     }
+     396             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/define_operations.rs.func-sort-c.html b/roqoqo/coveragehtml/src/operations/define_operations.rs.func-sort-c.html new file mode 100644 index 00000000..102f163a --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/define_operations.rs.func-sort-c.html @@ -0,0 +1,348 @@ + + + + + + + LCOV - coverage.lcov - src/operations/define_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - define_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:4545100.0 %
Date:2021-11-09 13:25:48Functions:6969100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::define_operations::DefinitionBit as core::clone::Clone>::clone1
<roqoqo::operations::define_operations::DefinitionBit as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::DefinitionBit as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::DefinitionBit as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionBit>::is_output1
<roqoqo::operations::define_operations::DefinitionBit>::length1
<roqoqo::operations::define_operations::DefinitionComplex as core::clone::Clone>::clone1
<roqoqo::operations::define_operations::DefinitionComplex as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::DefinitionComplex as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::DefinitionComplex as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionComplex>::is_output1
<roqoqo::operations::define_operations::DefinitionComplex>::length1
<roqoqo::operations::define_operations::DefinitionFloat as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::DefinitionFloat as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::DefinitionFloat as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionFloat>::is_output1
<roqoqo::operations::define_operations::DefinitionFloat>::length1
<roqoqo::operations::define_operations::DefinitionUsize as core::clone::Clone>::clone1
<roqoqo::operations::define_operations::DefinitionUsize as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::DefinitionUsize as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::DefinitionUsize as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionUsize>::is_output1
<roqoqo::operations::define_operations::DefinitionUsize>::length1
<roqoqo::operations::define_operations::InputSymbolic as core::clone::Clone>::clone1
<roqoqo::operations::define_operations::InputSymbolic as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::InputSymbolic as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::InputSymbolic as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Operate>::hqslang2
<roqoqo::operations::define_operations::DefinitionBit>::new2
<roqoqo::operations::define_operations::DefinitionComplex>::new2
<roqoqo::operations::define_operations::DefinitionFloat as core::clone::Clone>::clone2
<roqoqo::operations::define_operations::DefinitionFloat>::new2
<roqoqo::operations::define_operations::DefinitionUsize>::new2
<roqoqo::operations::define_operations::InputSymbolic>::input2
<roqoqo::operations::define_operations::InputSymbolic>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/define_operations.rs.func.html b/roqoqo/coveragehtml/src/operations/define_operations.rs.func.html new file mode 100644 index 00000000..4d23fce2 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/define_operations.rs.func.html @@ -0,0 +1,348 @@ + + + + + + + LCOV - coverage.lcov - src/operations/define_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - define_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:4545100.0 %
Date:2021-11-09 13:25:48Functions:6969100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::define_operations::DefinitionBit as core::clone::Clone>::clone1
<roqoqo::operations::define_operations::DefinitionBit as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::DefinitionBit as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::DefinitionBit as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Operate>::hqslang2
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::DefinitionBit as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionBit>::is_output1
<roqoqo::operations::define_operations::DefinitionBit>::length1
<roqoqo::operations::define_operations::DefinitionBit>::new2
<roqoqo::operations::define_operations::DefinitionComplex as core::clone::Clone>::clone1
<roqoqo::operations::define_operations::DefinitionComplex as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::DefinitionComplex as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::DefinitionComplex as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::DefinitionComplex as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionComplex>::is_output1
<roqoqo::operations::define_operations::DefinitionComplex>::length1
<roqoqo::operations::define_operations::DefinitionComplex>::new2
<roqoqo::operations::define_operations::DefinitionFloat as core::clone::Clone>::clone2
<roqoqo::operations::define_operations::DefinitionFloat as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::DefinitionFloat as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::DefinitionFloat as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::DefinitionFloat as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionFloat>::is_output1
<roqoqo::operations::define_operations::DefinitionFloat>::length1
<roqoqo::operations::define_operations::DefinitionFloat>::new2
<roqoqo::operations::define_operations::DefinitionUsize as core::clone::Clone>::clone1
<roqoqo::operations::define_operations::DefinitionUsize as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::DefinitionUsize as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::DefinitionUsize as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::DefinitionUsize as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::DefinitionUsize>::is_output1
<roqoqo::operations::define_operations::DefinitionUsize>::length1
<roqoqo::operations::define_operations::DefinitionUsize>::new2
<roqoqo::operations::define_operations::InputSymbolic as core::clone::Clone>::clone1
<roqoqo::operations::define_operations::InputSymbolic as core::cmp::PartialEq>::eq1
<roqoqo::operations::define_operations::InputSymbolic as core::cmp::PartialEq>::ne1
<roqoqo::operations::define_operations::InputSymbolic as core::fmt::Debug>::fmt1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Define>::name1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Operate>::tags1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::define_operations::InputSymbolic as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::define_operations::InputSymbolic>::input2
<roqoqo::operations::define_operations::InputSymbolic>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/define_operations.rs.gcov.html b/roqoqo/coveragehtml/src/operations/define_operations.rs.gcov.html new file mode 100644 index 00000000..5fa7d073 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/define_operations.rs.gcov.html @@ -0,0 +1,263 @@ + + + + + + + LCOV - coverage.lcov - src/operations/define_operations.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - define_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:4545100.0 %
Date:2021-11-09 13:25:48Functions:6969100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : //
+      13             : 
+      14             : //! Definition Operation that defines the classical registers and variables in the Circuit.
+      15             : //!
+      16             : //! In general, every circuit will have at least one Definition operation. The main
+      17             : //! reasons one would need a Definition operation in a circuit is for measurements.
+      18             : //! If you need to measure something in a circuit using a MeasureQubit operation
+      19             : //! (see qoqo.operations.measurememnt_operations.py), you need to define the classical
+      20             : //! register used to store the measurement result.
+      21             : //!
+      22             : //! You need to add the Define operation to the circuit before what you are defining is used.
+      23             : //! Therefore, qoqo uses the convention that Definition operations are added first to the circuit,
+      24             : //! before you add any other operations.
+      25             : //!
+      26             : //! There are 5 types of Definitions:
+      27             : //! (1) DefinitionFloat, where the register defined contains a float or floats.
+      28             : //! (2) DefinitionComplex, where the register defined contains a complex or complexes.
+      29             : //! (3) DefinitionUsize, where the register defined contains an integer or integers.
+      30             : //! (4) DefinitionBit, where the register defined contains a bit or bits.
+      31             : //! (5) InputSymbolic, where the user can define a floating point type value to replace a certain symbolic parameter.
+      32             : //!
+      33             : 
+      34             : use crate::operations::{Define, InvolveQubits, InvolvedQubits, Operate, RoqoqoError, Substitute};
+      35             : 
+      36             : /// DefinitionFloat is the Definition for a floating point type register.
+      37             : ///
+      38             : #[derive(
+      39           3 :     Debug,
+      40          18 :     Clone,
+      41          22 :     PartialEq,
+      42          28 :     roqoqo_derive::Operate,
+      43           2 :     roqoqo_derive::Substitute,
+      44           1 :     roqoqo_derive::Define,
+      45             : )]
+      46             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      47             : pub struct DefinitionFloat {
+      48             :     /// The name of the register that is defined.
+      49             :     name: String,
+      50             :     /// The length of the register that is defined, usually the number of qubits to be measured.
+      51             :     length: usize,
+      52             :     /// True/False if the variable is an output to the program.
+      53             :     is_output: bool,
+      54             : }
+      55             : 
+      56             : #[allow(non_upper_case_globals)]
+      57             : const TAGS_DefinitionFloat: &[&str; 3] = &["Operation", "Definition", "DefinitionFloat"];
+      58             : 
+      59             : // Implementing the InvolveQubits trait for DefinitionFloat.
+      60             : impl InvolveQubits for DefinitionFloat {
+      61             :     /// Lists all involved Qubits (here, none).
+      62           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+      63           1 :         InvolvedQubits::None
+      64           1 :     }
+      65             : }
+      66             : 
+      67             : /// DefinitionComplex is the Definition for a Complex type register.
+      68             : ///
+      69             : #[derive(
+      70           1 :     Debug,
+      71           3 :     Clone,
+      72           8 :     PartialEq,
+      73          15 :     roqoqo_derive::Operate,
+      74           2 :     roqoqo_derive::Substitute,
+      75           1 :     roqoqo_derive::Define,
+      76             : )]
+      77             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      78             : pub struct DefinitionComplex {
+      79             :     /// The name of the register that is defined.
+      80             :     name: String,
+      81             :     /// The length of the register that is defined, usually the number of qubits to be measured.
+      82             :     length: usize,
+      83             :     /// True/False if the variable is an output to the program.
+      84             :     is_output: bool,
+      85             : }
+      86             : 
+      87             : #[allow(non_upper_case_globals)]
+      88             : const TAGS_DefinitionComplex: &[&str; 3] = &["Operation", "Definition", "DefinitionComplex"];
+      89             : 
+      90             : // Implementing the InvolveQubits trait for DefinitionComplex.
+      91             : impl InvolveQubits for DefinitionComplex {
+      92             :     /// Lists all involved Qubits (here, none).
+      93           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+      94           1 :         InvolvedQubits::None
+      95           1 :     }
+      96             : }
+      97             : 
+      98             : /// DefinitionUsize is the Definition for an Integer type register.
+      99             : ///
+     100             : #[derive(
+     101           1 :     Debug,
+     102           3 :     Clone,
+     103           8 :     PartialEq,
+     104          15 :     roqoqo_derive::Operate,
+     105           2 :     roqoqo_derive::Substitute,
+     106           1 :     roqoqo_derive::Define,
+     107             : )]
+     108             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     109             : pub struct DefinitionUsize {
+     110             :     /// The name of the register that is defined.
+     111             :     name: String,
+     112             :     /// The length of the register that is defined, usually the number of qubits to be measured.
+     113             :     length: usize,
+     114             :     /// True/False if the variable is an output to the program.
+     115             :     is_output: bool,
+     116             : }
+     117             : 
+     118             : #[allow(non_upper_case_globals)]
+     119             : const TAGS_DefinitionUsize: &[&str; 3] = &["Operation", "Definition", "DefinitionUsize"];
+     120             : 
+     121             : // Implementing the InvolveQubits trait for DefinitionUsize.
+     122             : impl InvolveQubits for DefinitionUsize {
+     123             :     /// Lists all involved Qubits (here, none).
+     124           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     125           1 :         InvolvedQubits::None
+     126           1 :     }
+     127             : }
+     128             : 
+     129             : /// DefinitionBit is the Definition for a Bit type register.
+     130             : ///
+     131             : #[derive(
+     132           1 :     Debug,
+     133           6 :     Clone,
+     134          11 :     PartialEq,
+     135          20 :     roqoqo_derive::Operate,
+     136           2 :     roqoqo_derive::Substitute,
+     137           1 :     roqoqo_derive::Define,
+     138             : )]
+     139             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     140             : pub struct DefinitionBit {
+     141             :     /// The name of the register that is defined.
+     142             :     name: String,
+     143             :     /// The length of the register that is defined, usually the number of qubits to be measured.
+     144             :     length: usize,
+     145             :     /// True/False if the variable is an output to the program.
+     146             :     is_output: bool,
+     147             : }
+     148             : 
+     149             : #[allow(non_upper_case_globals)]
+     150             : const TAGS_DefinitionBit: &[&str; 3] = &["Operation", "Definition", "DefinitionBit"];
+     151             : 
+     152             : // Implementing the InvolveQubits trait for DefinitionBit.
+     153             : impl InvolveQubits for DefinitionBit {
+     154             :     /// Lists all involved Qubits (here, none).
+     155           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     156           1 :         InvolvedQubits::None
+     157           1 :     }
+     158             : }
+     159             : 
+     160             : /// InputSymbolic is the Definition for a floating point type parameter which will replace a certain symbolic parameter.
+     161             : ///
+     162             : #[derive(
+     163           1 :     Debug,
+     164           3 :     Clone,
+     165           9 :     PartialEq,
+     166          18 :     roqoqo_derive::Operate,
+     167           3 :     roqoqo_derive::Substitute,
+     168           2 :     roqoqo_derive::Define,
+     169             : )]
+     170             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     171             : pub struct InputSymbolic {
+     172             :     /// The name of the register that is defined.
+     173             :     name: String,
+     174             :     /// The floating point type value by which to replace the quantities marked as "name".
+     175             :     input: f64,
+     176             : }
+     177             : 
+     178             : #[allow(non_upper_case_globals)]
+     179             : const TAGS_InputSymbolic: &[&str; 3] = &["Operation", "Definition", "InputSymbolic"];
+     180             : 
+     181             : // Implementing the InvolveQubits trait for InputSymbolic.
+     182             : impl InvolveQubits for InputSymbolic {
+     183             :     /// Lists all involved Qubits (here, none).
+     184           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     185           1 :         InvolvedQubits::None
+     186           1 :     }
+     187             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/index-sort-f.html b/roqoqo/coveragehtml/src/operations/index-sort-f.html new file mode 100644 index 00000000..1997faa8 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/index-sort-f.html @@ -0,0 +1,153 @@ + + + + + + + LCOV - coverage.lcov - src/operations + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operationsHitTotalCoverage
Test:coverage.lcovLines:2132216598.5 %
Date:2021-11-09 13:25:48Functions:1191120898.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
mod.rs +
100.0%
+
100.0 %26 / 2675.0 %6 / 8
pragma_operations.rs +
90.7%90.7%
+
90.7 %283 / 31294.7 %270 / 285
multi_qubit_gate_operations.rs +
100.0%
+
100.0 %37 / 37100.0 %18 / 18
define_operations.rs +
100.0%
+
100.0 %45 / 45100.0 %69 / 69
measurement_operations.rs +
96.7%96.7%
+
96.7 %119 / 123100.0 %84 / 84
single_qubit_gate_operations.rs +
100.0%
+
100.0 %496 / 496100.0 %314 / 314
two_qubit_gate_operations.rs +
100.0%
+
100.0 %1126 / 1126100.0 %430 / 430
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/index-sort-l.html b/roqoqo/coveragehtml/src/operations/index-sort-l.html new file mode 100644 index 00000000..e2de2427 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/index-sort-l.html @@ -0,0 +1,153 @@ + + + + + + + LCOV - coverage.lcov - src/operations + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operationsHitTotalCoverage
Test:coverage.lcovLines:2132216598.5 %
Date:2021-11-09 13:25:48Functions:1191120898.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
pragma_operations.rs +
90.7%90.7%
+
90.7 %283 / 31294.7 %270 / 285
measurement_operations.rs +
96.7%96.7%
+
96.7 %119 / 123100.0 %84 / 84
mod.rs +
100.0%
+
100.0 %26 / 2675.0 %6 / 8
multi_qubit_gate_operations.rs +
100.0%
+
100.0 %37 / 37100.0 %18 / 18
define_operations.rs +
100.0%
+
100.0 %45 / 45100.0 %69 / 69
single_qubit_gate_operations.rs +
100.0%
+
100.0 %496 / 496100.0 %314 / 314
two_qubit_gate_operations.rs +
100.0%
+
100.0 %1126 / 1126100.0 %430 / 430
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/index.html b/roqoqo/coveragehtml/src/operations/index.html new file mode 100644 index 00000000..6f3cab76 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/index.html @@ -0,0 +1,153 @@ + + + + + + + LCOV - coverage.lcov - src/operations + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operationsHitTotalCoverage
Test:coverage.lcovLines:2132216598.5 %
Date:2021-11-09 13:25:48Functions:1191120898.6 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Filename Sort by nameLine Coverage Sort by line coverageFunctions Sort by function coverage
define_operations.rs +
100.0%
+
100.0 %45 / 45100.0 %69 / 69
measurement_operations.rs +
96.7%96.7%
+
96.7 %119 / 123100.0 %84 / 84
mod.rs +
100.0%
+
100.0 %26 / 2675.0 %6 / 8
multi_qubit_gate_operations.rs +
100.0%
+
100.0 %37 / 37100.0 %18 / 18
pragma_operations.rs +
90.7%90.7%
+
90.7 %283 / 31294.7 %270 / 285
single_qubit_gate_operations.rs +
100.0%
+
100.0 %496 / 496100.0 %314 / 314
two_qubit_gate_operations.rs +
100.0%
+
100.0 %1126 / 1126100.0 %430 / 430
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/measurement_operations.rs.func-sort-c.html b/roqoqo/coveragehtml/src/operations/measurement_operations.rs.func-sort-c.html new file mode 100644 index 00000000..8af8809a --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/measurement_operations.rs.func-sort-c.html @@ -0,0 +1,408 @@ + + + + + + + LCOV - coverage.lcov - src/operations/measurement_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - measurement_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:11912396.7 %
Date:2021-11-09 13:25:48Functions:8484100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::measurement_operations::MeasureQubit as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::MeasureQubit as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::MeasureQubit as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::MeasureQubit as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::MeasureQubit>::readout1
<roqoqo::operations::measurement_operations::MeasureQubit>::readout_index1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix>::circuit1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix>::readout1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability>::circuit1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability>::readout1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct>::circuit1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct>::qubit_paulis1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct>::readout1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaGetStateVector>::circuit1
<roqoqo::operations::measurement_operations::PragmaGetStateVector>::readout1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement>::number_measurements1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement>::qubit_mapping1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement>::readout1
<roqoqo::operations::measurement_operations::MeasureQubit>::new2
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix>::new2
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability>::new2
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct>::new2
<roqoqo::operations::measurement_operations::PragmaGetStateVector>::new2
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as core::clone::Clone>::clone2
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/measurement_operations.rs.func.html b/roqoqo/coveragehtml/src/operations/measurement_operations.rs.func.html new file mode 100644 index 00000000..b7278686 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/measurement_operations.rs.func.html @@ -0,0 +1,408 @@ + + + + + + + LCOV - coverage.lcov - src/operations/measurement_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - measurement_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:11912396.7 %
Date:2021-11-09 13:25:48Functions:8484100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::measurement_operations::MeasureQubit as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::MeasureQubit as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::MeasureQubit as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::MeasureQubit as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::measurement_operations::MeasureQubit as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::MeasureQubit>::new2
<roqoqo::operations::measurement_operations::MeasureQubit>::readout1
<roqoqo::operations::measurement_operations::MeasureQubit>::readout_index1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix>::circuit1
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix>::new2
<roqoqo::operations::measurement_operations::PragmaGetDensityMatrix>::readout1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability>::circuit1
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability>::new2
<roqoqo::operations::measurement_operations::PragmaGetOccupationProbability>::readout1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct>::circuit1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct>::new2
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct>::qubit_paulis1
<roqoqo::operations::measurement_operations::PragmaGetPauliProduct>::readout1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as core::clone::Clone>::clone1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaGetStateVector as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaGetStateVector>::circuit1
<roqoqo::operations::measurement_operations::PragmaGetStateVector>::new2
<roqoqo::operations::measurement_operations::PragmaGetStateVector>::readout1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as core::clone::Clone>::clone2
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as core::cmp::PartialEq>::eq1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as core::cmp::PartialEq>::ne1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as core::fmt::Debug>::fmt1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Operate>::tags1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement>::new2
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement>::number_measurements1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement>::qubit_mapping1
<roqoqo::operations::measurement_operations::PragmaRepeatedMeasurement>::readout1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/measurement_operations.rs.gcov.html b/roqoqo/coveragehtml/src/operations/measurement_operations.rs.gcov.html new file mode 100644 index 00000000..af36b055 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/measurement_operations.rs.gcov.html @@ -0,0 +1,415 @@ + + + + + + + LCOV - coverage.lcov - src/operations/measurement_operations.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - measurement_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:11912396.7 %
Date:2021-11-09 13:25:48Functions:8484100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : //
+      13             : //! Collection of roqoqo measurement operations.
+      14             : 
+      15             : use qoqo_calculator::Calculator;
+      16             : use std::collections::{HashMap, HashSet};
+      17             : 
+      18             : use crate::operations::{
+      19             :     InvolveQubits, InvolvedQubits, Operate, OperatePragma, OperateSingleQubit, RoqoqoError,
+      20             :     Substitute,
+      21             : };
+      22             : use crate::Circuit;
+      23             : 
+      24             : /// Measurement gate operation.
+      25             : ///
+      26             : /// This Operation acts on one qubit writing the result of the measurement into a readout.
+      27             : /// The classical register for the readout needs to be defined in advance by using a Definition operation.
+      28             : ///
+      29             : /// # Note
+      30             : ///
+      31             : /// Here, it is a measurement in terms of quantum mechanics. The obtained result of a $\textit{single}$ measurement will be either a `0` or a `1`.  
+      32             : /// In order to be able to derive probabilities in the $\textit{post-processing}$, the actual measurement needs to be repeated lots of times.
+      33             : ///
+      34             : #[derive(
+      35           1 :     Debug,
+      36           1 :     Clone,
+      37           7 :     PartialEq,
+      38           1 :     roqoqo_derive::InvolveQubits,
+      39          15 :     roqoqo_derive::Operate,
+      40           2 :     roqoqo_derive::Substitute,
+      41           2 :     roqoqo_derive::OperateSingleQubit,
+      42             : )]
+      43             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      44             : pub struct MeasureQubit {
+      45             :     /// The measured qubit.
+      46             :     qubit: usize,
+      47             :     /// The register for the readout.
+      48             :     readout: String,
+      49             :     /// The index in the readout the result is saved to.
+      50             :     readout_index: usize,
+      51             : }
+      52             : 
+      53             : #[allow(non_upper_case_globals)]
+      54             : const TAGS_MeasureQubit: &[&str; 3] = &["Operation", "Measurement", "MeasureQubit"];
+      55             : 
+      56             : /// This PRAGMA measurement operation returns the statevector of a quantum register.
+      57             : ///
+      58           8 : #[derive(Debug, Clone, PartialEq, roqoqo_derive::Operate, roqoqo_derive::OperatePragma)]
+      59             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      60             : pub struct PragmaGetStateVector {
+      61             :     /// The name of the classical readout register.
+      62             :     readout: String,
+      63             :     /// The measurement preparation Circuit, applied on a copy of the register before measurement (None if not defined, Some(Circuit) otherwise).
+      64             :     circuit: Option<Circuit>,
+      65             : }
+      66             : 
+      67             : #[allow(non_upper_case_globals)]
+      68             : const TAGS_PragmaGetStateVector: &[&str; 4] = &[
+      69             :     "Operation",
+      70             :     "Measurement",
+      71             :     "PragmaOperation",
+      72             :     "PragmaGetStateVector",
+      73             : ];
+      74             : 
+      75             : /// Implements [Substitute] trait allowing to replace symbolic parameters and to perform qubit mappings.
+      76             : impl Substitute for PragmaGetStateVector {
+      77             :     /// Remaps qubits in operations in clone of the operation.
+      78           2 :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+      79           2 :         let new_circuit = match self.circuit.as_ref() {
+      80           1 :             Some(x) => Some(x.remap_qubits(mapping)?),
+      81           1 :             _ => None,
+      82             :         };
+      83           2 :         Ok(PragmaGetStateVector::new(self.readout.clone(), new_circuit))
+      84           2 :     }
+      85             : 
+      86             :     /// Substitutes symbolic parameters in clone of the operation.
+      87           1 :     fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+      88           1 :         let new_circuit = match self.circuit.as_ref() {
+      89           0 :             Some(x) => Some(x.substitute_parameters(calculator)?),
+      90           1 :             _ => None,
+      91             :         };
+      92           1 :         Ok(PragmaGetStateVector::new(self.readout.clone(), new_circuit))
+      93           1 :     }
+      94             : }
+      95             : 
+      96             : // Implements the InvolveQubits trait for PragmaGetStateVector.
+      97             : impl InvolveQubits for PragmaGetStateVector {
+      98             :     /// Lists all involved qubits (here: All).
+      99           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     100           1 :         InvolvedQubits::All
+     101           1 :     }
+     102             : }
+     103             : 
+     104             : /// This PRAGMA measurement operation returns the density matrix of a quantum register.
+     105             : ///
+     106           8 : #[derive(Debug, Clone, PartialEq, roqoqo_derive::Operate, roqoqo_derive::OperatePragma)]
+     107             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     108             : pub struct PragmaGetDensityMatrix {
+     109             :     /// The name of the classical readout register.
+     110             :     readout: String,
+     111             :     /// The measurement preparation Circuit, applied on a copy of the register before measurement (None if not defined, Some(Circuit) otherwise).
+     112             :     circuit: Option<Circuit>,
+     113             : }
+     114             : 
+     115             : #[allow(non_upper_case_globals)]
+     116             : const TAGS_PragmaGetDensityMatrix: &[&str; 4] = &[
+     117             :     "Operation",
+     118             :     "Measurement",
+     119             :     "PragmaOperation",
+     120             :     "PragmaGetDensityMatrix",
+     121             : ];
+     122             : 
+     123             : /// Implements [Substitute] trait allowing to replace symbolic parameters and to perform qubit mappings.
+     124             : impl Substitute for PragmaGetDensityMatrix {
+     125             :     /// Remaps qubits in operations in clone of the operation.
+     126           2 :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+     127           2 :         let new_circuit = match self.circuit.as_ref() {
+     128           1 :             Some(x) => Some(x.remap_qubits(mapping)?),
+     129           1 :             _ => None,
+     130             :         };
+     131           2 :         Ok(PragmaGetDensityMatrix::new(
+     132           2 :             self.readout.clone(),
+     133           2 :             new_circuit,
+     134           2 :         ))
+     135           2 :     }
+     136             : 
+     137             :     /// Substitutes symbolic parameters in clone of the operation.
+     138           1 :     fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+     139           1 :         let new_circuit = match self.circuit.as_ref() {
+     140           0 :             Some(x) => Some(x.substitute_parameters(calculator)?),
+     141           1 :             _ => None,
+     142             :         };
+     143           1 :         Ok(PragmaGetDensityMatrix::new(
+     144           1 :             self.readout.clone(),
+     145           1 :             new_circuit,
+     146           1 :         ))
+     147           1 :     }
+     148             : }
+     149             : 
+     150             : // Implements the InvolveQubits trait for PragmaGetDensityMatrix.
+     151             : impl InvolveQubits for PragmaGetDensityMatrix {
+     152             :     /// Lists all involved qubits (here, all).
+     153           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     154           1 :         InvolvedQubits::All
+     155           1 :     }
+     156             : }
+     157             : 
+     158             : /// This PRAGMA measurement operation returns the vector of the occupation probabilities.
+     159             : ///
+     160             : /// Occupation probabilities in the context of this PRAGMA Operation are probabilities of finding the quantum
+     161             : /// register in each $\sigma_z$ basis state. The quantum register remains unchanged by this PRAGMA measurement operation.
+     162             : ///
+     163           8 : #[derive(Debug, Clone, PartialEq, roqoqo_derive::Operate, roqoqo_derive::OperatePragma)]
+     164             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     165             : pub struct PragmaGetOccupationProbability {
+     166             :     /// The name of the classical readout register.
+     167             :     readout: String,
+     168             :     /// The measurement preparation Circuit, applied on a copy of the register before measurement (None if not defined, Some(Circuit) otherwise).
+     169             :     circuit: Option<Circuit>,
+     170             : }
+     171             : 
+     172             : #[allow(non_upper_case_globals)]
+     173             : const TAGS_PragmaGetOccupationProbability: &[&str; 4] = &[
+     174             :     "Operation",
+     175             :     "Measurement",
+     176             :     "PragmaOperation",
+     177             :     "PragmaGetOccupationProbability",
+     178             : ];
+     179             : 
+     180             : /// Implements [Substitute] trait allowing to replace symbolic parameters and to perform qubit mappings.
+     181             : impl Substitute for PragmaGetOccupationProbability {
+     182             :     /// Remaps qubits in operations in clone of the operation.
+     183           2 :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+     184           2 :         let new_circuit = match self.circuit.as_ref() {
+     185           1 :             Some(x) => Some(x.remap_qubits(mapping)?),
+     186           1 :             _ => None,
+     187             :         };
+     188           2 :         Ok(PragmaGetOccupationProbability::new(
+     189           2 :             self.readout.clone(),
+     190           2 :             new_circuit,
+     191           2 :         ))
+     192           2 :     }
+     193             : 
+     194             :     /// Substitutes symbolic parameters in clone of the operation.
+     195           1 :     fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+     196           1 :         let new_circuit = match self.circuit.as_ref() {
+     197           0 :             Some(x) => Some(x.substitute_parameters(calculator)?),
+     198           1 :             _ => None,
+     199             :         };
+     200           1 :         Ok(PragmaGetOccupationProbability::new(
+     201           1 :             self.readout.clone(),
+     202           1 :             new_circuit,
+     203           1 :         ))
+     204           1 :     }
+     205             : }
+     206             : 
+     207             : // Implements the InvolveQubits trait for PragmaGetOccupationProbability.
+     208             : impl InvolveQubits for PragmaGetOccupationProbability {
+     209             :     /// Lists all involved qubits (here, all).
+     210           2 :     fn involved_qubits(&self) -> InvolvedQubits {
+     211           2 :         InvolvedQubits::All
+     212           2 :     }
+     213             : }
+     214             : 
+     215             : /// This PRAGMA measurement operation returns a Pauli product expectation value.
+     216             : ///
+     217             : /// This PRAGMA Operation returns a Pauli product expectation value after applying
+     218             : /// a Rotate to another basis. It performs all of the operation on a clone of the quantum register,
+     219             : /// so that the actual quantum register remains unchanged.
+     220             : ///
+     221          19 : #[derive(Debug, Clone, PartialEq, roqoqo_derive::Operate, roqoqo_derive::OperatePragma)]
+     222             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     223             : pub struct PragmaGetPauliProduct {
+     224             :     /// The HashMap of the pauli matrix to apply to each qubit in the form {qubit: pauli}. Allowed values to be provided for 'pauli' are: `0` = identity, `1` = PauliX, `2` = PauliY, `3` = PauliZ.
+     225             :     qubit_paulis: HashMap<usize, usize>,
+     226             :     /// The name of the classical readout register.
+     227             :     readout: String,
+     228             :     /// The measurement preparation Circuit, applied on a copy of the register before measurement.
+     229             :     circuit: Circuit,
+     230             : }
+     231             : 
+     232             : #[allow(non_upper_case_globals)]
+     233             : const TAGS_PragmaGetPauliProduct: &[&str; 4] = &[
+     234             :     "Operation",
+     235             :     "Measurement",
+     236             :     "PragmaOperation",
+     237             :     "PragmaGetPauliProduct",
+     238             : ];
+     239             : 
+     240             : /// Implements [Substitute] trait allowing to replace symbolic parameters and to perform qubit mappings.
+     241             : impl Substitute for PragmaGetPauliProduct {
+     242             :     /// Remaps qubits in operations in clone of the operation.
+     243           2 :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+     244           2 :         let mut mutable_mapping: HashMap<usize, usize> = self.qubit_paulis.clone();
+     245           4 :         for (old_qubit, new_qubit) in mapping {
+     246           2 :             if let Some(v) = mutable_mapping.remove(old_qubit) {
+     247           2 :                 mutable_mapping.insert(*new_qubit, v);
+     248           2 :             }
+     249             :         }
+     250           2 :         let new_circuit = self.circuit.remap_qubits(mapping).unwrap();
+     251           2 :         Ok(PragmaGetPauliProduct::new(
+     252           2 :             mutable_mapping,
+     253           2 :             self.readout.clone(),
+     254           2 :             new_circuit,
+     255           2 :         ))
+     256           2 :     }
+     257             : 
+     258             :     /// Substitutes symbolic parameters in clone of the operation.
+     259           1 :     fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+     260           1 :         let new_circuit = self.circuit.substitute_parameters(calculator).unwrap();
+     261           1 :         Ok(PragmaGetPauliProduct::new(
+     262           1 :             self.qubit_paulis.clone(),
+     263           1 :             self.readout.clone(),
+     264           1 :             new_circuit,
+     265           1 :         ))
+     266           1 :     }
+     267             : }
+     268             : 
+     269             : // Implements the InvolveQubits trait for PragmaGetPauliProduct.
+     270             : impl InvolveQubits for PragmaGetPauliProduct {
+     271             :     /// Lists all involved qubits.
+     272           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     273           1 :         let mut new_hash_set: HashSet<usize> = HashSet::new();
+     274           1 :         for qubit in self.qubit_paulis.keys() {
+     275           1 :             new_hash_set.insert(*qubit);
+     276           1 :         }
+     277           1 :         if let InvolvedQubits::Set(tmp_set) = &self.circuit.involved_qubits() {
+     278           1 :             for qubit in tmp_set {
+     279           1 :                 new_hash_set.insert(*qubit);
+     280           1 :             }
+     281           0 :         }
+     282           1 :         InvolvedQubits::Set(new_hash_set)
+     283           1 :     }
+     284             : }
+     285             : 
+     286             : /// This PRAGMA measurement operation returns a measurement record for $N$ repeated measurements.
+     287             : ///
+     288          15 : #[derive(Debug, Clone, PartialEq, roqoqo_derive::Operate, roqoqo_derive::OperatePragma)]
+     289             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     290             : pub struct PragmaRepeatedMeasurement {
+     291             :     /// The name of the classical readout register.
+     292             :     readout: String,
+     293             :     /// The number of times $N$ to repeat the measurement.
+     294             :     number_measurements: usize,
+     295             :     /// The mapping of qubits to indices in the readout register.
+     296             :     qubit_mapping: Option<HashMap<usize, usize>>,
+     297             : }
+     298             : 
+     299             : #[allow(non_upper_case_globals)]
+     300             : const TAGS_PragmaRepeatedMeasurement: &[&str; 4] = &[
+     301             :     "Operation",
+     302             :     "Measurement",
+     303             :     "PragmaOperation",
+     304             :     "PragmaRepeatedMeasurement",
+     305             : ];
+     306             : 
+     307             : /// Implements [Substitute] trait allowing to replace symbolic parameters and to perform qubit mappings.
+     308             : impl Substitute for PragmaRepeatedMeasurement {
+     309             :     /// Remaps qubits in operations in clone of the operation.
+     310           1 :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+     311           1 :         let new_mapping = (self.qubit_mapping.clone()).map(|hm| {
+     312           1 :             let mut mutable_mapping: HashMap<usize, usize> = hm;
+     313           2 :             for (old_qubit, new_qubit) in mapping {
+     314           1 :                 if let Some(v) = mutable_mapping.remove(old_qubit) {
+     315           1 :                     mutable_mapping.insert(*new_qubit, v);
+     316           1 :                 }
+     317             :             }
+     318           1 :             mutable_mapping
+     319           1 :         });
+     320           1 :         Ok(PragmaRepeatedMeasurement::new(
+     321           1 :             self.readout.clone(),
+     322           1 :             self.number_measurements,
+     323           1 :             new_mapping,
+     324           1 :         ))
+     325           1 :     }
+     326             : 
+     327             :     /// Substitutes symbolic parameters in clone of the operation.
+     328           1 :     fn substitute_parameters(&self, _calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+     329           1 :         Ok(self.clone())
+     330           1 :     }
+     331             : }
+     332             : 
+     333             : // Implements the InvolveQubits trait for PragmaRepeatedMeasurement.
+     334             : impl InvolveQubits for PragmaRepeatedMeasurement {
+     335             :     /// Lists all involved qubits (here, all).
+     336           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     337           1 :         InvolvedQubits::All
+     338           1 :     }
+     339             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/mod.rs.func-sort-c.html b/roqoqo/coveragehtml/src/operations/mod.rs.func-sort-c.html new file mode 100644 index 00000000..400b9ffa --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/mod.rs.func-sort-c.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.lcov - src/operations/mod.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - mod.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:2626100.0 %
Date:2021-11-09 13:25:48Functions:6875.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<_ as roqoqo::operations::OperateSingleQubitGate>::mul::<_>0
<roqoqo::operations::InvolvedQubits as core::fmt::Debug>::fmt0
<roqoqo::operations::InvolvedQubits as core::clone::Clone>::clone1
<roqoqo::operations::InvolvedQubits as core::cmp::PartialEq>::eq1
<roqoqo::operations::InvolvedQubits as core::cmp::PartialEq>::ne1
<roqoqo::operations::SingleQubitGateOperation as roqoqo::operations::OperateSingleQubitGate>::mul::<roqoqo::operations::SingleQubitGateOperation>1
<roqoqo::operations::SingleQubitGateOperation as roqoqo::operations::OperateSingleQubitGate>::mul::<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate>1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::mul::<roqoqo::operations::single_qubit_gate_operations::RotateX>1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/mod.rs.func.html b/roqoqo/coveragehtml/src/operations/mod.rs.func.html new file mode 100644 index 00000000..e9b31bec --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/mod.rs.func.html @@ -0,0 +1,104 @@ + + + + + + + LCOV - coverage.lcov - src/operations/mod.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - mod.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:2626100.0 %
Date:2021-11-09 13:25:48Functions:6875.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<_ as roqoqo::operations::OperateSingleQubitGate>::mul::<_>0
<roqoqo::operations::InvolvedQubits as core::clone::Clone>::clone1
<roqoqo::operations::InvolvedQubits as core::cmp::PartialEq>::eq1
<roqoqo::operations::InvolvedQubits as core::cmp::PartialEq>::ne1
<roqoqo::operations::InvolvedQubits as core::fmt::Debug>::fmt0
<roqoqo::operations::SingleQubitGateOperation as roqoqo::operations::OperateSingleQubitGate>::mul::<roqoqo::operations::SingleQubitGateOperation>1
<roqoqo::operations::SingleQubitGateOperation as roqoqo::operations::OperateSingleQubitGate>::mul::<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate>1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::mul::<roqoqo::operations::single_qubit_gate_operations::RotateX>1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/mod.rs.gcov.html b/roqoqo/coveragehtml/src/operations/mod.rs.gcov.html new file mode 100644 index 00000000..6c0c1bbf --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/mod.rs.gcov.html @@ -0,0 +1,754 @@ + + + + + + + LCOV - coverage.lcov - src/operations/mod.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - mod.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:2626100.0 %
Date:2021-11-09 13:25:48Functions:6875.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : //! Operations are the atomic instructions in any quantum program that can be represented by roqoqo.
+      14             : //!
+      15             : //! Operations can be of various kinds: Definitions, GateOperations, PRAGMAs or measurement Operations.
+      16             : //! * Definition operations define the classical registers and variables in the Circuit.
+      17             : //! * GateOperations are single-, two- or multi-qubit gate operations that act on a set of qubits
+      18             : //! and can be executed on a quantum computing device.
+      19             : //! * PRAGMAs are operations that can be used when running a simulation of a quantum computing program.
+      20             : //! * Measurement Operations are operations that perform a measurement either on a quantum computing device (MeasuareQubit)
+      21             : //! or on a simulation of a quantum computing program (PRAGMA measurement operations).
+      22             : 
+      23             : use crate::RoqoqoError;
+      24             : #[cfg(feature = "dynamic")]
+      25             : use dyn_clone::DynClone;
+      26             : use ndarray::Array2;
+      27             : use num_complex::Complex64;
+      28             : use qoqo_calculator::{Calculator, CalculatorComplex, CalculatorFloat};
+      29             : use roqoqo_derive::*;
+      30             : use std::collections::{HashMap, HashSet};
+      31             : /// Collection of roqoqo definition operations.
+      32             : #[doc(hidden)]
+      33             : mod define_operations;
+      34             : pub use define_operations::*;
+      35             : /// Collection of roqoqo measurement operations.
+      36             : #[doc(hidden)]
+      37             : mod measurement_operations;
+      38             : pub use measurement_operations::*;
+      39             : /// Collection of roqoqo multi qubit gate operations.
+      40             : #[doc(hidden)]
+      41             : mod multi_qubit_gate_operations;
+      42             : pub use multi_qubit_gate_operations::*;
+      43             : /// Collection of roqoqo PRAGMA operation structs.\
+      44             : #[doc(hidden)]
+      45             : mod pragma_operations;
+      46             : pub use pragma_operations::*;
+      47             : /// Collection of roqoqo single qubit gate operations.
+      48             : #[doc(hidden)]
+      49             : mod single_qubit_gate_operations;
+      50             : pub use single_qubit_gate_operations::*;
+      51             : /// Collection of roqoqo two qubit gate operations.
+      52             : #[doc(hidden)]
+      53             : mod two_qubit_gate_operations;
+      54             : pub use two_qubit_gate_operations::*;
+      55             : 
+      56             : include!(concat!(env!("OUT_DIR"), "/_auto_generated_operations.rs"));
+      57             : 
+      58             : /// Represents qubits involved in a roqoqo Operation.
+      59         101 : #[derive(Debug, PartialEq, Clone, Eq)]
+      60             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      61             : pub enum InvolvedQubits {
+      62             :     /// Operation affects all qubits no matter how many there are.
+      63             :     All,
+      64             :     /// Operation affects no qubits (annotations etc.).
+      65             :     None,
+      66             :     /// Operation affects a specific set of qubits.
+      67             :     Set(HashSet<usize>),
+      68             : }
+      69             : #[cfg(feature = "dynamic")]
+      70             : /// Universal basic trait for all operations of roqoqo.
+      71             : #[cfg_attr(feature = "dynamic", typetag::serde(tag = "Operate"))]
+      72             : pub trait Operate: InvolveQubits + SubstituteDyn + DynClone + std::fmt::Debug + Send {
+      73             :     /// Returns tags classifying the type of operation.
+      74             :     ///
+      75             :     /// Used for type based dispatch in ffi interfaces.
+      76             :     fn tags(&self) -> &'static [&'static str];
+      77             :     /// Returns hqslang name of operation.
+      78             :     ///
+      79             :     /// As a general rule that should correspond to the roqoqo name of the operation.
+      80             :     fn hqslang(&self) -> &'static str;
+      81             :     /// Returns true when operation has symbolic parameters.
+      82             :     fn is_parametrized(&self) -> bool;
+      83             : }
+      84             : 
+      85             : #[cfg(not(feature = "dynamic"))]
+      86             : /// Universal basic trait for all operations of roqoqo.
+      87             : ///
+      88             : /// # Example
+      89             : /// ```
+      90             : /// use roqoqo::operations::{Operate, PauliX, RotateZ};
+      91             : /// use qoqo_calculator::CalculatorFloat;
+      92             : ///
+      93             : /// let paulix = PauliX::new(0);
+      94             : /// let gate_tags: &[&str; 4] = &[
+      95             : ///     "Operation",
+      96             : ///     "GateOperation",
+      97             : ///     "SingleQubitGateOperation",
+      98             : ///     "PauliX",
+      99             : /// ];
+     100             : ///
+     101             : /// // 1) The tags of the operation tell us what kind of operation it is, and what traits it implements
+     102             : /// assert_eq!(paulix.tags(), gate_tags);
+     103             : /// // 2) The name of the operation is given by hqslang
+     104             : /// assert_eq!(paulix.hqslang(), "PauliX");
+     105             : /// // 3) Whether a gate is parametrized is determined by whether any of its inputs are symbolic (CalculatorFloat with a string).
+     106             : /// // As the PauliX gate only takes an integer input (qubit), it can never be parametrized.
+     107             : /// assert!(!paulix.is_parametrized());
+     108             : /// // However, a RotateZ gate can be parametrized:
+     109             : /// let rotatez_param = RotateZ::new(0, CalculatorFloat::from("parametrized"));
+     110             : /// assert!(rotatez_param.is_parametrized());
+     111             : /// // But it can also not be parametrized:
+     112             : /// let rotatez_not_param = RotateZ::new(0, CalculatorFloat::from(2.0));
+     113             : /// assert!(!rotatez_not_param.is_parametrized());
+     114             : /// ```
+     115             : ///
+     116             : pub trait Operate: InvolveQubits + Substitute + Clone + std::fmt::Debug + Send {
+     117             :     /// Returns tags classifying the type of the operation.
+     118             :     ///
+     119             :     /// Used for type based dispatch in ffi interfaces.
+     120             :     fn tags(&self) -> &'static [&'static str];
+     121             :     /// Returns hqslang name of the operation.
+     122             :     ///
+     123             :     /// As a general rule that should correspond to the roqoqo name of the operation.
+     124             :     fn hqslang(&self) -> &'static str;
+     125             :     /// Returns `true` when operation has symbolic parameters.
+     126             :     fn is_parametrized(&self) -> bool;
+     127             : }
+     128             : 
+     129             : #[cfg(feature = "dynamic")]
+     130             : dyn_clone::clone_trait_object!(Operate);
+     131             : 
+     132             : /// Trait for the qubits involved in each Operation.
+     133             : ///
+     134             : /// # Example
+     135             : /// ```
+     136             : /// use roqoqo::operations::{CNOT, DefinitionFloat, InvolveQubits, InvolvedQubits, PragmaRepeatedMeasurement};
+     137             : /// use std::collections::{HashMap, HashSet};
+     138             : ///
+     139             : /// // The involved qubits of the operation tell us which qubits are affected by the Operation.
+     140             : /// // There are three possibilities:
+     141             : /// // 1) The involved qubits are a set of integers (usize): these are the qubits affected by the Operation
+     142             : /// let cnot = CNOT::new(0, 1);
+     143             : /// let mut qubits: HashSet<usize> = HashSet::new();
+     144             : /// qubits.insert(0);
+     145             : /// qubits.insert(1);
+     146             : /// assert_eq!(cnot.involved_qubits(), InvolvedQubits::Set(qubits));
+     147             : /// // 2) The involved qubits are None: there are no qubits affected by this Operation
+     148             : /// let def_float = DefinitionFloat::new("ro".to_string(), 1, true);
+     149             : /// assert_eq!(def_float.involved_qubits(), InvolvedQubits::None);
+     150             : /// // 3) The involved qubits are All: all of the qubits in the Circuit are affected by the Operation
+     151             : /// let mut qubit_mapping: HashMap<usize, usize> = HashMap::new();
+     152             : /// qubit_mapping.insert(0, 1);
+     153             : /// let pragma = PragmaRepeatedMeasurement::new("ro".to_string(), 2, Some(qubit_mapping.clone()));
+     154             : /// assert_eq!(pragma.involved_qubits(), InvolvedQubits::All);
+     155             : /// ```
+     156             : pub trait InvolveQubits {
+     157             :     /// Returns a list of all involved qubits.
+     158             :     fn involved_qubits(&self) -> InvolvedQubits;
+     159             : }
+     160             : 
+     161             : /// Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
+     162             : ///
+     163             : /// # Example
+     164             : /// ```
+     165             : /// use roqoqo::operations::{RotateZ, Substitute};
+     166             : /// use qoqo_calculator::{Calculator, CalculatorFloat};
+     167             : /// use std::collections::HashMap;
+     168             : ///
+     169             : /// // 1) The substitute_parameters function substitutes all symbolic parameters in the Operation and its inputs
+     170             : /// let rotatez = RotateZ::new(0, CalculatorFloat::from("sub"));
+     171             : /// let mut substitution_dict: Calculator = Calculator::new();
+     172             : /// substitution_dict.set_variable("sub", 0.0);
+     173             : /// let result = rotatez
+     174             : ///     .substitute_parameters(&mut substitution_dict)
+     175             : ///     .unwrap();
+     176             : /// assert_eq!(result, RotateZ::new(0, CalculatorFloat::from(0.0)));
+     177             : /// // 2) The remap_qubits function remaps all qubits in the Operation and its inputs
+     178             : /// let rotatez = RotateZ::new(0, CalculatorFloat::from(0.0));
+     179             : /// let mut qubit_mapping_test: HashMap<usize, usize> = HashMap::new();
+     180             : /// qubit_mapping_test.insert(0, 2);
+     181             : /// let result = rotatez.remap_qubits(&qubit_mapping_test).unwrap();
+     182             : /// assert_eq!(result, RotateZ::new(2, CalculatorFloat::from(0.0)));
+     183             : /// ```
+     184             : ///
+     185             : pub trait Substitute
+     186             : where
+     187             :     Self: Sized,
+     188             : {
+     189             :     /// Substitutes symbolic parameters in clone of the operation.
+     190             :     fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError>;
+     191             :     /// Remaps the qubits in clone of the operation.
+     192             :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError>;
+     193             : }
+     194             : 
+     195             : #[cfg(feature = "dynamic")]
+     196             : /// Helper trait for implementing substitute for Box<dyn> operation.
+     197             : pub trait SubstituteDyn {
+     198             :     /// Substitute parameters in symbolic expression in clone of operation.
+     199             :     fn substitute_parameters_dyn(
+     200             :         &self,
+     201             :         calculator: &mut Calculator,
+     202             :     ) -> Result<Box<dyn Operate>, RoqoqoError>;
+     203             :     /// Remap qubits in operations in clone of operation.
+     204             :     fn remap_qubits_dyn(
+     205             :         &self,
+     206             :         mapping: &HashMap<usize, usize>,
+     207             :     ) -> Result<Box<dyn Operate>, RoqoqoError>;
+     208             : }
+     209             : 
+     210             : #[cfg(feature = "dynamic")]
+     211             : impl<T> SubstituteDyn for T
+     212             : where
+     213             :     T: 'static + Operate + Substitute,
+     214             : {
+     215             :     /// Substitute symbolic parameters in boxed clone of operation.
+     216             :     fn substitute_parameters_dyn(
+     217             :         &self,
+     218             :         calculator: &mut Calculator,
+     219             :     ) -> Result<Box<dyn Operate>, RoqoqoError> {
+     220             :         Ok(Box::new(Substitute::substitute_parameters(
+     221             :             self, calculator,
+     222             :         )?))
+     223             :     }
+     224             :     /// Remap qubits in operations in boxed clone of operation.
+     225             :     fn remap_qubits_dyn(
+     226             :         &self,
+     227             :         mapping: &HashMap<usize, usize>,
+     228             :     ) -> Result<Box<dyn Operate>, RoqoqoError> {
+     229             :         Ok(Box::new(Substitute::remap_qubits(self, mapping)?))
+     230             :     }
+     231             : }
+     232             : 
+     233             : /// Trait for operations acting on exactly one qubit.
+     234             : ///
+     235             : /// # Example
+     236             : /// ```
+     237             : /// use roqoqo::operations::{OperateSingleQubit, PauliX};
+     238             : /// let paulix = PauliX::new(0);
+     239             : /// assert_eq!(paulix.qubit(), &0_usize);
+     240             : /// ```
+     241             : ///
+     242             : pub trait OperateSingleQubit: Operate + InvolveQubits + Substitute + Clone + PartialEq {
+     243             :     /// Returns `qubit` the Operation acts on.
+     244             :     fn qubit(&self) -> &usize;
+     245             : }
+     246             : 
+     247             : /// Trait for Operations acting on exactly two qubits.
+     248             : ///
+     249             : /// # Example
+     250             : /// ```
+     251             : /// use roqoqo::operations::{CNOT, OperateTwoQubit};
+     252             : /// let cnot = CNOT::new(0, 1);
+     253             : /// assert_eq!(cnot.control(), &0_usize);
+     254             : /// assert_eq!(cnot.target(), &1_usize);
+     255             : /// ```
+     256             : ///
+     257             : pub trait OperateTwoQubit: Operate + InvolveQubits + Substitute + Clone + PartialEq {
+     258             :     /// Returns `target` qubit of two qubit Operation.
+     259             :     fn target(&self) -> &usize;
+     260             :     /// Returns `control` qubit of two qubit Operation.
+     261             :     fn control(&self) -> &usize;
+     262             : }
+     263             : 
+     264             : /// Trait for operations acting on multiple (more than two) qubits.
+     265             : ///
+     266             : /// # Example
+     267             : /// ```
+     268             : /// use roqoqo::operations::{MultiQubitMS, OperateMultiQubit};
+     269             : /// use qoqo_calculator::CalculatorFloat;
+     270             : /// let multi_ms = MultiQubitMS::new(vec![0, 1, 3], CalculatorFloat::from(0.0));
+     271             : /// assert_eq!(multi_ms.qubits(), &vec![0, 1, 3]);
+     272             : /// ```
+     273             : ///
+     274             : pub trait OperateMultiQubit: Operate + InvolveQubits + Substitute + Clone + PartialEq {
+     275             :     /// Returns vector of qubits operation is acting on in descending order of significance
+     276             :     fn qubits(&self) -> &Vec<usize>;
+     277             : }
+     278             : 
+     279             : /// Trait for PRAGMA Operations that are not necessary available on all universal quantum hardware.
+     280             : ///
+     281             : /// PRAGMA Operations are unphysical in terms of quantum mechanics and are meant to be used for simulation purposes only, i.e. to run on simulation backends.
+     282             : ///
+     283             : pub trait OperatePragma: Operate + InvolveQubits + Substitute + Clone + PartialEq {}
+     284             : 
+     285             : /// Trait for PRAGMA Operations that are not necessary available on all universal quantum hardware, that indicate noise.
+     286             : ///
+     287             : /// # Example
+     288             : /// ```
+     289             : /// use ndarray::{array, Array2};
+     290             : /// use roqoqo::operations::{OperatePragmaNoise, OperatePragmaNoiseProba, PragmaDamping};
+     291             : /// use qoqo_calculator::CalculatorFloat;
+     292             : ///
+     293             : /// let pragma = PragmaDamping::new(0, CalculatorFloat::from(0.005), CalculatorFloat::from(0.02));
+     294             : ///
+     295             : /// // 1) The superoperator representation of the noise Pragma
+     296             : /// let superop_prob: f64 = *pragma.probability().float().unwrap();
+     297             : /// let superop_sqrt: f64 = (1.0 - superop_prob.clone()).sqrt();
+     298             : /// let superop: Array2<f64> = array![
+     299             : ///     [1.0, 0.0, 0.0, superop_prob.clone()],
+     300             : ///     [0.0, superop_sqrt, 0.0, 0.0],
+     301             : ///     [0.0, 0.0, superop_sqrt, 0.0],
+     302             : ///     [0.0, 0.0, 0.0, 1.0 - superop_prob.clone()],
+     303             : /// ];
+     304             : /// assert_eq!(superop, pragma.superoperator().unwrap());
+     305             : /// // 2) The power function applied to the noise Pragma
+     306             : /// let pragma_test = PragmaDamping::new(
+     307             : ///     0,
+     308             : ///     CalculatorFloat::from(0.005 * 1.5),
+     309             : ///     CalculatorFloat::from(0.02),
+     310             : /// );
+     311             : /// assert_eq!(pragma_test, pragma.powercf(CalculatorFloat::from(1.5)));
+     312             : /// ```
+     313             : ///
+     314             : pub trait OperatePragmaNoise:
+     315             :     Operate + InvolveQubits + Substitute + Clone + PartialEq + OperatePragma
+     316             : {
+     317             :     /// Returns superoperator matrix of the Operation.
+     318             :     fn superoperator(&self) -> Result<Array2<f64>, RoqoqoError>;
+     319             :     /// Returns the gate to the power of `power`.
+     320             :     fn powercf(&self, power: CalculatorFloat) -> Self;
+     321             : }
+     322             : 
+     323             : /// Trait for PRAGMA Operations that are not necessary available on all universal quantum hardware, that indicate noise.
+     324             : ///
+     325             : /// # Example
+     326             : /// ```
+     327             : /// use ndarray::{array, Array2};
+     328             : /// use roqoqo::operations::{OperatePragmaNoiseProba, PragmaDamping};
+     329             : /// use qoqo_calculator::CalculatorFloat;
+     330             : ///
+     331             : /// let pragma = PragmaDamping::new(0, CalculatorFloat::from(0.005), CalculatorFloat::from(0.02));
+     332             : ///
+     333             : /// // The probability of the noise Pragma
+     334             : /// let proba_pre_exp: f64 = -2.0 * 0.005 * 0.02;
+     335             : /// let proba = CalculatorFloat::from(0.5 * (1.0 - proba_pre_exp.exp()));
+     336             : /// assert_eq!(proba, pragma.probability());
+     337             : /// ```
+     338             : ///
+     339             : pub trait OperatePragmaNoiseProba:
+     340             :     Operate + InvolveQubits + Substitute + Clone + PartialEq + OperatePragma + OperatePragmaNoise
+     341             : {
+     342             :     /// Returns the probability of the gate, based on its gate_time and rate.
+     343             :     fn probability(&self) -> CalculatorFloat;
+     344             : }
+     345             : 
+     346             : /// Trait for Operations acting with a unitary gate on a set of qubits.
+     347             : ///
+     348             : /// # Example
+     349             : /// ```
+     350             : /// use ndarray::array;
+     351             : /// use num_complex::Complex64;
+     352             : /// use roqoqo::operations::{OperateGate, PauliX};
+     353             : ///
+     354             : /// let paulix = PauliX::new(0);
+     355             : /// let matrix = array![
+     356             : ///     [Complex64::new(0.0, 0.0), Complex64::new(1.0, 0.0)],
+     357             : ///     [Complex64::new(1.0, 0.0), Complex64::new(0.0, 0.0)]
+     358             : /// ];
+     359             : /// assert_eq!(paulix.unitary_matrix().unwrap(), matrix);
+     360             : /// ```
+     361             : ///
+     362             : pub trait OperateGate: Operate + InvolveQubits + Substitute + Clone + PartialEq {
+     363             :     /// Returns unitary matrix of the gate.
+     364             :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError>;
+     365             : }
+     366             : 
+     367             : /// Trait for unitary operations corresponding to rotations that can be characteriszed by a single rotation parameter theta.
+     368             : ///
+     369             : /// # Example
+     370             : /// ```
+     371             : /// use qoqo_calculator::CalculatorFloat;
+     372             : /// use roqoqo::operations::{Rotate, RotateX};
+     373             : /// let rotatex = RotateX::new(0, 2.0.into());
+     374             : ///
+     375             : /// // 1) The angle of rotation of the Rotate Operation
+     376             : /// assert_eq!(rotatex.theta(), &CalculatorFloat::from(2.0));
+     377             : /// // 2) The power function applied to the Rotate Operation
+     378             : /// assert_eq!(rotatex.powercf(CalculatorFloat::from(1.5)), RotateX::new(0, 3.0.into()));
+     379             : /// ```
+     380             : ///
+     381             : pub trait Rotate: OperateGate + Operate + InvolveQubits + Substitute + Clone + PartialEq {
+     382             :     /// Returns rotation parameter theta.
+     383             :     fn theta(&self) -> &CalculatorFloat;
+     384             :     /// Returns the gate to the power of `power`.`
+     385             :     fn powercf(&self, power: CalculatorFloat) -> Self;
+     386             : 
+     387             :     #[cfg(feature = "overrotate")]
+     388             :     /// Returns clone of the gate with one parameter statistically overrotated.
+     389             :     ///
+     390             :     /// A random number drawn from a normal distribution N(0, variance^2)
+     391             :     /// and multiplied by the amplitue  is added to the overrotated parameter.  
+     392             :     /// gate_overrotated.parameter() = gate.parameter + amplitude * rand(N(0, variance^2))
+     393             :     ///
+     394             :     /// This functionc is specifically designed for statistical overrotations that change the angle
+     395             :     /// of an applied rotation gate randomly during the execution of a quantum program.  
+     396             :     /// For static overrotations that represent a drift in the callibration of gates and are constant
+     397             :     /// during the execution of a quantum programm use symbolic parameters and the substitute_parameters
+     398             :     /// function.
+     399             :     ///
+     400             :     /// # Arguments
+     401             :     ///
+     402             :     /// *`amplitude` - The amplitude the random number is multiplied with.
+     403             :     /// *`variance` - The standard deviation of the normal distribution the random number is drawn from.
+     404             :     ///
+     405             :     /// # Example
+     406             :     /// ```
+     407             :     /// use roqoqo::prelude::*;
+     408             :     /// use roqoqo::operations::RotateZ;
+     409             :     ///
+     410             :     /// let gate = RotateZ::new(0, 1.0.into());
+     411             :     /// let overrotated_gate = gate.overrotate(&1.0, &0.5);
+     412             :     /// println!("{:?}", gate);
+     413             :     /// println!("{:?}", overrotated_gate);
+     414             :     /// let gate_symbolic = RotateZ::new(0, "theta_var".into());
+     415             :     /// let overrotated_symbolic = gate_symbolic.overrotate(&1.0, &0.5);
+     416             :     /// println!("{:?}", gate_symbolic);
+     417             :     /// println!("{:?}", overrotated_symbolic);
+     418             :     /// ```
+     419             :     fn overrotate(&self, amplitude: &f64, variance: &f64) -> Self;
+     420             : }
+     421             : 
+     422             : /// Trait for definition operations.
+     423             : ///
+     424             : /// # Example
+     425             : /// ```
+     426             : /// use roqoqo::operations::{Define, DefinitionFloat};
+     427             : /// let definition = DefinitionFloat::new("ro".to_string(), 1, false);
+     428             : /// assert_eq!(definition.name(), &"ro".to_string());
+     429             : /// ```
+     430             : ///
+     431             : pub trait Define: Operate + InvolveQubits + Substitute + Clone + PartialEq {
+     432             :     /// Returns name of definition operation.
+     433             :     fn name(&self) -> &String;
+     434             : }
+     435             : 
+     436             : /// Trait for unitary operations without any free parameters.
+     437             : ///
+     438             : /// # Example
+     439             : /// ```
+     440             : /// use roqoqo::operations::{OperateConstantGate, PauliX};
+     441             : /// let paulix = PauliX::new(0);
+     442             : /// ```
+     443             : ///
+     444             : pub trait OperateConstantGate:
+     445             :     OperateGate + Operate + InvolveQubits + Substitute + Clone + PartialEq
+     446             : {
+     447             :     /// Returns true when unitary operation U is self inverse U*U = I.
+     448             :     fn inverse(&self) -> GateOperation;
+     449             : }
+     450             : 
+     451             : /// Trait for unitary operations acting on exactly one qubit.
+     452             : ///
+     453             : /// Implements the general single qubit unitary gates  that can be brought into the form:
+     454             : ///
+     455             : /// $$ U =e^{i \phi}\begin{pmatrix}
+     456             : /// \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\\\
+     457             : /// \beta_r+i \beta_i & \alpha_r-i\alpha_i
+     458             : /// \end{pmatrix} $$
+     459             : ///
+     460             : /// These gates can be parametrized by five real parameters:
+     461             : ///
+     462             : /// * `alpha_r` - The real part $ \alpha_r $ of the on-diagonal elements of the single-qubit unitary.
+     463             : /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary.
+     464             : /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary.
+     465             : /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary.
+     466             : /// * `global_phase` - The global phase $ \phi $ of the single-qubit unitary.
+     467             : ///
+     468             : /// These are the single qubit gates that are performed in the Circuit(), and are then translated
+     469             : /// to quantum hardware through the relevant backend. Two-qubit gates are also available
+     470             : /// (see roqoqo/src/operations/two_qubit_gate_operations.rs).
+     471             : ///
+     472             : /// # Example
+     473             : /// ```
+     474             : /// use qoqo_calculator::CalculatorFloat;
+     475             : /// use roqoqo::operations::{OperateSingleQubitGate, PauliX};
+     476             : /// use std::f64::consts::PI;
+     477             : ///
+     478             : /// let paulix = PauliX::new(0);
+     479             : ///
+     480             : /// assert_eq!(paulix.alpha_r(), 0.0.into());
+     481             : /// assert_eq!(paulix.alpha_i(), 0.0.into());
+     482             : /// assert_eq!(paulix.beta_r(), 0.0.into());
+     483             : /// assert_eq!(paulix.beta_i(), CalculatorFloat::from(-1.0));
+     484             : /// assert_eq!(paulix.global_phase(), ((PI) / 2.0).into());
+     485             : /// ```
+     486             : ///
+     487             : pub trait OperateSingleQubitGate:
+     488             :     Operate
+     489             :     + OperateGate
+     490             :     + InvolveQubits
+     491             :     + Substitute
+     492             :     + OperateSingleQubit
+     493             :     + Clone
+     494             :     + PartialEq
+     495             :     + OperateSingleQubit
+     496             :     + std::fmt::Debug
+     497             : {
+     498             :     /// Returns alpha_r parameter of operation.
+     499             :     ///
+     500             :     /// # Returns
+     501             :     ///
+     502             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     503             :     fn alpha_r(&self) -> CalculatorFloat;
+     504             : 
+     505             :     /// Returns alpha_i parameter of operation.
+     506             :     ///
+     507             :     /// # Returns
+     508             :     ///
+     509             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     510             :     fn alpha_i(&self) -> CalculatorFloat;
+     511             : 
+     512             :     /// Returns beta_r parameter of operation.
+     513             :     ///
+     514             :     /// # Returns
+     515             :     ///
+     516             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     517             :     fn beta_r(&self) -> CalculatorFloat;
+     518             : 
+     519             :     /// Returns beta_i parameter of operation.
+     520             :     ///
+     521             :     /// # Returns
+     522             :     ///
+     523             :     /// * `beta_i` -  imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     524             :     fn beta_i(&self) -> CalculatorFloat;
+     525             : 
+     526             :     /// Returns global_phase parameter of operation.
+     527             :     ///
+     528             :     /// # Returns
+     529             :     ///
+     530             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     531             :     fn global_phase(&self) -> CalculatorFloat;
+     532             : 
+     533             :     /// Multiplies two compatible operations implementing OperateSingleQubitGate.
+     534             :     ///
+     535             :     /// Does not consume the two operations being multiplied.
+     536             :     /// Only Operations
+     537             :     ///
+     538             :     /// # Arguments:
+     539             :     ///
+     540             :     /// * `other` - An Operation implementing [OperateSingleQubitGate].
+     541             :     ///
+     542             :     /// # Example
+     543             :     /// ```
+     544             :     /// use roqoqo::operations::{RotateZ, RotateX};
+     545             :     /// use roqoqo::prelude::*;
+     546             :     /// use qoqo_calculator::CalculatorFloat;
+     547             :     ///
+     548             :     /// let gate1 =  RotateZ::new(0, CalculatorFloat::from(1));
+     549             :     /// let gate2 =  RotateX::new(0, CalculatorFloat::from(1));
+     550             :     /// let multiplied = gate1.mul(&gate2).unwrap();
+     551             :     /// ```
+     552          47 :     fn mul<T>(&self, other: &T) -> Result<SingleQubitGate, RoqoqoError>
+     553          47 :     where
+     554          47 :         T: OperateSingleQubitGate,
+     555          47 :     {
+     556          47 :         if self.qubit() != other.qubit() {
+     557           2 :             return Err(RoqoqoError::MultiplicationIncompatibleQubits {
+     558           2 :                 squbit: *self.qubit(),
+     559           2 :                 oqubit: *other.qubit(),
+     560           2 :             });
+     561          45 :         }
+     562          45 :         let alpha = CalculatorComplex::new(self.alpha_r(), self.alpha_i());
+     563          45 :         let beta = CalculatorComplex::new(self.beta_r(), self.beta_i());
+     564          45 :         let oalpha = CalculatorComplex::new(other.alpha_r(), other.alpha_i());
+     565          45 :         let obeta = CalculatorComplex::new(other.beta_r(), other.beta_i());
+     566          45 :         let new_alpha = alpha.clone() * &oalpha - beta.conj() * &obeta;
+     567          45 :         let new_beta = beta * oalpha + obeta * alpha.conj();
+     568          45 :         Ok(SingleQubitGate::new(
+     569          45 :             *other.qubit(),
+     570          45 :             new_alpha.re,
+     571          45 :             new_alpha.im,
+     572          45 :             new_beta.re,
+     573          45 :             new_beta.im,
+     574          45 :             self.global_phase() + other.global_phase(),
+     575          45 :         ))
+     576          47 :     }
+     577             : }
+     578             : 
+     579             : /// Trait for all Operations operating on or affecting exactly two qubits.
+     580             : ///
+     581             : /// # Example
+     582             : /// ```
+     583             : /// use roqoqo::operations::{ISwap, KakDecomposition, OperateTwoQubitGate};
+     584             : /// use qoqo_calculator::CalculatorFloat;
+     585             : /// let iswap = ISwap::new(0, 1);
+     586             : ///
+     587             : /// assert_eq!(iswap.kak_decomposition().circuit_before, None);
+     588             : /// assert_eq!(iswap.kak_decomposition().circuit_after, None);
+     589             : /// assert_eq!(iswap.kak_decomposition().global_phase, CalculatorFloat::ZERO);
+     590             : /// assert_eq!(iswap.kak_decomposition().k_vector, [CalculatorFloat::FRAC_PI_4, CalculatorFloat::FRAC_PI_4, CalculatorFloat::ZERO]);
+     591             : /// ```
+     592             : ///
+     593             : pub trait OperateTwoQubitGate:
+     594             :     Operate + OperateGate + OperateTwoQubit + InvolveQubits + Substitute + Clone + PartialEq
+     595             : {
+     596             :     /// Returns [KakDecomposition] of two qubit gate.
+     597             :     fn kak_decomposition(&self) -> KakDecomposition;
+     598             : }
+     599             : 
+     600             : /// Trait for all Operations operating on or affecting more than two qubits.
+     601             : ///
+     602             : /// # Example
+     603             : /// ```
+     604             : /// use roqoqo::operations::{CNOT, Hadamard, MultiQubitMS, OperateMultiQubitGate, RotateZ};
+     605             : /// use roqoqo::Circuit;
+     606             : /// use qoqo_calculator::CalculatorFloat;
+     607             : ///
+     608             : /// let multi_ms = MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(1.0));
+     609             : /// let mut circuit = Circuit::new();
+     610             : /// circuit += Hadamard::new(0);
+     611             : /// circuit += Hadamard::new(1);
+     612             : /// circuit += Hadamard::new(2);
+     613             : /// circuit += CNOT::new(0, 1);
+     614             : /// circuit += CNOT::new(1, 2);
+     615             : /// circuit += RotateZ::new(2, CalculatorFloat::from(0.5));
+     616             : /// circuit += CNOT::new(1, 2);
+     617             : /// circuit += CNOT::new(0, 1);
+     618             : /// circuit += Hadamard::new(0);
+     619             : /// circuit += Hadamard::new(1);
+     620             : /// circuit += Hadamard::new(2);
+     621             : ///
+     622             : /// assert_eq!(multi_ms.circuit(), circuit);
+     623             : /// ```
+     624             : ///
+     625             : pub trait OperateMultiQubitGate:
+     626             :     Operate + OperateGate + OperateMultiQubit + InvolveQubits + Substitute + Clone + PartialEq
+     627             : {
+     628             :     /// Returns a decomposition of the multi-qubit operation using a circuit with two-qubit-operations.
+     629             :     fn circuit(&self) -> crate::Circuit;
+     630             : }
+     631             : 
+     632             : // Implementing DynOperation for storing dynamic operations from extern crates in trait object
+     633             : 
+     634             : #[cfg(feature = "dynamic")]
+     635             : /// A wrapper for Operate trait objects.
+     636             : ///
+     637             : /// This wrapper struct can be used to insert Operate trait objects in a circuit.
+     638             : /// The intended use case is to store structs from an external crate that implement Operate,
+     639             : /// in a circuit.
+     640             : #[derive(Debug, Clone)]
+     641             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     642             : pub struct DynOperation(Box<dyn Operate>);
+     643             : 
+     644             : #[cfg(feature = "dynamic")]
+     645             : #[cfg_attr(feature = "dynamic", typetag::serde)]
+     646             : impl Operate for DynOperation {
+     647             :     fn tags(&self) -> &'static [&'static str] {
+     648             :         self.0.tags()
+     649             :     }
+     650             :     fn hqslang(&self) -> &'static str {
+     651             :         self.0.hqslang()
+     652             :     }
+     653             :     fn is_parametrized(&self) -> bool {
+     654             :         self.0.is_parametrized()
+     655             :     }
+     656             : }
+     657             : #[cfg(feature = "dynamic")]
+     658             : impl InvolveQubits for DynOperation {
+     659             :     fn involved_qubits(&self) -> InvolvedQubits {
+     660             :         self.0.involved_qubits()
+     661             :     }
+     662             : }
+     663             : #[cfg(feature = "dynamic")]
+     664             : /// Implements [Substitute] trait allowing to replace symbolic parameters and to perform qubit mappings.
+     665             : impl Substitute for DynOperation {
+     666             :     fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+     667             :         Ok(DynOperation(self.0.substitute_parameters_dyn(calculator)?))
+     668             :     }
+     669             :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+     670             :         Ok(DynOperation(self.0.remap_qubits_dyn(mapping)?))
+     671             :     }
+     672             : }
+     673             : #[cfg(feature = "dynamic")]
+     674             : impl PartialEq for DynOperation {
+     675             :     fn eq(&self, other: &Self) -> bool {
+     676             :         self.0.hqslang() == other.0.hqslang()
+     677             :     }
+     678             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.func-sort-c.html b/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.func-sort-c.html new file mode 100644 index 00000000..d677c173 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.func-sort-c.html @@ -0,0 +1,144 @@ + + + + + + + LCOV - coverage.lcov - src/operations/multi_qubit_gate_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - multi_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:3737100.0 %
Date:2021-11-09 13:25:48Functions:1818100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as core::cmp::PartialEq>::eq1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as core::cmp::PartialEq>::ne1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as core::fmt::Debug>::fmt1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Operate>::tags1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::OperateMultiQubitGate>::circuit1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as core::clone::Clone>::clone2
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.func.html b/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.func.html new file mode 100644 index 00000000..8f723121 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.func.html @@ -0,0 +1,144 @@ + + + + + + + LCOV - coverage.lcov - src/operations/multi_qubit_gate_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - multi_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:3737100.0 %
Date:2021-11-09 13:25:48Functions:1818100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as core::clone::Clone>::clone2
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as core::cmp::PartialEq>::eq1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as core::cmp::PartialEq>::ne1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as core::fmt::Debug>::fmt1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Operate>::tags1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::OperateMultiQubitGate>::circuit1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::multi_qubit_gate_operations::MultiQubitMS>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.gcov.html b/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.gcov.html new file mode 100644 index 00000000..abcab6e8 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/multi_qubit_gate_operations.rs.gcov.html @@ -0,0 +1,164 @@ + + + + + + + LCOV - coverage.lcov - src/operations/multi_qubit_gate_operations.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - multi_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:3737100.0 %
Date:2021-11-09 13:25:48Functions:1818100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use crate::operations;
+      14             : use crate::prelude::*;
+      15             : use crate::Circuit;
+      16             : use crate::RoqoqoError;
+      17             : use ndarray::Array2;
+      18             : use num_complex::Complex64;
+      19             : use qoqo_calculator::CalculatorFloat;
+      20             : #[cfg(feature = "overrotate")]
+      21             : use rand_distr::{Distribution, Normal};
+      22             : #[cfg(feature = "serialize")]
+      23             : use serde::{Deserialize, Serialize};
+      24             : 
+      25             : /// The Molmer-Sorensen gate between multiple qubits.
+      26             : ///
+      27             : #[allow(clippy::upper_case_acronyms)]
+      28             : #[derive(
+      29           1 :     Debug,
+      30           7 :     Clone,
+      31           9 :     PartialEq,
+      32           1 :     roqoqo_derive::InvolveQubits,
+      33          35 :     roqoqo_derive::Operate,
+      34           6 :     roqoqo_derive::Substitute,
+      35           2 :     roqoqo_derive::OperateMultiQubit,
+      36          24 :     roqoqo_derive::Rotate,
+      37             : )]
+      38             : #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
+      39             : pub struct MultiQubitMS {
+      40             :     /// The qubits involved in the multi qubit Molmer-Sorensen gate.
+      41             :     qubits: Vec<usize>,
+      42             :     /// The angle of the multi qubit Molmer-Sorensen gate.
+      43             :     theta: CalculatorFloat,
+      44             : }
+      45             : 
+      46             : #[allow(non_upper_case_globals)]
+      47             : const TAGS_MultiQubitMS: &[&str; 4] = &[
+      48             :     "Operation",
+      49             :     "GateOperation",
+      50             :     "MultiQubitGateOperation",
+      51             :     "MultiQubitMS",
+      52             : ];
+      53             : 
+      54             : impl OperateGate for MultiQubitMS {
+      55           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+      56           2 :         let dim = 2_usize.pow(self.qubits.len() as u32);
+      57           2 :         let mut array: Array2<Complex64> = Array2::zeros((dim, dim));
+      58           2 :         let cos: Complex64 = Complex64::new((self.theta.float()? / 2.0).cos(), 0.0);
+      59           2 :         let sin: Complex64 = Complex64::new(0.0, -(self.theta.float()? / 2.0).sin());
+      60          12 :         for i in 0..dim {
+      61          12 :             array[(i, i)] = cos;
+      62          12 :             array[(i, dim - i - 1)] = sin;
+      63          12 :         }
+      64           2 :         Ok(array)
+      65           2 :     }
+      66             : }
+      67             : 
+      68             : impl OperateMultiQubitGate for MultiQubitMS {
+      69             :     // Todo fill out circuit
+      70           2 :     fn circuit(&self) -> Circuit {
+      71           2 :         let dim = self.qubits.len();
+      72           2 :         let mut circuit = Circuit::new();
+      73           5 :         for q in self.qubits.iter() {
+      74           5 :             circuit += operations::Hadamard::new(*q);
+      75           5 :         }
+      76           3 :         for q in self.qubits[1..].iter() {
+      77           3 :             circuit += operations::CNOT::new(*q - 1, *q);
+      78           3 :         }
+      79           2 :         circuit += operations::RotateZ::new(dim - 1, self.theta.clone() / 2);
+      80           3 :         for q in self.qubits[1..].iter() {
+      81           3 :             circuit += operations::CNOT::new(dim - *q - 1, dim - *q);
+      82           3 :         }
+      83           5 :         for q in self.qubits.iter() {
+      84           5 :             circuit += operations::Hadamard::new(*q);
+      85           5 :         }
+      86           2 :         circuit
+      87           2 :     }
+      88             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/pragma_operations.rs.func-sort-c.html b/roqoqo/coveragehtml/src/operations/pragma_operations.rs.func-sort-c.html new file mode 100644 index 00000000..a0a3ce13 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/pragma_operations.rs.func-sort-c.html @@ -0,0 +1,1212 @@ + + + + + + + LCOV - coverage.lcov - src/operations/pragma_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - pragma_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:28331290.7 %
Date:2021-11-09 13:25:48Functions:27028594.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::pragma_operations::PragmaChangeDevice as core::clone::Clone>::clone0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as core::cmp::PartialEq>::eq0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as core::cmp::PartialEq>::ne0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as core::fmt::Debug>::fmt0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::InvolveQubits>::involved_qubits0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Operate>::hqslang0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Operate>::is_parametrized0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Operate>::tags0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Substitute>::remap_qubits0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Substitute>::remap_qubits::{closure#0}0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Substitute>::substitute_parameters0
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::OperatePragmaNoise>::powercf0
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#0}0
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#1}0
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#2}0
<roqoqo::operations::pragma_operations::PragmaActiveReset as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaActiveReset as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaActiveReset as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaActiveReset as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaBoostNoise>::noise_coefficient1
<roqoqo::operations::pragma_operations::PragmaConditional as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaConditional as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaConditional as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaConditional as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaConditional>::circuit1
<roqoqo::operations::pragma_operations::PragmaConditional>::condition_index1
<roqoqo::operations::pragma_operations::PragmaConditional>::condition_register1
<roqoqo::operations::pragma_operations::PragmaDamping as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaDamping as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaDamping as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::OperatePragmaNoise>::powercf1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::OperatePragmaNoiseProba>::probability1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaDamping>::gate_time1
<roqoqo::operations::pragma_operations::PragmaDamping>::rate1
<roqoqo::operations::pragma_operations::PragmaDephasing as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaDephasing as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaDephasing as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::OperatePragmaNoise>::powercf1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::OperatePragmaNoiseProba>::probability1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaDephasing>::gate_time1
<roqoqo::operations::pragma_operations::PragmaDephasing>::rate1
<roqoqo::operations::pragma_operations::PragmaDepolarising as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaDepolarising as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaDepolarising as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::OperatePragmaNoise>::powercf1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::OperatePragmaNoiseProba>::probability1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaDepolarising>::gate_time1
<roqoqo::operations::pragma_operations::PragmaDepolarising>::rate1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::OperatePragmaNoise>::superoperator::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise>::gate_time1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise>::rates1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase>::phase1
<roqoqo::operations::pragma_operations::PragmaOverrotation as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaOverrotation as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaOverrotation as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaOverrotation as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaOverrotation>::amplitude1
<roqoqo::operations::pragma_operations::PragmaOverrotation>::gate_hqslang1
<roqoqo::operations::pragma_operations::PragmaOverrotation>::variance1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::OperatePragmaNoise>::powercf1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::OperatePragmaNoiseProba>::probability1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaRandomNoise>::dephasing_rate1
<roqoqo::operations::pragma_operations::PragmaRandomNoise>::depolarising_rate1
<roqoqo::operations::pragma_operations::PragmaRandomNoise>::gate_time1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaRepeatGate>::repetition_coefficient1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix>::density_matrix1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements>::number_measurements1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements>::readout1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaSetStateVector>::statevector1
<roqoqo::operations::pragma_operations::PragmaSleep as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaSleep as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaSleep as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaSleep as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaSleep>::sleep_time1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock>::reordering_dictionary1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock>::execution_time1
<roqoqo::operations::pragma_operations::PragmaActiveReset>::new2
<roqoqo::operations::pragma_operations::PragmaBoostNoise>::new2
<roqoqo::operations::pragma_operations::PragmaConditional>::new2
<roqoqo::operations::pragma_operations::PragmaDamping as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaDamping>::new2
<roqoqo::operations::pragma_operations::PragmaDephasing as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaDephasing>::new2
<roqoqo::operations::pragma_operations::PragmaDepolarising as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaDepolarising>::new2
<roqoqo::operations::pragma_operations::PragmaGeneralNoise>::new2
<roqoqo::operations::pragma_operations::PragmaGlobalPhase>::new2
<roqoqo::operations::pragma_operations::PragmaOverrotation>::new2
<roqoqo::operations::pragma_operations::PragmaRandomNoise as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaRandomNoise>::new2
<roqoqo::operations::pragma_operations::PragmaRepeatGate>::new2
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix>::new2
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements>::new2
<roqoqo::operations::pragma_operations::PragmaSetStateVector>::new2
<roqoqo::operations::pragma_operations::PragmaSleep>::new2
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock>::new2
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock>::new2
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/pragma_operations.rs.func.html b/roqoqo/coveragehtml/src/operations/pragma_operations.rs.func.html new file mode 100644 index 00000000..c3a234d9 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/pragma_operations.rs.func.html @@ -0,0 +1,1212 @@ + + + + + + + LCOV - coverage.lcov - src/operations/pragma_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - pragma_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:28331290.7 %
Date:2021-11-09 13:25:48Functions:27028594.7 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::pragma_operations::PragmaActiveReset as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaActiveReset as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaActiveReset as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaActiveReset as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaActiveReset as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaActiveReset>::new2
<roqoqo::operations::pragma_operations::PragmaBoostNoise as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaBoostNoise as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaBoostNoise>::new2
<roqoqo::operations::pragma_operations::PragmaBoostNoise>::noise_coefficient1
<roqoqo::operations::pragma_operations::PragmaChangeDevice as core::clone::Clone>::clone0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as core::cmp::PartialEq>::eq0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as core::cmp::PartialEq>::ne0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as core::fmt::Debug>::fmt0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::InvolveQubits>::involved_qubits0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Operate>::hqslang0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Operate>::is_parametrized0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Operate>::tags0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Substitute>::remap_qubits0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Substitute>::remap_qubits::{closure#0}0
<roqoqo::operations::pragma_operations::PragmaChangeDevice as roqoqo::operations::Substitute>::substitute_parameters0
<roqoqo::operations::pragma_operations::PragmaConditional as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaConditional as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaConditional as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaConditional as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaConditional as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaConditional>::circuit1
<roqoqo::operations::pragma_operations::PragmaConditional>::condition_index1
<roqoqo::operations::pragma_operations::PragmaConditional>::condition_register1
<roqoqo::operations::pragma_operations::PragmaConditional>::new2
<roqoqo::operations::pragma_operations::PragmaDamping as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaDamping as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaDamping as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaDamping as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::OperatePragmaNoise>::powercf1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::OperatePragmaNoiseProba>::probability1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaDamping as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaDamping>::gate_time1
<roqoqo::operations::pragma_operations::PragmaDamping>::new2
<roqoqo::operations::pragma_operations::PragmaDamping>::rate1
<roqoqo::operations::pragma_operations::PragmaDephasing as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaDephasing as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaDephasing as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaDephasing as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::OperatePragmaNoise>::powercf1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::OperatePragmaNoiseProba>::probability1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaDephasing as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaDephasing>::gate_time1
<roqoqo::operations::pragma_operations::PragmaDephasing>::new2
<roqoqo::operations::pragma_operations::PragmaDephasing>::rate1
<roqoqo::operations::pragma_operations::PragmaDepolarising as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaDepolarising as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaDepolarising as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaDepolarising as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::OperatePragmaNoise>::powercf1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::OperatePragmaNoiseProba>::probability1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaDepolarising as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaDepolarising>::gate_time1
<roqoqo::operations::pragma_operations::PragmaDepolarising>::new2
<roqoqo::operations::pragma_operations::PragmaDepolarising>::rate1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::OperatePragmaNoise>::powercf0
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::OperatePragmaNoise>::superoperator::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise>::gate_time1
<roqoqo::operations::pragma_operations::PragmaGeneralNoise>::new2
<roqoqo::operations::pragma_operations::PragmaGeneralNoise>::rates1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaGlobalPhase>::new2
<roqoqo::operations::pragma_operations::PragmaGlobalPhase>::phase1
<roqoqo::operations::pragma_operations::PragmaOverrotation as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaOverrotation as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaOverrotation as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaOverrotation as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaOverrotation as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaOverrotation>::amplitude1
<roqoqo::operations::pragma_operations::PragmaOverrotation>::gate_hqslang1
<roqoqo::operations::pragma_operations::PragmaOverrotation>::new2
<roqoqo::operations::pragma_operations::PragmaOverrotation>::variance1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaRandomNoise as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::OperatePragmaNoise>::powercf1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::OperatePragmaNoise>::superoperator1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::OperatePragmaNoiseProba>::probability1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaRandomNoise as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaRandomNoise>::dephasing_rate1
<roqoqo::operations::pragma_operations::PragmaRandomNoise>::depolarising_rate1
<roqoqo::operations::pragma_operations::PragmaRandomNoise>::gate_time1
<roqoqo::operations::pragma_operations::PragmaRandomNoise>::new2
<roqoqo::operations::pragma_operations::PragmaRepeatGate as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaRepeatGate as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaRepeatGate>::new2
<roqoqo::operations::pragma_operations::PragmaRepeatGate>::repetition_coefficient1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix>::density_matrix1
<roqoqo::operations::pragma_operations::PragmaSetDensityMatrix>::new2
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements>::new2
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements>::number_measurements1
<roqoqo::operations::pragma_operations::PragmaSetNumberOfMeasurements>::readout1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaSetStateVector as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaSetStateVector>::new2
<roqoqo::operations::pragma_operations::PragmaSetStateVector>::statevector1
<roqoqo::operations::pragma_operations::PragmaSleep as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaSleep as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaSleep as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaSleep as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaSleep as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaSleep>::new2
<roqoqo::operations::pragma_operations::PragmaSleep>::sleep_time1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as core::clone::Clone>::clone2
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#0}0
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#1}0
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#2}0
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock>::new2
<roqoqo::operations::pragma_operations::PragmaStartDecompositionBlock>::reordering_dictionary1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaStopDecompositionBlock>::new2
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as core::clone::Clone>::clone1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as core::cmp::PartialEq>::eq1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as core::cmp::PartialEq>::ne1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as core::fmt::Debug>::fmt1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Operate>::tags1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::OperateMultiQubit>::qubits1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock>::execution_time1
<roqoqo::operations::pragma_operations::PragmaStopParallelBlock>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/pragma_operations.rs.gcov.html b/roqoqo/coveragehtml/src/operations/pragma_operations.rs.gcov.html new file mode 100644 index 00000000..a3542c9b --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/pragma_operations.rs.gcov.html @@ -0,0 +1,1148 @@ + + + + + + + LCOV - coverage.lcov - src/operations/pragma_operations.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - pragma_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:28331290.7 %
Date:2021-11-09 13:25:48Functions:27028594.7 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : //
+      13             : //! Collection of roqoqo PRAGMA operations.
+      14             : //!
+      15             : 
+      16             : use crate::operations::{
+      17             :     InvolveQubits, InvolvedQubits, Operate, OperateMultiQubit, OperatePragma, OperatePragmaNoise,
+      18             :     OperatePragmaNoiseProba, OperateSingleQubit, RoqoqoError, Substitute,
+      19             : };
+      20             : use crate::Circuit;
+      21             : #[cfg(feature = "serialize")]
+      22             : use bincode::serialize;
+      23             : use nalgebra::Matrix4;
+      24             : use ndarray::{array, Array, Array1, Array2};
+      25             : use num_complex::Complex64;
+      26             : use qoqo_calculator::{Calculator, CalculatorFloat};
+      27             : #[cfg(feature = "serialize")]
+      28             : use serde::{Deserialize, Serialize};
+      29             : use std::collections::HashMap;
+      30             : use std::convert::TryFrom;
+      31             : 
+      32             : /// This PRAGMA Operation sets the number of measurements of the circuit.
+      33             : ///
+      34             : /// This is used for backends that allow setting the number of tries. However, setting the number of
+      35             : /// measurements does not allow access to the underlying wavefunction or density matrix.
+      36             : ///
+      37             : #[derive(
+      38           1 :     Debug,
+      39           1 :     Clone,
+      40           7 :     PartialEq,
+      41          14 :     roqoqo_derive::Operate,
+      42           2 :     roqoqo_derive::Substitute,
+      43             :     roqoqo_derive::OperatePragma,
+      44             : )]
+      45             : #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
+      46             : pub struct PragmaSetNumberOfMeasurements {
+      47             :     /// The number of measurements.
+      48             :     number_measurements: usize,
+      49             :     /// The register for the readout.
+      50             :     readout: String,
+      51             : }
+      52             : 
+      53             : #[allow(non_upper_case_globals)]
+      54             : const TAGS_PragmaSetNumberOfMeasurements: &[&str; 3] = &[
+      55             :     "Operation",
+      56             :     "PragmaOperation",
+      57             :     "PragmaSetNumberOfMeasurements",
+      58             : ];
+      59             : 
+      60             : // Implementing the InvolveQubits trait for PragmaSetNumberOfMeasurements.
+      61             : impl InvolveQubits for PragmaSetNumberOfMeasurements {
+      62             :     /// Lists all involved qubits (here, none).
+      63           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+      64           1 :         InvolvedQubits::None
+      65           1 :     }
+      66             : }
+      67             : 
+      68             : /// This PRAGMA Operation sets the statevector of a quantum register.
+      69             : ///
+      70             : /// The Circuit() module automatically initializes the qubits in the |0> state, so this PRAGMA
+      71             : /// operation allows you to set the state of the qubits to a state of your choosing.
+      72             : ///
+      73             : /// # Example
+      74             : ///
+      75             : /// For instance, to initialize the $|\Psi^->$ Bell state, we pass the following `statevec` to
+      76             : /// the PragmaSetStateVector operation.
+      77             : ///
+      78             : /// ```
+      79             : /// use ndarray::{array, Array1};
+      80             : /// use num_complex::Complex64;
+      81             : /// use roqoqo::operations::PragmaSetStateVector;
+      82             : ///
+      83             : /// let statevec: Array1<Complex64> = array![
+      84             : ///     Complex64::new(0.0, 0.0),
+      85             : ///     Complex64::new(1.0 / (2.0_f64).sqrt(), 0.0),
+      86             : ///     Complex64::new(-1.0 / (2.0_f64).sqrt(), 0.0),
+      87             : ///     Complex64::new(0.0, 0.0)
+      88             : /// ];
+      89             : ///
+      90             : /// let pragma = PragmaSetStateVector::new(statevec.clone());
+      91             : /// ```
+      92             : ///
+      93             : #[derive(
+      94           1 :     Debug,
+      95           1 :     Clone,
+      96           7 :     PartialEq,
+      97          13 :     roqoqo_derive::Operate,
+      98           2 :     roqoqo_derive::Substitute,
+      99             :     roqoqo_derive::OperatePragma,
+     100             : )]
+     101             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     102             : pub struct PragmaSetStateVector {
+     103             :     /// The statevector that is initialized.
+     104             :     statevector: Array1<Complex64>,
+     105             : }
+     106             : 
+     107             : #[allow(non_upper_case_globals)]
+     108             : const TAGS_PragmaSetStateVector: &[&str; 3] =
+     109             :     &["Operation", "PragmaOperation", "PragmaSetStateVector"];
+     110             : 
+     111             : // Implementing the InvolveQubits trait for PragmaSetStateVector.
+     112             : impl InvolveQubits for PragmaSetStateVector {
+     113             :     /// Lists all involved qubits (here, all).
+     114           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     115           1 :         InvolvedQubits::All
+     116           1 :     }
+     117             : }
+     118             : 
+     119             : /// This PRAGMA Operation sets the density matrix of a quantum register.
+     120             : ///
+     121             : /// The Circuit() module automatically initializes the qubits in the |0> state, so this PRAGMA
+     122             : /// operation allows you to set the state of the qubits by setting a density matrix of your choosing.
+     123             : ///
+     124             : /// # Example
+     125             : ///
+     126             : /// ```
+     127             : /// use ndarray::{array, Array2};
+     128             : /// use num_complex::Complex64;
+     129             : /// use roqoqo::operations::PragmaSetDensityMatrix;
+     130             : ///
+     131             : /// let matrix: Array2<Complex64> = array![
+     132             : ///    [Complex64::new(1.0, 0.0), Complex64::new(0.0, 0.0)],
+     133             : ///    [Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0)],
+     134             : /// ];
+     135             : ///
+     136             : /// let pragma = PragmaSetDensityMatrix::new(matrix.clone());
+     137             : /// ```
+     138             : ///
+     139             : #[derive(
+     140           1 :     Debug,
+     141           1 :     Clone,
+     142           7 :     PartialEq,
+     143          13 :     roqoqo_derive::Operate,
+     144           2 :     roqoqo_derive::Substitute,
+     145             :     roqoqo_derive::OperatePragma,
+     146             : )]
+     147             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     148             : pub struct PragmaSetDensityMatrix {
+     149             :     /// The density matrix that is initialized.
+     150             :     density_matrix: Array2<Complex64>,
+     151             : }
+     152             : 
+     153             : #[allow(non_upper_case_globals)]
+     154             : const TAGS_PragmaSetDensityMatrix: &[&str; 3] =
+     155             :     &["Operation", "PragmaOperation", "PragmaSetDensityMatrix"];
+     156             : 
+     157             : // Implementing the InvolveQubits trait for PragmaSetDensityMatrix.
+     158             : impl InvolveQubits for PragmaSetDensityMatrix {
+     159             :     /// Lists all involved qubits (here, all).
+     160           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     161           1 :         InvolvedQubits::All
+     162           1 :     }
+     163             : }
+     164             : 
+     165             : /// The repeated gate PRAGMA operation.
+     166             : ///
+     167             : /// This PRAGMA Operation repeats the next gate in the circuit the given number of times to increase the rate for error mitigation.
+     168             : ///
+     169             : #[derive(
+     170           1 :     Debug,
+     171           1 :     Clone,
+     172           7 :     PartialEq,
+     173          13 :     roqoqo_derive::Operate,
+     174           2 :     roqoqo_derive::Substitute,
+     175             :     roqoqo_derive::OperatePragma,
+     176             : )]
+     177             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     178             : pub struct PragmaRepeatGate {
+     179             :     /// The number of times the following gate is repeated.
+     180             :     repetition_coefficient: usize,
+     181             : }
+     182             : 
+     183             : #[allow(non_upper_case_globals)]
+     184             : const TAGS_PragmaRepeatGate: &[&str; 3] = &["Operation", "PragmaOperation", "PragmaRepeatGate"];
+     185             : 
+     186             : // Implementing the InvolveQubits trait for PragmaRepeatGate.
+     187             : impl InvolveQubits for PragmaRepeatGate {
+     188             :     /// Lists all involved qubits (here, all).
+     189           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     190           1 :         InvolvedQubits::All
+     191           1 :     }
+     192             : }
+     193             : 
+     194             : /// The statistical overrotation PRAGMA operation.
+     195             : ///
+     196             : /// This PRAGMA applies a statistical overrotation to the next rotation gate in the circuit, which
+     197             : /// matches the hqslang name in the `gate` parameter of PragmaOverrotation and the involved qubits in `qubits`.
+     198             : ///
+     199             : /// The applied overrotation corresponds to adding a random number to the rotation angle.
+     200             : /// The random number is drawn from a normal distribution with mean `0`
+     201             : /// and standard deviation `variance` and is multiplied by the `amplitude`.
+     202             : ///
+     203             : #[derive(
+     204           1 :     Debug,
+     205           1 :     Clone,
+     206           7 :     PartialEq,
+     207          16 :     roqoqo_derive::Operate,
+     208           2 :     roqoqo_derive::Substitute,
+     209           1 :     roqoqo_derive::InvolveQubits,
+     210             :     roqoqo_derive::OperatePragma,
+     211           1 :     roqoqo_derive::OperateMultiQubit,
+     212             : )]
+     213             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     214             : // #[cfg_attr(feature = "overrotate")]
+     215             : pub struct PragmaOverrotation {
+     216             :     /// The unique hqslang name of the gate to overrotate.
+     217             :     gate_hqslang: String,
+     218             :     /// The qubits of the gate to overrotate.
+     219             :     qubits: Vec<usize>,
+     220             :     /// The amplitude the random number is multiplied by.
+     221             :     amplitude: f64,
+     222             :     /// The standard deviation of the normal distribution the random number is drawn from.
+     223             :     variance: f64,
+     224             : }
+     225             : 
+     226             : #[allow(non_upper_case_globals)]
+     227             : const TAGS_PragmaOverrotation: &[&str; 4] = &[
+     228             :     "Operation",
+     229             :     "MultiQubitOperation",
+     230             :     "PragmaOperation",
+     231             :     "PragmaOverrotation",
+     232             : ];
+     233             : 
+     234             : /// This PRAGMA Operation boosts noise and overrotations in the circuit.
+     235             : ///
+     236             : #[derive(
+     237           1 :     Debug,
+     238           1 :     Clone,
+     239           7 :     PartialEq,
+     240          14 :     roqoqo_derive::Operate,
+     241           1 :     roqoqo_derive::Substitute,
+     242             :     roqoqo_derive::OperatePragma,
+     243             : )]
+     244             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     245             : pub struct PragmaBoostNoise {
+     246             :     /// The coefficient by which the noise is boosted, i.e. the number by which the gate time is multiplied.
+     247             :     noise_coefficient: CalculatorFloat,
+     248             : }
+     249             : 
+     250             : #[allow(non_upper_case_globals)]
+     251             : const TAGS_PragmaBoostNoise: &[&str; 3] = &["Operation", "PragmaOperation", "PragmaBoostNoise"];
+     252             : 
+     253             : // Implementing the InvolveQubits trait for PragmaBoostNoise.
+     254             : impl InvolveQubits for PragmaBoostNoise {
+     255             :     /// Lists all involved qubits (here, none).
+     256           2 :     fn involved_qubits(&self) -> InvolvedQubits {
+     257           2 :         InvolvedQubits::None
+     258           2 :     }
+     259             : }
+     260             : 
+     261             : /// This PRAGMA Operation signals the STOP of a parallel execution block.
+     262             : ///
+     263             : #[derive(
+     264           1 :     Debug,
+     265           1 :     Clone,
+     266           7 :     PartialEq,
+     267           1 :     roqoqo_derive::InvolveQubits,
+     268          14 :     roqoqo_derive::Operate,
+     269           4 :     roqoqo_derive::Substitute,
+     270           1 :     roqoqo_derive::OperateMultiQubit,
+     271             :     roqoqo_derive::OperatePragma,
+     272             : )]
+     273             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     274             : pub struct PragmaStopParallelBlock {
+     275             :     /// The qubits involved in parallel execution block.
+     276             :     qubits: Vec<usize>,
+     277             :     /// The time for the execution of the block in seconds.
+     278             :     execution_time: CalculatorFloat,
+     279             : }
+     280             : 
+     281             : #[allow(non_upper_case_globals)]
+     282             : const TAGS_PragmaStopParallelBlock: &[&str; 4] = &[
+     283             :     "Operation",
+     284             :     "MultiQubitOperation",
+     285             :     "PragmaOperation",
+     286             :     "PragmaStopParallelBlock",
+     287             : ];
+     288             : 
+     289             : /// The global phase PRAGMA operation.
+     290             : ///
+     291             : /// This PRAGMA Operation signals that the quantum register picks up a global phase,
+     292             : /// i.e. it provides information that there is a global phase to be considered.
+     293             : ///
+     294             : #[derive(
+     295           1 :     Debug,
+     296           1 :     Clone,
+     297           7 :     PartialEq,
+     298          13 :     roqoqo_derive::Operate,
+     299           1 :     roqoqo_derive::Substitute,
+     300             :     roqoqo_derive::OperatePragma,
+     301             : )]
+     302             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     303             : pub struct PragmaGlobalPhase {
+     304             :     /// The picked up global phase.
+     305             :     phase: CalculatorFloat,
+     306             : }
+     307             : 
+     308             : #[allow(non_upper_case_globals)]
+     309             : const TAGS_PragmaGlobalPhase: &[&str; 3] = &["Operation", "PragmaOperation", "PragmaGlobalPhase"];
+     310             : 
+     311             : // Implementing the InvolveQubits trait for PragmaGlobalPhase.
+     312             : impl InvolveQubits for PragmaGlobalPhase {
+     313             :     /// Lists all involved qubits (here, none).
+     314           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     315           1 :         InvolvedQubits::None
+     316           1 :     }
+     317             : }
+     318             : 
+     319             : /// This PRAGMA Operation makes the quantum hardware wait a given amount of time.
+     320             : ///
+     321             : /// This PRAGMA Operation is used for error mitigation reasons, for instance.
+     322             : /// It can be used to boost the noise on the qubits since it gets worse with time.
+     323             : ///
+     324             : #[derive(
+     325           1 :     Debug,
+     326           1 :     Clone,
+     327           7 :     PartialEq,
+     328           1 :     roqoqo_derive::InvolveQubits,
+     329          14 :     roqoqo_derive::Operate,
+     330           4 :     roqoqo_derive::Substitute,
+     331           1 :     roqoqo_derive::OperateMultiQubit,
+     332             :     roqoqo_derive::OperatePragma,
+     333             : )]
+     334             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     335             : pub struct PragmaSleep {
+     336             :     /// The qubits involved in the sleep block.
+     337             :     qubits: Vec<usize>,
+     338             :     /// Time for the execution of the operation in seconds.
+     339             :     sleep_time: CalculatorFloat,
+     340             : }
+     341             : 
+     342             : #[allow(non_upper_case_globals)]
+     343             : const TAGS_PragmaSleep: &[&str; 4] = &[
+     344             :     "Operation",
+     345             :     "MultiQubitOperation",
+     346             :     "PragmaOperation",
+     347             :     "PragmaSleep",
+     348             : ];
+     349             : 
+     350             : /// This PRAGMA Operation resets the chosen qubit to the zero state.
+     351             : ///
+     352             : #[derive(
+     353           1 :     Debug,
+     354           1 :     Clone,
+     355           7 :     PartialEq,
+     356           1 :     roqoqo_derive::InvolveQubits,
+     357          13 :     roqoqo_derive::Operate,
+     358           2 :     roqoqo_derive::Substitute,
+     359           1 :     roqoqo_derive::OperateSingleQubit,
+     360             :     roqoqo_derive::OperatePragma,
+     361             : )]
+     362             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     363             : pub struct PragmaActiveReset {
+     364             :     /// The qubit to be reset.
+     365             :     qubit: usize,
+     366             : }
+     367             : 
+     368             : #[allow(non_upper_case_globals)]
+     369             : const TAGS_PragmaActiveReset: &[&str; 4] = &[
+     370             :     "Operation",
+     371             :     "SingleQubitOperation",
+     372             :     "PragmaOperation",
+     373             :     "PragmaActiveReset",
+     374             : ];
+     375             : 
+     376             : /// This PRAGMA Operation signals the START of a decomposition block.
+     377             : ///
+     378             : #[derive(
+     379           1 :     Debug,
+     380           2 :     Clone,
+     381           7 :     PartialEq,
+     382           1 :     roqoqo_derive::InvolveQubits,
+     383          13 :     roqoqo_derive::Operate,
+     384           1 :     roqoqo_derive::OperateMultiQubit,
+     385             :     roqoqo_derive::OperatePragma,
+     386             : )]
+     387             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     388             : pub struct PragmaStartDecompositionBlock {
+     389             :     /// The qubits involved in the decomposition block.
+     390             :     qubits: Vec<usize>,
+     391             :     /// The reordering dictionary of the block.
+     392             :     reordering_dictionary: HashMap<usize, usize>,
+     393             : }
+     394             : 
+     395             : #[allow(non_upper_case_globals)]
+     396             : const TAGS_PragmaStartDecompositionBlock: &[&str; 4] = &[
+     397             :     "Operation",
+     398             :     "MultiQubitOperation",
+     399             :     "PragmaOperation",
+     400             :     "PragmaStartDecompositionBlock",
+     401             : ];
+     402             : 
+     403             : /// Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
+     404             : impl Substitute for PragmaStartDecompositionBlock {
+     405             :     /// Remaps qubits in clone of the operation.
+     406           1 :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+     407           1 :         let mut new_qubits: Vec<usize> = Vec::new();
+     408           2 :         for q in &self.qubits {
+     409           2 :             new_qubits.push(*mapping.get(q).ok_or(Err("")).map_err(
+     410           2 :                 |_x: std::result::Result<&usize, &str>| RoqoqoError::QubitMappingError {
+     411           0 :                     qubit: *q,
+     412           2 :                 },
+     413           2 :             )?)
+     414             :         }
+     415             : 
+     416           1 :         let mut mutable_reordering: HashMap<usize, usize> = HashMap::new();
+     417           3 :         for (old_qubit, new_qubit) in self.reordering_dictionary.clone() {
+     418           2 :             let old_remapped = *mapping.get(&old_qubit).ok_or(Err("")).map_err(
+     419           2 :                 |_x: std::result::Result<&usize, &str>| RoqoqoError::QubitMappingError {
+     420           0 :                     qubit: old_qubit,
+     421           2 :                 },
+     422           2 :             )?;
+     423           2 :             let new_remapped = *mapping.get(&new_qubit).ok_or(Err("")).map_err(
+     424           2 :                 |_x: std::result::Result<&usize, &str>| RoqoqoError::QubitMappingError {
+     425           0 :                     qubit: new_qubit,
+     426           2 :                 },
+     427           2 :             )?;
+     428           2 :             mutable_reordering.insert(old_remapped, new_remapped);
+     429             :         }
+     430             : 
+     431           1 :         Ok(PragmaStartDecompositionBlock::new(
+     432           1 :             new_qubits,
+     433           1 :             mutable_reordering,
+     434           1 :         ))
+     435           1 :     }
+     436             : 
+     437             :     /// Substitutes symbolic parameters in clone of the operation.
+     438           1 :     fn substitute_parameters(&self, _calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+     439           1 :         Ok(self.clone())
+     440           1 :     }
+     441             : }
+     442             : 
+     443             : /// This PRAGMA Operation signals the STOP of a decomposition block.
+     444             : ///
+     445             : #[derive(
+     446           1 :     Debug,
+     447           1 :     Clone,
+     448           7 :     PartialEq,
+     449           1 :     roqoqo_derive::InvolveQubits,
+     450          13 :     roqoqo_derive::Operate,
+     451           3 :     roqoqo_derive::Substitute,
+     452           1 :     roqoqo_derive::OperateMultiQubit,
+     453             :     roqoqo_derive::OperatePragma,
+     454             : )]
+     455             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     456             : pub struct PragmaStopDecompositionBlock {
+     457             :     /// The qubits involved in the decomposition block.
+     458             :     qubits: Vec<usize>,
+     459             : }
+     460             : 
+     461             : #[allow(non_upper_case_globals)]
+     462             : const TAGS_PragmaStopDecompositionBlock: &[&str; 4] = &[
+     463             :     "Operation",
+     464             :     "MultiQubitOperation",
+     465             :     "PragmaOperation",
+     466             :     "PragmaStopDecompositionBlock",
+     467             : ];
+     468             : 
+     469             : /// The damping PRAGMA noise Operation.
+     470             : ///
+     471             : /// This PRAGMA Operation applies a pure damping error corresponding to zero temperature environments.
+     472             : ///
+     473             : #[derive(
+     474           1 :     Debug,
+     475           2 :     Clone,
+     476           8 :     PartialEq,
+     477           1 :     roqoqo_derive::InvolveQubits,
+     478           1 :     roqoqo_derive::Operate,
+     479           3 :     roqoqo_derive::Substitute,
+     480           1 :     roqoqo_derive::OperateSingleQubit,
+     481             :     roqoqo_derive::OperatePragma,
+     482             : )]
+     483             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     484             : pub struct PragmaDamping {
+     485             :     /// The qubit on which to apply the damping.
+     486             :     qubit: usize,
+     487             :     /// The time (in seconds) the gate takes to be applied to the qubit on the (simulated) hardware
+     488             :     gate_time: CalculatorFloat,
+     489             :     /// The error rate of the damping (in 1/second).
+     490             :     rate: CalculatorFloat,
+     491             : }
+     492             : 
+     493             : #[allow(non_upper_case_globals)]
+     494             : const TAGS_PragmaDamping: &[&str; 6] = &[
+     495             :     "Operation",
+     496             :     "SingleQubitOperation",
+     497             :     "PragmaOperation",
+     498             :     "PragmaNoiseOperation",
+     499             :     "PragmaNoiseProbaOperation",
+     500             :     "PragmaDamping",
+     501             : ];
+     502             : 
+     503             : /// OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
+     504             : impl OperatePragmaNoise for PragmaDamping {
+     505             :     /// Returns the superoperator matrix of the operation.
+     506           1 :     fn superoperator(&self) -> Result<Array2<f64>, RoqoqoError> {
+     507           1 :         let prob: f64 = f64::try_from(self.probability())?;
+     508           1 :         let sqrt: f64 = (1.0 - prob).sqrt();
+     509           1 : 
+     510           1 :         Ok(array![
+     511           1 :             [1.0, 0.0, 0.0, prob],
+     512           1 :             [0.0, sqrt, 0.0, 0.0],
+     513           1 :             [0.0, 0.0, sqrt, 0.0],
+     514           1 :             [0.0, 0.0, 0.0, 1.0 - prob],
+     515           1 :         ])
+     516           1 :     }
+     517             : 
+     518             :     /// Returns the gate to the power of `power`.
+     519           1 :     fn powercf(&self, power: CalculatorFloat) -> Self {
+     520           1 :         let mut new = self.clone();
+     521           1 :         new.gate_time = power * self.gate_time.clone();
+     522           1 :         new
+     523           1 :     }
+     524             : }
+     525             : 
+     526             : /// OperatePragmaNoiseProba trait creating necessary functions for a PRAGMA noise Operation.
+     527             : impl OperatePragmaNoiseProba for PragmaDamping {
+     528             :     /// Returns the probability of the noise gate affecting the qubit, based on its `gate_time` and `rate`.
+     529           3 :     fn probability(&self) -> CalculatorFloat {
+     530           3 :         let prob: CalculatorFloat =
+     531           3 :             ((self.gate_time.clone() * self.rate.clone() * (-2.0)).exp() * (-1.0) + 1.0) * 0.5;
+     532           3 :         prob
+     533           3 :     }
+     534             : }
+     535             : 
+     536             : /// The depolarising PRAGMA noise Operation.
+     537             : ///
+     538             : /// This PRAGMA Operation applies a depolarising error corresponding to infinite temperature environments.
+     539             : ///
+     540             : #[derive(
+     541           1 :     Debug,
+     542           2 :     Clone,
+     543           8 :     PartialEq,
+     544           1 :     roqoqo_derive::InvolveQubits,
+     545           1 :     roqoqo_derive::Operate,
+     546           3 :     roqoqo_derive::Substitute,
+     547           1 :     roqoqo_derive::OperateSingleQubit,
+     548             :     roqoqo_derive::OperatePragma,
+     549             : )]
+     550             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     551             : pub struct PragmaDepolarising {
+     552             :     /// The qubit on which to apply the depolarising.
+     553             :     qubit: usize,
+     554             :     /// The time (in seconds) the gate takes to be applied to the qubit on the (simulated) hardware
+     555             :     gate_time: CalculatorFloat,
+     556             :     /// The error rate of the depolarisation (in 1/second).
+     557             :     rate: CalculatorFloat,
+     558             : }
+     559             : 
+     560             : #[allow(non_upper_case_globals)]
+     561             : const TAGS_PragmaDepolarising: &[&str; 6] = &[
+     562             :     "Operation",
+     563             :     "SingleQubitOperation",
+     564             :     "PragmaOperation",
+     565             :     "PragmaNoiseOperation",
+     566             :     "PragmaNoiseProbaOperation",
+     567             :     "PragmaDepolarising",
+     568             : ];
+     569             : 
+     570             : /// OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
+     571             : impl OperatePragmaNoise for PragmaDepolarising {
+     572             :     /// Returns the superoperator matrix of the operation.
+     573           1 :     fn superoperator(&self) -> Result<Array2<f64>, RoqoqoError> {
+     574           1 :         let gate_time: f64 = f64::try_from(self.gate_time.clone())?;
+     575           1 :         let rate: f64 = f64::try_from(self.rate.clone())?;
+     576             : 
+     577           1 :         let pre_exp: f64 = -1.0 * gate_time * rate;
+     578           1 :         let prob: f64 = (3.0 / 4.0) * (1.0 - pre_exp.exp());
+     579           1 :         let proba1: f64 = 1.0 - (2.0 / 3.0) * prob;
+     580           1 :         let proba2: f64 = 1.0 - (4.0 / 3.0) * prob;
+     581           1 :         let proba3: f64 = (2.0 / 3.0) * prob;
+     582           1 : 
+     583           1 :         Ok(array![
+     584           1 :             [proba1, 0.0, 0.0, proba3],
+     585           1 :             [0.0, proba2, 0.0, 0.0],
+     586           1 :             [0.0, 0.0, proba2, 0.0],
+     587           1 :             [proba3, 0.0, 0.0, proba1],
+     588           1 :         ])
+     589           1 :     }
+     590             : 
+     591             :     /// Returns the gate to the power of `power`.
+     592           1 :     fn powercf(&self, power: CalculatorFloat) -> Self {
+     593           1 :         let mut new = self.clone();
+     594           1 :         new.gate_time = power * self.gate_time.clone();
+     595           1 :         new
+     596           1 :     }
+     597             : }
+     598             : 
+     599             : /// OperatePragmaNoiseProba trait creating necessary functions for a PRAGMA noise Operation.
+     600             : impl OperatePragmaNoiseProba for PragmaDepolarising {
+     601             :     /// Returns the probability of the noise gate affecting the qubit, based on its `gate_time` and `rate`.
+     602           1 :     fn probability(&self) -> CalculatorFloat {
+     603           1 :         let prob: CalculatorFloat =
+     604           1 :             ((self.gate_time.clone() * self.rate.clone() * (-1.0)).exp() * (-1.0) + 1.0) * 0.75;
+     605           1 :         prob
+     606           1 :     }
+     607             : }
+     608             : 
+     609             : /// The dephasing PRAGMA noise Operation.
+     610             : ///
+     611             : /// This PRAGMA Operation applies a pure dephasing error.
+     612             : ///
+     613             : #[derive(
+     614           1 :     Debug,
+     615           2 :     Clone,
+     616           8 :     PartialEq,
+     617           1 :     roqoqo_derive::InvolveQubits,
+     618           1 :     roqoqo_derive::Operate,
+     619           3 :     roqoqo_derive::Substitute,
+     620           1 :     roqoqo_derive::OperateSingleQubit,
+     621             :     roqoqo_derive::OperatePragma,
+     622             : )]
+     623             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     624             : pub struct PragmaDephasing {
+     625             :     /// The qubit on which to apply the dephasing.
+     626             :     qubit: usize,
+     627             :     /// The time (in seconds) the gate takes to be applied to the qubit on the (simulated) hardware
+     628             :     gate_time: CalculatorFloat,
+     629             :     /// The error rate of the dephasing (in 1/second).
+     630             :     rate: CalculatorFloat,
+     631             : }
+     632             : 
+     633             : #[allow(non_upper_case_globals)]
+     634             : const TAGS_PragmaDephasing: &[&str; 6] = &[
+     635             :     "Operation",
+     636             :     "SingleQubitOperation",
+     637             :     "PragmaOperation",
+     638             :     "PragmaNoiseOperation",
+     639             :     "PragmaNoiseProbaOperation",
+     640             :     "PragmaDephasing",
+     641             : ];
+     642             : 
+     643             : /// OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
+     644             : impl OperatePragmaNoise for PragmaDephasing {
+     645             :     /// Returns the superoperator matrix of the operation.
+     646           1 :     fn superoperator(&self) -> Result<Array2<f64>, RoqoqoError> {
+     647           1 :         let gate_time: f64 = f64::try_from(self.gate_time.clone())?;
+     648           1 :         let rate: f64 = f64::try_from(self.rate.clone())?;
+     649             : 
+     650           1 :         let pre_exp: f64 = -2.0 * gate_time * rate;
+     651           1 :         let prob: f64 = (1.0 / 2.0) * (1.0 - pre_exp.exp());
+     652           1 : 
+     653           1 :         Ok(array![
+     654           1 :             [1.0, 0.0, 0.0, 0.0],
+     655           1 :             [0.0, 1.0 - 2.0 * prob, 0.0, 0.0],
+     656           1 :             [0.0, 0.0, 1.0 - 2.0 * prob, 0.0],
+     657           1 :             [0.0, 0.0, 0.0, 1.0],
+     658           1 :         ])
+     659           1 :     }
+     660             : 
+     661             :     /// Returns the gate to the power of `power`.
+     662           1 :     fn powercf(&self, power: CalculatorFloat) -> Self {
+     663           1 :         let mut new = self.clone();
+     664           1 :         new.gate_time = power * self.gate_time.clone();
+     665           1 :         new
+     666           1 :     }
+     667             : }
+     668             : 
+     669             : /// OperatePragmaNoiseProba trait creating necessary functions for a PRAGMA noise Operation.
+     670             : impl OperatePragmaNoiseProba for PragmaDephasing {
+     671             :     /// Returns the probability of the noise gate affecting the qubit, based on its `gate_time` and `rate`.
+     672           1 :     fn probability(&self) -> CalculatorFloat {
+     673           1 :         let prob: CalculatorFloat =
+     674           1 :             ((self.gate_time.clone() * self.rate.clone() * (-2.0)).exp() * (-1.0) + 1.0) * 0.5;
+     675           1 :         prob
+     676           1 :     }
+     677             : }
+     678             : 
+     679             : /// The random noise PRAGMA operation.
+     680             : ///
+     681             : /// This PRAGMA Operation applies a stochastically unravelled combination of dephasing and depolarising.
+     682             : ///
+     683             : #[derive(
+     684           1 :     Debug,
+     685           2 :     Clone,
+     686           8 :     PartialEq,
+     687           1 :     roqoqo_derive::InvolveQubits,
+     688           1 :     roqoqo_derive::Operate,
+     689           3 :     roqoqo_derive::Substitute,
+     690           1 :     roqoqo_derive::OperateSingleQubit,
+     691             :     roqoqo_derive::OperatePragma,
+     692             : )]
+     693             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     694             : pub struct PragmaRandomNoise {
+     695             :     /// The qubit the PRAGMA Operation is applied to.
+     696             :     qubit: usize,
+     697             :     /// The time (in seconds) the gate takes to be applied to the qubit on the (simulated) hardware
+     698             :     gate_time: CalculatorFloat,
+     699             :     /// The error rate of the depolarisation (in 1/second).
+     700             :     depolarising_rate: CalculatorFloat,
+     701             :     /// The error rate of the dephasing (in 1/second).
+     702             :     dephasing_rate: CalculatorFloat,
+     703             : }
+     704             : 
+     705             : #[allow(non_upper_case_globals)]
+     706             : const TAGS_PragmaRandomNoise: &[&str; 6] = &[
+     707             :     "Operation",
+     708             :     "SingleQubitOperation",
+     709             :     "PragmaOperation",
+     710             :     "PragmaNoiseOperation",
+     711             :     "PragmaNoiseProbaOperation",
+     712             :     "PragmaRandomNoise",
+     713             : ];
+     714             : 
+     715             : /// OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
+     716             : impl OperatePragmaNoise for PragmaRandomNoise {
+     717             :     /// Returns the superoperator matrix of the operation. For the RandomNoise pragma, the superoperator
+     718             :     /// is the effective superoperator after averaging over many trajectories: the dephasing superoperator.
+     719           1 :     fn superoperator(&self) -> Result<Array2<f64>, RoqoqoError> {
+     720           1 :         let gate_time: f64 = f64::try_from(self.gate_time.clone())?;
+     721           1 :         let rate: f64 = f64::try_from(self.dephasing_rate.clone())?;
+     722             : 
+     723           1 :         let pre_exp: f64 = -2.0 * gate_time * rate;
+     724           1 :         let prob: f64 = (1.0 / 2.0) * (1.0 - pre_exp.exp());
+     725           1 : 
+     726           1 :         Ok(array![
+     727           1 :             [1.0, 0.0, 0.0, 0.0],
+     728           1 :             [0.0, 1.0 - 2.0 * prob, 0.0, 0.0],
+     729           1 :             [0.0, 0.0, 1.0 - 2.0 * prob, 0.0],
+     730           1 :             [0.0, 0.0, 0.0, 1.0],
+     731           1 :         ])
+     732           1 :     }
+     733             : 
+     734             :     /// Returns the gate to the power of `power`.
+     735           1 :     fn powercf(&self, power: CalculatorFloat) -> Self {
+     736           1 :         let mut new = self.clone();
+     737           1 :         new.gate_time = power * self.gate_time.clone();
+     738           1 :         new
+     739           1 :     }
+     740             : }
+     741             : 
+     742             : /// OperatePragmaNoiseProba trait creating necessary functions for a PRAGMA noise Operation.
+     743             : impl OperatePragmaNoiseProba for PragmaRandomNoise {
+     744             :     /// Returns the probability of the noise gate affecting the qubit, based on its `gate_time`, `depolarising_rate` and `dephasing_rate`.
+     745           1 :     fn probability(&self) -> CalculatorFloat {
+     746           1 :         let rates = [
+     747           1 :             self.depolarising_rate.clone() / 4.0,
+     748           1 :             self.depolarising_rate.clone() / 4.0,
+     749           1 :             (self.depolarising_rate.clone() / 4.0) + self.dephasing_rate.clone(),
+     750           1 :         ];
+     751           1 :         (rates[0].clone() + &rates[1] + &rates[2]) * &self.gate_time
+     752           1 :     }
+     753             : }
+     754             : 
+     755             : /// The general noise PRAGMA operation.
+     756             : ///
+     757             : /// This PRAGMA operation applies a noise term according to the given rates.
+     758             : /// The rates are represented by a 3x3 matrix:
+     759             : /// $$ M = \begin{pmatrix}
+     760             : /// a & b & c \\\\
+     761             : /// d & e & f \\\\
+     762             : /// g & h & j \\\\
+     763             : /// \end{pmatrix} $$
+     764             : /// where the coefficients correspond to the following summands
+     765             : /// expanded from the first term of the non-coherent part of the Lindblad equation:
+     766             : ///     $$ \frac{d}{dt}\rho = \sum_{i,j=0}^{2} M_{i,j} L_{i} \rho L_{j}^{\dagger} - \frac{1}{2} \{ L_{j}^{\dagger} L_i, \rho \} \\\\
+     767             : ///         L_0 = \sigma^{+} \\\\
+     768             : ///         L_1 = \sigma^{-} \\\\
+     769             : ///         L_3 = \sigma^{z}
+     770             : ///     $$
+     771             : /// result{sigma_z, sigma_minus} = sigma_z (x) sigma_minus.T - 1/2 * (sigma_minus.T * sigma_z) (x) 1 - 1/2 * 1 (x) (sigma_minus.T * sigma_z).T
+     772             : ///
+     773             : /// Applying the Pragma with a given `gate_time` corresponds to applying the full time-evolution under the Lindblad equation for `gate_time` time.
+     774             : ///
+     775             : /// # Example
+     776             : ///
+     777             : /// ```
+     778             : /// use ndarray::{array, Array2};
+     779             : /// use roqoqo::operations::PragmaGeneralNoise;
+     780             : /// use qoqo_calculator::CalculatorFloat;
+     781             : ///
+     782             : /// let rates: Array2<f64> = array![
+     783             : ///    [
+     784             : ///         1.0,
+     785             : ///         0.0,
+     786             : ///         0.0
+     787             : ///     ],
+     788             : ///     [
+     789             : ///         0.0,
+     790             : ///         1.0,
+     791             : ///         0.0
+     792             : ///     ],
+     793             : ///     [
+     794             : ///         0.0,
+     795             : ///         0.0,
+     796             : ///         1.0
+     797             : ///     ],
+     798             : /// ];
+     799             : /// let pragma = PragmaGeneralNoise::new(
+     800             : ///     0,
+     801             : ///     CalculatorFloat::from(0.005),
+     802             : ///     rates.clone(),
+     803             : /// );
+     804             : /// ```
+     805             : /// That will result into $.
+     806             : ///
+     807             : #[derive(
+     808           1 :     Debug,
+     809           1 :     Clone,
+     810           7 :     PartialEq,
+     811           1 :     roqoqo_derive::InvolveQubits,
+     812          16 :     roqoqo_derive::Operate,
+     813           3 :     roqoqo_derive::Substitute,
+     814           1 :     roqoqo_derive::OperateSingleQubit,
+     815             :     roqoqo_derive::OperatePragma,
+     816             : )]
+     817             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     818             : pub struct PragmaGeneralNoise {
+     819             :     /// The qubit the PRAGMA Operation is applied to.
+     820             :     qubit: usize,
+     821             :     /// The time (in seconds) the gate takes to be applied to the qubit on the (simulated) hardware
+     822             :     gate_time: CalculatorFloat,
+     823             :     /// The rates representing the general noise matrix M (a 3x3 matrix).
+     824             :     rates: Array2<f64>,
+     825             : }
+     826             : 
+     827             : #[allow(non_upper_case_globals)]
+     828             : const TAGS_PragmaGeneralNoise: &[&str; 5] = &[
+     829             :     "Operation",
+     830             :     "SingleQubitOperation",
+     831             :     "PragmaOperation",
+     832             :     "PragmaNoiseOperation",
+     833             :     "PragmaGeneralNoise",
+     834             : ];
+     835             : 
+     836             : // Collection of superoperators that appear in the Lindblad equation for a single qubit/spin with
+     837             : // a basis of the form 0: sigma+ 1:sigma- 2: sigmaz
+     838             : const PGN_SUPEROP: [[[[f64; 4]; 4]; 3]; 3] = [
+     839             :     [
+     840             :         // sigma+ sigma+
+     841             :         [
+     842             :             [0., 0., 0., 4.],
+     843             :             [0., -2., 0., 0.],
+     844             :             [0., 0., -2., 0.],
+     845             :             [0., 0., 0., -4.],
+     846             :         ],
+     847             :         // sigma+ sigma-
+     848             :         [
+     849             :             [0., 0., 0., 0.],
+     850             :             [0., 0., 4., 0.],
+     851             :             [0., 0., 0., 0.],
+     852             :             [0., 0., 0., 0.],
+     853             :         ],
+     854             :         // sigma+ sigmaz
+     855             :         [
+     856             :             [0., 0., 1., 0.],
+     857             :             [-1., 0., 0., -3.],
+     858             :             [0., 0., 0., 0.],
+     859             :             [0., 0., 0., -1.],
+     860             :         ],
+     861             :     ],
+     862             :     [
+     863             :         // sigma- sigma+
+     864             :         [
+     865             :             [0., 0., 0., 0.],
+     866             :             [0., 0., 0., 0.],
+     867             :             [0., 4., 0., 0.],
+     868             :             [0., 0., 0., 0.],
+     869             :         ],
+     870             :         // sigma- sigma-
+     871             :         [
+     872             :             [-4., 0., 0., 0.],
+     873             :             [0., -2., 0., 0.],
+     874             :             [0., 0., -2., 0.],
+     875             :             [4., 0., 0., 0.],
+     876             :         ],
+     877             :         // sigma- sigmaz
+     878             :         [
+     879             :             [0., 1., 0., 0.],
+     880             :             [0., 0., 0., 0.],
+     881             :             [3., 0., 0., 1.],
+     882             :             [0., -1., 0., 0.],
+     883             :         ],
+     884             :     ],
+     885             :     [
+     886             :         //  sigmaz sigma+
+     887             :         [
+     888             :             [0., 1., 0., 0.],
+     889             :             [0., 0., 0., 0.],
+     890             :             [-1., 0., 0., -3.],
+     891             :             [0., -1., 0., 0.],
+     892             :         ],
+     893             :         // sigmaz sigma-
+     894             :         [
+     895             :             [0., 0., 1., 0.],
+     896             :             [3., 0., 0., 1.],
+     897             :             [0., 0., 0., 0.],
+     898             :             [0., 0., -1., 0.],
+     899             :         ],
+     900             :         // sigmaz sigmaz
+     901             :         [
+     902             :             [0., 0., 0., 0.],
+     903             :             [0., -2., 0., 0.],
+     904             :             [0., 0., 0., 0.],
+     905             :             [0., 0., 0., -2.],
+     906             :         ],
+     907             :     ],
+     908             : ];
+     909             : 
+     910             : /// OperatePragmaNoise trait creating necessary functions for a PRAGMA noise Operation.
+     911             : impl OperatePragmaNoise for PragmaGeneralNoise {
+     912           1 :     fn superoperator(&self) -> Result<Array2<f64>, RoqoqoError> {
+     913           1 :         let gate_time: f64 = f64::try_from(self.gate_time.clone())?;
+     914             :         // Creating the superoperator that propagates the density matrix in vector form scaled by rate and time
+     915           1 :         let mut superop = Matrix4::<f64>::default();
+     916           3 :         for (i, row) in PGN_SUPEROP.iter().enumerate() {
+     917           9 :             for (j, op) in row.iter().clone().enumerate() {
+     918           9 :                 let tmp_superop: Matrix4<f64> = (*op).into();
+     919           9 :                 superop += gate_time * self.rates[(i, j)] * tmp_superop;
+     920           9 :             }
+     921             :         }
+     922             :         // Integrate superoperator for infinitesimal time to get superoperator for given rate and gate-time
+     923             :         // Use exponential
+     924           1 :         let mut exp_superop: Matrix4<f64> = superop.exp();
+     925           1 :         // transpose because NAlgebra matrix iter is column major
+     926           1 :         exp_superop.transpose_mut();
+     927           1 :         let mut tmp_iter = exp_superop.iter();
+     928           1 :         // convert to ndarray.
+     929          16 :         let array: Array2<f64> = Array::from_shape_simple_fn((4, 4), || *tmp_iter.next().unwrap());
+     930           1 : 
+     931           1 :         Ok(array)
+     932           1 :     }
+     933             : 
+     934             :     /// Returns the gate to the power of `power`.
+     935           0 :     fn powercf(&self, power: CalculatorFloat) -> Self {
+     936           0 :         let mut new = self.clone();
+     937           0 :         new.gate_time = power * self.gate_time.clone();
+     938           0 :         new
+     939           0 :     }
+     940             : }
+     941             : 
+     942             : /// The conditional PRAGMA operation.
+     943             : ///
+     944             : /// This PRAGMA executes a circuit when the condition bit/bool stored in a [crate::registers::BitRegister] is true.
+     945             : ///
+     946          18 : #[derive(Debug, Clone, PartialEq, roqoqo_derive::Operate, roqoqo_derive::OperatePragma)]
+     947             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     948             : pub struct PragmaConditional {
+     949             :     /// The name of the [crate::registers::BitRegister] containting the condition bool value.
+     950             :     condition_register: String,
+     951             :     /// The index in the [crate::registers::BitRegister] containting the condition bool value.
+     952             :     condition_index: usize,
+     953             :     /// The circuit executed if the condition is met.
+     954             :     circuit: Circuit,
+     955             : }
+     956             : 
+     957             : #[allow(non_upper_case_globals)]
+     958             : const TAGS_PragmaConditional: &[&str; 3] = &["Operation", "PragmaOperation", "PragmaConditional"];
+     959             : 
+     960             : // Implementing the InvolveQubits trait for PragmaConditional.
+     961             : impl InvolveQubits for PragmaConditional {
+     962             :     /// Lists all involved qubits.
+     963           1 :     fn involved_qubits(&self) -> InvolvedQubits {
+     964           1 :         self.circuit.involved_qubits()
+     965           1 :     }
+     966             : }
+     967             : 
+     968             : /// Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
+     969             : impl Substitute for PragmaConditional {
+     970             :     /// Remaps qubits in clone of the operation.
+     971           2 :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+     972           2 :         let new_circuit = self.circuit.remap_qubits(mapping).unwrap();
+     973           2 :         Ok(PragmaConditional::new(
+     974           2 :             self.condition_register.clone(),
+     975           2 :             self.condition_index,
+     976           2 :             new_circuit,
+     977           2 :         ))
+     978           2 :     }
+     979             : 
+     980             :     /// Substitutes symbolic parameters in clone of the operation.
+     981           1 :     fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+     982           1 :         let new_circuit = self.circuit.substitute_parameters(calculator).unwrap();
+     983           1 :         Ok(PragmaConditional::new(
+     984           1 :             self.condition_register.clone(),
+     985           1 :             self.condition_index,
+     986           1 :             new_circuit,
+     987           1 :         ))
+     988           1 :     }
+     989             : }
+     990             : 
+     991             : /// A wrapper around backend specific PRAGMA operations capable of changing a device.
+     992             : ///
+     993             : /// This PRAGMA is a thin wrapper around device specific operations that can change
+     994             : /// device properties.
+     995             : ///
+     996             : /// # NOTE
+     997             : ///
+     998             : /// Since this PRAGMA uses serde and bincode to store a representation of the wrapped
+     999             : /// operation internally it is only available when roqoqo is built with the `serialize` feature
+    1000           0 : #[derive(Debug, Clone, PartialEq, roqoqo_derive::OperatePragma)]
+    1001             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1002             : pub struct PragmaChangeDevice {
+    1003             :     /// The tags of the wrapped operation.
+    1004             :     pub wrapped_tags: Vec<String>,
+    1005             :     /// The hqslang name of the wrapped operation.
+    1006             :     pub wrapped_hqslang: String,
+    1007             :     /// Binary representation of the wrapped operation using serde and bincode.
+    1008             :     pub wrapped_operation: Vec<u8>,
+    1009             : }
+    1010             : #[cfg_attr(feature = "dynamic", typetag::serde)]
+    1011             : impl Operate for PragmaChangeDevice {
+    1012           0 :     fn tags(&self) -> &'static [&'static str] {
+    1013           0 :         TAGS_PragmaChangeDevice
+    1014           0 :     }
+    1015           0 :     fn hqslang(&self) -> &'static str {
+    1016           0 :         "PragmaChangeDevice"
+    1017           0 :     }
+    1018           0 :     fn is_parametrized(&self) -> bool {
+    1019           0 :         false
+    1020           0 :     }
+    1021             : }
+    1022             : impl PragmaChangeDevice {
+    1023             :     #[cfg(feature = "serialize")]
+    1024             :     pub fn new<T>(wrapped_pragma: &T) -> Result<Self, RoqoqoError>
+    1025             :     where
+    1026             :         T: Operate,
+    1027             :         T: Serialize,
+    1028             :     {
+    1029             :         Ok(Self {
+    1030             :             wrapped_tags: wrapped_pragma
+    1031             :                 .tags()
+    1032             :                 .iter()
+    1033             :                 .map(|x| x.to_string())
+    1034             :                 .collect(),
+    1035             :             wrapped_hqslang: wrapped_pragma.hqslang().to_string(),
+    1036             :             wrapped_operation: serialize(wrapped_pragma).map_err(|err| {
+    1037             :                 RoqoqoError::SerializationError {
+    1038             :                     msg: format!("{:?}", err),
+    1039             :                 }
+    1040             :             })?,
+    1041             :         })
+    1042             :     }
+    1043             : }
+    1044             : #[allow(non_upper_case_globals)]
+    1045             : const TAGS_PragmaChangeDevice: &[&str; 3] = &["Operation", "PragmaOperation", "PragmaChangeDevice"];
+    1046             : 
+    1047             : // Implementing the InvolveQubits trait for PragmaConditional.
+    1048             : impl InvolveQubits for PragmaChangeDevice {
+    1049             :     /// Lists all involved qubits.
+    1050           0 :     fn involved_qubits(&self) -> InvolvedQubits {
+    1051           0 :         InvolvedQubits::All
+    1052           0 :     }
+    1053             : }
+    1054             : 
+    1055             : /// Substitute trait allowing to replace symbolic parameters and to perform qubit mappings.
+    1056             : impl Substitute for PragmaChangeDevice {
+    1057             :     /// Remaps qubits in clone of the operation.
+    1058             :     /// This is not supported  for PragmaChangeDevice and should throw and error when a non-trivial remapping
+    1059             :     /// is used
+    1060           0 :     fn remap_qubits(&self, mapping: &HashMap<usize, usize>) -> Result<Self, RoqoqoError> {
+    1061           0 :         match mapping.iter().find(|(x, y)| x != y) {
+    1062           0 :             Some((x, _)) => Err(RoqoqoError::QubitMappingError { qubit: *x }),
+    1063           0 :             None => Ok(self.clone()),
+    1064             :         }
+    1065           0 :     }
+    1066             : 
+    1067             :     #[allow(unused_variables)]
+    1068             :     /// Substitutes symbolic parameters in clone of the operation.
+    1069           0 :     fn substitute_parameters(&self, calculator: &mut Calculator) -> Result<Self, RoqoqoError> {
+    1070           0 :         Ok(self.clone())
+    1071           0 :     }
+    1072             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.func-sort-c.html b/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.func-sort-c.html new file mode 100644 index 00000000..91412791 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.func-sort-c.html @@ -0,0 +1,1328 @@ + + + + + + + LCOV - coverage.lcov - src/operations/single_qubit_gate_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - single_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:496496100.0 %
Date:2021-11-09 13:25:48Functions:314314100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::single_qubit_gate_operations::Hadamard as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PauliX as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PauliX as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PauliX as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PauliY as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::PauliY as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PauliY as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PauliY as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis>::spherical_phi1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis>::spherical_theta1
<roqoqo::operations::single_qubit_gate_operations::RotateX as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::RotateX as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::RotateX as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::RotateY as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::RotateY as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::RotateY as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::SGate as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::SGate as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::SGate as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::SGate as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::TGate as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::TGate as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::TGate as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::TGate as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::Hadamard>::new2
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX>::new2
<roqoqo::operations::single_qubit_gate_operations::PauliX as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::PauliX>::new2
<roqoqo::operations::single_qubit_gate_operations::PauliY>::new2
<roqoqo::operations::single_qubit_gate_operations::PauliZ as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::PauliZ>::new2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0>::new2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1>::new2
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis>::new2
<roqoqo::operations::single_qubit_gate_operations::RotateX as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::RotateX>::new2
<roqoqo::operations::single_qubit_gate_operations::RotateY as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::RotateY>::new2
<roqoqo::operations::single_qubit_gate_operations::RotateZ as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::RotateZ>::new2
<roqoqo::operations::single_qubit_gate_operations::SGate>::new2
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate>::new2
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX>::new2
<roqoqo::operations::single_qubit_gate_operations::TGate>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.func.html b/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.func.html new file mode 100644 index 00000000..bdbef82d --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.func.html @@ -0,0 +1,1328 @@ + + + + + + + LCOV - coverage.lcov - src/operations/single_qubit_gate_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - single_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:496496100.0 %
Date:2021-11-09 13:25:48Functions:314314100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::single_qubit_gate_operations::Hadamard as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::Hadamard as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::Hadamard>::new2
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::InvSqrtPauliX>::new2
<roqoqo::operations::single_qubit_gate_operations::PauliX as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::PauliX as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PauliX as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PauliX as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PauliX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PauliX>::new2
<roqoqo::operations::single_qubit_gate_operations::PauliY as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::PauliY as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PauliY as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PauliY as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PauliY as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PauliY>::new2
<roqoqo::operations::single_qubit_gate_operations::PauliZ as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::PauliZ as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PauliZ as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PauliZ>::new2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0 as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState0>::new2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1 as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::PhaseShiftState1>::new2
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis>::new2
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis>::spherical_phi1
<roqoqo::operations::single_qubit_gate_operations::RotateAroundSphericalAxis>::spherical_theta1
<roqoqo::operations::single_qubit_gate_operations::RotateX as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::RotateX as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::RotateX as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::RotateX as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::RotateX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::RotateX>::new2
<roqoqo::operations::single_qubit_gate_operations::RotateY as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::RotateY as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::RotateY as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::RotateY as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::RotateY as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::RotateY>::new2
<roqoqo::operations::single_qubit_gate_operations::RotateZ as core::clone::Clone>::clone2
<roqoqo::operations::single_qubit_gate_operations::RotateZ as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Operate>::is_parametrized2
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::RotateZ as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::RotateZ>::new2
<roqoqo::operations::single_qubit_gate_operations::SGate as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::SGate as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::SGate as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::SGate as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::SGate as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::SGate>::new2
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::SingleQubitGate>::new2
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::SqrtPauliX>::new2
<roqoqo::operations::single_qubit_gate_operations::TGate as core::clone::Clone>::clone1
<roqoqo::operations::single_qubit_gate_operations::TGate as core::cmp::PartialEq>::eq1
<roqoqo::operations::single_qubit_gate_operations::TGate as core::cmp::PartialEq>::ne1
<roqoqo::operations::single_qubit_gate_operations::TGate as core::fmt::Debug>::fmt1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Operate>::tags1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubit>::qubit1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::alpha_i1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::alpha_r1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::beta_i1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::beta_r1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::OperateSingleQubitGate>::global_phase1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::single_qubit_gate_operations::TGate as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::single_qubit_gate_operations::TGate>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.gcov.html b/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.gcov.html new file mode 100644 index 00000000..625fcdcb --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/single_qubit_gate_operations.rs.gcov.html @@ -0,0 +1,1623 @@ + + + + + + + LCOV - coverage.lcov - src/operations/single_qubit_gate_operations.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - single_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:496496100.0 %
Date:2021-11-09 13:25:48Functions:314314100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use ndarray::{array, Array2};
+      14             : use num_complex::Complex64;
+      15             : use qoqo_calculator::CalculatorFloat;
+      16             : use std::convert::TryFrom;
+      17             : use std::f64::consts::PI;
+      18             : 
+      19             : use crate::operations::{
+      20             :     InvolveQubits, InvolvedQubits, Operate, OperateGate, OperateSingleQubit,
+      21             :     OperateSingleQubitGate, Rotate, Substitute,
+      22             : };
+      23             : use crate::RoqoqoError;
+      24             : #[cfg(feature = "overrotate")]
+      25             : use rand_distr::{Distribution, Normal};
+      26             : 
+      27             : /// The most general unitary operation acting on one qubit.
+      28             : ///
+      29             : /// $$ U =e^{i \phi}\begin{pmatrix}
+      30             : /// \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\\\
+      31             : /// \beta_r+i \beta_i & \alpha_r-i\alpha_i
+      32             : /// \end{pmatrix} $$
+      33             : ///
+      34             : /// # Warning
+      35             : ///
+      36             : /// Due to the support of parameterized values it cannot be guaranteed that the unitary matrix of the gate
+      37             : /// is always normalized to one.
+      38             : ///
+      39             : #[derive(
+      40           1 :     Debug,
+      41          45 :     Clone,
+      42          12 :     PartialEq,
+      43           9 :     roqoqo_derive::InvolveQubits,
+      44           2 :     roqoqo_derive::Operate,
+      45           9 :     roqoqo_derive::Substitute,
+      46          78 :     roqoqo_derive::OperateSingleQubit,
+      47             : )]
+      48             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      49             : pub struct SingleQubitGate {
+      50             :     /// The qubit the unitary gate is applied to.
+      51             :     qubit: usize,
+      52             :     /// The real part $ \alpha_r $ of the on-diagonal elements of the single-qubit unitary.
+      53             :     alpha_r: CalculatorFloat,
+      54             :     /// The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary.
+      55             :     alpha_i: CalculatorFloat,
+      56             :     /// The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary.
+      57             :     beta_r: CalculatorFloat,
+      58             :     /// The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary.
+      59             :     beta_i: CalculatorFloat,
+      60             :     /// The global phase $ \phi $ of the single-qubit unitary.
+      61             :     global_phase: CalculatorFloat,
+      62             : }
+      63             : 
+      64             : #[allow(non_upper_case_globals)]
+      65             : const TAGS_SingleQubitGate: &[&str; 4] = &[
+      66             :     "Operation",
+      67             :     "GateOperation",
+      68             :     "SingleQubitGateOperation",
+      69             :     "SingleQubitGate",
+      70             : ];
+      71             : 
+      72             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+      73             : impl OperateGate for SingleQubitGate {
+      74             :     /// Returns unitary matrix of the gate.
+      75             :     ///
+      76             :     /// # Returns
+      77             :     ///
+      78             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+      79             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed or matrix normalization failed.
+      80         118 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+      81         118 :         let alpha_r: f64 = f64::try_from(self.alpha_r())?;
+      82         117 :         let alpha_i: f64 = f64::try_from(self.alpha_i())?;
+      83         117 :         let beta_r: f64 = f64::try_from(self.beta_r())?;
+      84         117 :         let beta_i: f64 = f64::try_from(self.beta_i())?;
+      85         117 :         let global_phase: f64 = f64::try_from(self.global_phase())?;
+      86             :         // before building the unitary matrix, check values of alpha and beta for the matrix to be normalized.
+      87         117 :         if alpha_r == 0.0 && alpha_i == 0.0 && beta_r == 0.0 && beta_i == 0.0
+      88         116 :             || (alpha_r.powf(2.0) + alpha_i.powf(2.0) + beta_r.powf(2.0) + beta_i.powf(2.0) - 1.0)
+      89         116 :                 .abs()
+      90         116 :                 > f64::EPSILON
+      91             :         {
+      92           2 :             let norm: f64 =
+      93           2 :                 alpha_r.powf(2.0) + alpha_i.powf(2.0) + beta_r.powf(2.0) + beta_i.powf(2.0);
+      94           2 :             Err(RoqoqoError::UnitaryMatrixErrror {
+      95           2 :                 alpha_r,
+      96           2 :                 alpha_i,
+      97           2 :                 beta_r,
+      98           2 :                 beta_i,
+      99           2 :                 norm,
+     100           2 :             })
+     101             :         } else {
+     102         116 :             let pref = Complex64::new(0.0, global_phase).exp();
+     103         116 :             Ok(array![
+     104         116 :                 [
+     105         116 :                     pref * Complex64::new(alpha_r, alpha_i),
+     106         116 :                     pref * Complex64::new(-1.0 * beta_r, beta_i)
+     107         116 :                 ],
+     108         116 :                 [
+     109         116 :                     pref * Complex64::new(beta_r, beta_i),
+     110         116 :                     pref * Complex64::new(alpha_r, -1.0 * alpha_i)
+     111         116 :                 ]
+     112         116 :             ])
+     113             :         }
+     114         119 :     }
+     115             : }
+     116             : 
+     117             : /// Trait for unitary operations acting on exactly one qubit.
+     118             : impl OperateSingleQubitGate for SingleQubitGate {
+     119             :     /// Returns the alpha_r parameter of the operation.
+     120             :     ///
+     121             :     /// # Returns
+     122             :     ///
+     123             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     124         168 :     fn alpha_r(&self) -> CalculatorFloat {
+     125         168 :         self.alpha_r.clone()
+     126         168 :     }
+     127             :     /// Returns the alpha_i parameter of the operation.
+     128             :     ///
+     129             :     /// # Returns
+     130             :     ///
+     131             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     132         166 :     fn alpha_i(&self) -> CalculatorFloat {
+     133         166 :         self.alpha_i.clone()
+     134         166 :     }
+     135             :     /// Returns the beta_r parameter of the operation.
+     136             :     ///
+     137             :     /// # Returns
+     138             :     ///
+     139             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     140         168 :     fn beta_r(&self) -> CalculatorFloat {
+     141         168 :         self.beta_r.clone()
+     142         168 :     }
+     143             :     /// Returns the beta_i parameter of the operation.
+     144             :     ///
+     145             :     /// # Returns
+     146             :     ///
+     147             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     148         167 :     fn beta_i(&self) -> CalculatorFloat {
+     149         167 :         self.beta_i.clone()
+     150         167 :     }
+     151             :     /// Returns global_phase parameter of the operation.
+     152             :     ///
+     153             :     /// # Returns
+     154             :     ///
+     155             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     156         164 :     fn global_phase(&self) -> CalculatorFloat {
+     157         164 :         self.global_phase.clone()
+     158         164 :     }
+     159             : }
+     160             : 
+     161             : /// The ZPower gate $e^{-i \frac{\theta}{2} \sigma^z}$.
+     162             : ///
+     163             : /// $$
+     164             : /// U = \begin{pmatrix}
+     165             : /// \cos(\frac{\theta}{2}) & 0\\\\
+     166             : /// 0 & \cos(\frac{\theta}{2})
+     167             : /// \end{pmatrix}
+     168             : ///  + \begin{pmatrix}
+     169             : ///  -i \sin(\frac{\theta}{2}) & 0\\\\
+     170             : /// 0 & i \sin(\frac{\theta}{2})
+     171             : /// \end{pmatrix}
+     172             : /// $$
+     173             : ///
+     174             : #[derive(
+     175           1 :     Debug,
+     176         180 :     Clone,
+     177          55 :     PartialEq,
+     178           9 :     roqoqo_derive::InvolveQubits,
+     179         267 :     roqoqo_derive::Operate,
+     180          21 :     roqoqo_derive::Substitute,
+     181          70 :     roqoqo_derive::OperateSingleQubit,
+     182          14 :     roqoqo_derive::Rotate,
+     183             : )]
+     184             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     185             : pub struct RotateZ {
+     186             :     /// The qubit the unitary gate is applied to.
+     187             :     qubit: usize,
+     188             :     /// The angle $\theta$ of the rotation, in the interval from 0 to $2^* 2 \pi$.
+     189             :     theta: CalculatorFloat,
+     190             : }
+     191             : 
+     192             : #[allow(non_upper_case_globals)]
+     193             : const TAGS_RotateZ: &[&str; 5] = &[
+     194             :     "Operation",
+     195             :     "GateOperation",
+     196             :     "SingleQubitGateOperation",
+     197             :     "Rotation",
+     198             :     "RotateZ",
+     199             : ];
+     200             : 
+     201             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     202             : impl OperateGate for RotateZ {
+     203             :     /// Returns unitary matrix of the gate.
+     204             :     ///
+     205             :     /// # Returns
+     206             :     ///
+     207             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     208             :     /// * `Err(RoqoqoError)` - The conversion of theta to f64 failed.
+     209           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     210           2 :         let c: f64 = (f64::try_from(self.theta.clone())? / 2.0).cos();
+     211           2 :         let s: f64 = (f64::try_from(self.theta.clone())? / 2.0).sin();
+     212           2 :         Ok(array![
+     213           2 :             [Complex64::new(c, -1.0 * s), Complex64::new(0.0, 0.0)],
+     214           2 :             [Complex64::new(0.0, 0.0), Complex64::new(c, s)]
+     215           2 :         ])
+     216           2 :     }
+     217             : }
+     218             : 
+     219             : /// Trait for unitary operations acting on exactly one qubit.
+     220             : impl OperateSingleQubitGate for RotateZ {
+     221             :     /// Returns the alpha_r parameter of the operation.
+     222             :     ///
+     223             :     /// # Returns
+     224             :     ///
+     225             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     226          43 :     fn alpha_r(&self) -> CalculatorFloat {
+     227          43 :         (self.theta.clone() / 2.0).cos()
+     228          43 :     }
+     229             : 
+     230             :     /// Returns the alpha_i parameter of the operation.
+     231             :     ///
+     232             :     /// # Returns
+     233             :     ///
+     234             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     235          43 :     fn alpha_i(&self) -> CalculatorFloat {
+     236          43 :         (self.theta.clone() / 2.0).sin() * (-1.0)
+     237          43 :     }
+     238             : 
+     239             :     /// Returns the beta_r parameter of the operation.
+     240             :     ///
+     241             :     /// # Returns
+     242             :     ///
+     243             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     244          40 :     fn beta_r(&self) -> CalculatorFloat {
+     245          40 :         CalculatorFloat::from(0.0)
+     246          40 :     }
+     247             : 
+     248             :     /// Returns the beta_i parameter of the operation.
+     249             :     ///
+     250             :     /// # Returns
+     251             :     ///
+     252             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     253          40 :     fn beta_i(&self) -> CalculatorFloat {
+     254          40 :         CalculatorFloat::from(0.0)
+     255          40 :     }
+     256             : 
+     257             :     /// Returns global_phase parameter of the operation.
+     258             :     ///
+     259             :     /// # Returns
+     260             :     ///
+     261             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     262          39 :     fn global_phase(&self) -> CalculatorFloat {
+     263          39 :         CalculatorFloat::from(0.0)
+     264          39 :     }
+     265             : }
+     266             : 
+     267             : /// The XPower gate $e^{-i \frac{\theta}{2} \sigma^x}$.
+     268             : ///
+     269             : /// $$
+     270             : /// U = \begin{pmatrix}
+     271             : /// \cos(\frac{\theta}{2}) & 0\\\\
+     272             : /// 0 & \cos(\frac{\theta}{2})
+     273             : /// \end{pmatrix}
+     274             : /// + \begin{pmatrix}
+     275             : /// 0  &  -i \sin(\frac{\theta}{2})   \\\\
+     276             : /// -i \sin(\frac{\theta}{2})  & 0
+     277             : /// \end{pmatrix}
+     278             : ///  $$
+     279             : ///
+     280             : #[derive(
+     281           5 :     Debug,
+     282          74 :     Clone,
+     283          41 :     PartialEq,
+     284          10 :     roqoqo_derive::InvolveQubits,
+     285         164 :     roqoqo_derive::Operate,
+     286          19 :     roqoqo_derive::Substitute,
+     287          23 :     roqoqo_derive::OperateSingleQubit,
+     288          26 :     roqoqo_derive::Rotate,
+     289             : )]
+     290             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     291             : pub struct RotateX {
+     292             :     /// The qubit the unitary gate is applied to.
+     293             :     qubit: usize,
+     294             :     /// The angle $\theta$ of the rotation, in the interval from 0 to $2^* 2 \pi$.
+     295             :     theta: CalculatorFloat,
+     296             : }
+     297             : #[allow(non_upper_case_globals)]
+     298             : const TAGS_RotateX: &[&str; 5] = &[
+     299             :     "Operation",
+     300             :     "GateOperation",
+     301             :     "SingleQubitGateOperation",
+     302             :     "Rotation",
+     303             :     "RotateX",
+     304             : ];
+     305             : 
+     306             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     307             : impl OperateGate for RotateX {
+     308             :     /// Returns unitary matrix of the gate.
+     309             :     ///
+     310             :     /// # Returns
+     311             :     ///
+     312             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     313             :     /// * `Err(RoqoqoError)` - The conversion of theta to f64 failed.
+     314           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     315           2 :         let c: f64 = (f64::try_from(self.theta.clone())? / 2.0).cos();
+     316           2 :         let s: f64 = (f64::try_from(self.theta.clone())? / 2.0).sin();
+     317           2 :         Ok(array![
+     318           2 :             [Complex64::new(c, 0.0), Complex64::new(0.0, -1.0 * s)],
+     319           2 :             [Complex64::new(0.0, -1.0 * s), Complex64::new(c, 0.0)]
+     320           2 :         ])
+     321           2 :     }
+     322             : }
+     323             : 
+     324             : /// Trait for unitary operations acting on exactly one qubit.
+     325             : impl OperateSingleQubitGate for RotateX {
+     326             :     /// Returns the alpha_r parameter of the operation.
+     327             :     ///
+     328             :     /// # Returns
+     329             :     ///
+     330             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     331          29 :     fn alpha_r(&self) -> CalculatorFloat {
+     332          29 :         (self.theta.clone() / 2.0).cos()
+     333          29 :     }
+     334             :     /// Returns the alpha_i parameter of the operation.
+     335             :     ///
+     336             :     /// # Returns
+     337             :     ///
+     338             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     339          26 :     fn alpha_i(&self) -> CalculatorFloat {
+     340          26 :         CalculatorFloat::from(0.0)
+     341          26 :     }
+     342             :     /// Returns the beta_r parameter of the operation.
+     343             :     ///
+     344             :     /// # Returns
+     345             :     ///
+     346             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     347          26 :     fn beta_r(&self) -> CalculatorFloat {
+     348          26 :         CalculatorFloat::from(0.0)
+     349          26 :     }
+     350             :     /// Returns the beta_i parameter of the operation.
+     351             :     ///
+     352             :     /// # Returns
+     353             :     ///
+     354             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     355          29 :     fn beta_i(&self) -> CalculatorFloat {
+     356          29 :         (self.theta.clone() / 2.0).sin() * (-1.0)
+     357          29 :     }
+     358             :     /// Returns global_phase parameter of the operation.
+     359             :     ///
+     360             :     /// # Returns
+     361             :     ///
+     362             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     363          26 :     fn global_phase(&self) -> CalculatorFloat {
+     364          26 :         CalculatorFloat::from(0.0)
+     365          26 :     }
+     366             : }
+     367             : 
+     368             : /// The YPower gate $e^{-i \frac{\theta}{2} \sigma^y}$.
+     369             : ///
+     370             : /// $$
+     371             : /// U = \begin{pmatrix}
+     372             : /// \cos(\frac{\theta}{2}) & 0\\\\
+     373             : /// 0 & \cos(\frac{\theta}{2})
+     374             : /// \end{pmatrix}
+     375             : /// + \begin{pmatrix}
+     376             : /// 0 & - \sin(\frac{\theta}{2})\\\\
+     377             : /// \sin(\frac{\theta}{2}) & 0
+     378             : /// \end{pmatrix}
+     379             : ///  $$
+     380             : ///
+     381             : #[derive(
+     382           1 :     Debug,
+     383          33 :     Clone,
+     384          18 :     PartialEq,
+     385           9 :     roqoqo_derive::InvolveQubits,
+     386          64 :     roqoqo_derive::Operate,
+     387           9 :     roqoqo_derive::Substitute,
+     388          19 :     roqoqo_derive::OperateSingleQubit,
+     389          14 :     roqoqo_derive::Rotate,
+     390             : )]
+     391             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     392             : pub struct RotateY {
+     393             :     /// The qubit the unitary gate is applied to.
+     394             :     qubit: usize,
+     395             :     /// The angle $\theta$ of the rotation, in the interval from 0 to $2^* 2 \pi$.
+     396             :     theta: CalculatorFloat,
+     397             : }
+     398             : #[allow(non_upper_case_globals)]
+     399             : const TAGS_RotateY: &[&str; 5] = &[
+     400             :     "Operation",
+     401             :     "GateOperation",
+     402             :     "SingleQubitGateOperation",
+     403             :     "Rotation",
+     404             :     "RotateY",
+     405             : ];
+     406             : 
+     407             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     408             : impl OperateGate for RotateY {
+     409             :     /// Returns unitary matrix of the gate.
+     410             :     ///
+     411             :     /// # Returns
+     412             :     ///
+     413             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     414             :     /// * `Err(RoqoqoError)` - The conversion of theta to f64 failed.
+     415           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     416           2 :         let c: f64 = (f64::try_from(self.theta.clone())? / 2.0).cos();
+     417           2 :         let s: f64 = (f64::try_from(self.theta.clone())? / 2.0).sin();
+     418           2 :         Ok(array![
+     419           2 :             [Complex64::new(c, 0.0), Complex64::new(-1.0 * s, 0.0)],
+     420           2 :             [Complex64::new(s, 0.0), Complex64::new(c, 0.0)]
+     421           2 :         ])
+     422           2 :     }
+     423             : }
+     424             : 
+     425             : /// Trait for unitary operations acting on exactly one qubit.
+     426             : impl OperateSingleQubitGate for RotateY {
+     427             :     /// Returns the alpha_r parameter of the operation.
+     428             :     ///
+     429             :     /// # Returns
+     430             :     ///
+     431             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     432          14 :     fn alpha_r(&self) -> CalculatorFloat {
+     433          14 :         (self.theta.clone() / 2.0).cos()
+     434          14 :     }
+     435             :     /// Returns the alpha_i parameter of the operation.
+     436             :     ///
+     437             :     /// # Returns
+     438             :     ///
+     439             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     440          11 :     fn alpha_i(&self) -> CalculatorFloat {
+     441          11 :         CalculatorFloat::from(0.0)
+     442          11 :     }
+     443             :     /// Returns the beta_r parameter of the operation.
+     444             :     ///
+     445             :     /// # Returns
+     446             :     ///
+     447             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     448          14 :     fn beta_r(&self) -> CalculatorFloat {
+     449          14 :         (self.theta.clone() / 2.0).sin()
+     450          14 :     }
+     451             :     /// Returns the beta_i parameter of the operation.
+     452             :     ///
+     453             :     /// # Returns
+     454             :     ///
+     455             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     456          11 :     fn beta_i(&self) -> CalculatorFloat {
+     457          11 :         CalculatorFloat::from(0.0)
+     458          11 :     }
+     459             :     /// Returns global_phase parameter of the operation.
+     460             :     ///
+     461             :     /// # Returns
+     462             :     ///
+     463             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     464          11 :     fn global_phase(&self) -> CalculatorFloat {
+     465          11 :         CalculatorFloat::from(0.0)
+     466          11 :     }
+     467             : }
+     468             : 
+     469             : /// The Pauli X gate.
+     470             : ///
+     471             : /// $$
+     472             : /// U = \begin{pmatrix}
+     473             : /// 0 & 1\\\\
+     474             : /// 1 & 0
+     475             : /// \end{pmatrix}
+     476             : /// $$
+     477             : ///
+     478             : #[derive(
+     479           2 :     Debug,
+     480          24 :     Clone,
+     481          22 :     PartialEq,
+     482           5 :     roqoqo_derive::InvolveQubits,
+     483          53 :     roqoqo_derive::Operate,
+     484           9 :     roqoqo_derive::Substitute,
+     485          11 :     roqoqo_derive::OperateSingleQubit,
+     486             : )]
+     487             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     488             : pub struct PauliX {
+     489             :     /// The qubit the unitary gate is applied to.
+     490             :     qubit: usize,
+     491             : }
+     492             : 
+     493             : #[allow(non_upper_case_globals)]
+     494             : const TAGS_PauliX: &[&str; 4] = &[
+     495             :     "Operation",
+     496             :     "GateOperation",
+     497             :     "SingleQubitGateOperation",
+     498             :     "PauliX",
+     499             : ];
+     500             : 
+     501             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     502             : impl OperateGate for PauliX {
+     503             :     /// Returns unitary matrix of the gate.
+     504             :     ///
+     505             :     /// # Returns
+     506             :     ///
+     507             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     508             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+     509           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     510           2 :         Ok(array![
+     511           2 :             [Complex64::new(0.0, 0.0), Complex64::new(1.0, 0.0)],
+     512           2 :             [Complex64::new(1.0, 0.0), Complex64::new(0.0, 0.0)]
+     513           2 :         ])
+     514           2 :     }
+     515             : }
+     516             : 
+     517             : /// Trait for unitary operations acting on exactly one qubit.
+     518             : impl OperateSingleQubitGate for PauliX {
+     519             :     /// Returns the alpha_r parameter of the operation.
+     520             :     ///
+     521             :     /// # Returns
+     522             :     ///
+     523             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     524           5 :     fn alpha_r(&self) -> CalculatorFloat {
+     525           5 :         CalculatorFloat::from(0.0)
+     526           5 :     }
+     527             :     /// Returns the alpha_i parameter of the operation.
+     528             :     ///
+     529             :     /// # Returns
+     530             :     ///
+     531             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     532           5 :     fn alpha_i(&self) -> CalculatorFloat {
+     533           5 :         CalculatorFloat::from(0.0)
+     534           5 :     }
+     535             :     /// Returns the beta_r parameter of the operation.
+     536             :     ///
+     537             :     /// # Returns
+     538             :     ///
+     539             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     540           5 :     fn beta_r(&self) -> CalculatorFloat {
+     541           5 :         CalculatorFloat::from(0.0)
+     542           5 :     }
+     543             :     /// Returns the beta_i parameter of the operation.
+     544             :     ///
+     545             :     /// # Returns
+     546             :     ///
+     547             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     548           5 :     fn beta_i(&self) -> CalculatorFloat {
+     549           5 :         CalculatorFloat::from(-1.0)
+     550           5 :     }
+     551             :     /// Returns global_phase parameter of the operation.
+     552             :     ///
+     553             :     /// # Returns
+     554             :     ///
+     555             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     556           5 :     fn global_phase(&self) -> CalculatorFloat {
+     557           5 :         CalculatorFloat::from((PI) / 2.0)
+     558           5 :     }
+     559             : }
+     560             : 
+     561             : /// The Pauli Y gate.
+     562             : ///
+     563             : /// $$
+     564             : /// U = \begin{pmatrix}
+     565             : /// 0 & -i\\\\
+     566             : /// i & 0
+     567             : /// \end{pmatrix}
+     568             : /// $$
+     569             : ///
+     570             : #[derive(
+     571           1 :     Debug,
+     572           8 :     Clone,
+     573           8 :     PartialEq,
+     574           3 :     roqoqo_derive::InvolveQubits,
+     575          29 :     roqoqo_derive::Operate,
+     576           3 :     roqoqo_derive::Substitute,
+     577          11 :     roqoqo_derive::OperateSingleQubit,
+     578             : )]
+     579             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     580             : pub struct PauliY {
+     581             :     /// The qubit the unitary gate is applied to.
+     582             :     qubit: usize,
+     583             : }
+     584             : 
+     585             : #[allow(non_upper_case_globals)]
+     586             : const TAGS_PauliY: &[&str; 4] = &[
+     587             :     "Operation",
+     588             :     "GateOperation",
+     589             :     "SingleQubitGateOperation",
+     590             :     "PauliY",
+     591             : ];
+     592             : 
+     593             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     594             : impl OperateGate for PauliY {
+     595             :     /// Returns unitary matrix of the gate.
+     596             :     ///
+     597             :     /// # Returns
+     598             :     ///
+     599             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     600             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+     601           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     602           2 :         Ok(array![
+     603           2 :             [Complex64::new(0.0, 0.0), Complex64::new(0.0, -1.0)],
+     604           2 :             [Complex64::new(0.0, 1.0), Complex64::new(0.0, 0.0)]
+     605           2 :         ])
+     606           2 :     }
+     607             : }
+     608             : 
+     609             : /// Trait for unitary operations acting on exactly one qubit.
+     610             : impl OperateSingleQubitGate for PauliY {
+     611             :     /// Returns the alpha_r parameter of the operation.
+     612             :     ///
+     613             :     /// # Returns
+     614             :     ///
+     615             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     616           5 :     fn alpha_r(&self) -> CalculatorFloat {
+     617           5 :         CalculatorFloat::from(0.0)
+     618           5 :     }
+     619             :     /// Returns the alpha_i parameter of the operation.
+     620             :     ///
+     621             :     /// # Returns
+     622             :     ///
+     623             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     624           5 :     fn alpha_i(&self) -> CalculatorFloat {
+     625           5 :         CalculatorFloat::from(0.0)
+     626           5 :     }
+     627             :     /// Returns the beta_r parameter of the operation.
+     628             :     ///
+     629             :     /// # Returns
+     630             :     ///
+     631             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     632           5 :     fn beta_r(&self) -> CalculatorFloat {
+     633           5 :         CalculatorFloat::from(1.0)
+     634           5 :     }
+     635             :     /// Returns the beta_i parameter of the operation.
+     636             :     ///
+     637             :     /// # Returns
+     638             :     ///
+     639             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     640           5 :     fn beta_i(&self) -> CalculatorFloat {
+     641           5 :         CalculatorFloat::from(0.0)
+     642           5 :     }
+     643             :     /// Returns global_phase parameter of the operation.
+     644             :     ///
+     645             :     /// # Returns
+     646             :     ///
+     647             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     648           5 :     fn global_phase(&self) -> CalculatorFloat {
+     649           5 :         CalculatorFloat::from(PI / 2.0)
+     650           5 :     }
+     651             : }
+     652             : 
+     653             : /// The Pauli Z gate.
+     654             : ///
+     655             : /// $$
+     656             : /// U = \begin{pmatrix}
+     657             : /// 1 & 0 \\\\
+     658             : /// 0 & -1
+     659             : /// \end{pmatrix}
+     660             : /// $$
+     661             : ///
+     662             : #[derive(
+     663           4 :     Debug,
+     664          21 :     Clone,
+     665          18 :     PartialEq,
+     666           3 :     roqoqo_derive::InvolveQubits,
+     667          34 :     roqoqo_derive::Operate,
+     668           3 :     roqoqo_derive::Substitute,
+     669           8 :     roqoqo_derive::OperateSingleQubit,
+     670             : )]
+     671             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     672             : pub struct PauliZ {
+     673             :     /// The qubit the unitary gate is applied to.
+     674             :     qubit: usize,
+     675             : }
+     676             : 
+     677             : #[allow(non_upper_case_globals)]
+     678             : const TAGS_PauliZ: &[&str; 4] = &[
+     679             :     "Operation",
+     680             :     "GateOperation",
+     681             :     "SingleQubitGateOperation",
+     682             :     "PauliZ",
+     683             : ];
+     684             : 
+     685             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     686             : impl OperateGate for PauliZ {
+     687             :     /// Returns unitary matrix of the gate.
+     688             :     ///
+     689             :     /// # Returns
+     690             :     ///
+     691             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     692             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+     693           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     694           2 :         Ok(array![
+     695           2 :             [Complex64::new(1.0, 0.0), Complex64::new(0.0, 0.0)],
+     696           2 :             [Complex64::new(0.0, 0.0), Complex64::new(-1.0, 0.0)]
+     697           2 :         ])
+     698           2 :     }
+     699             : }
+     700             : 
+     701             : /// Trait for unitary operations acting on exactly one qubit.
+     702             : impl OperateSingleQubitGate for PauliZ {
+     703             :     /// Returns the alpha_r parameter of the operation.
+     704             :     ///
+     705             :     /// # Returns
+     706             :     ///
+     707             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     708           5 :     fn alpha_r(&self) -> CalculatorFloat {
+     709           5 :         CalculatorFloat::from(0.0)
+     710           5 :     }
+     711             :     /// Returns the alpha_i parameter of the operation.
+     712             :     ///
+     713             :     /// # Returns
+     714             :     ///
+     715             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     716           5 :     fn alpha_i(&self) -> CalculatorFloat {
+     717           5 :         CalculatorFloat::from(-1.0)
+     718           5 :     }
+     719             :     /// Returns the beta_r parameter of the operation.
+     720             :     ///
+     721             :     /// # Returns
+     722             :     ///
+     723             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     724           5 :     fn beta_r(&self) -> CalculatorFloat {
+     725           5 :         CalculatorFloat::from(0.0)
+     726           5 :     }
+     727             :     /// Returns the beta_i parameter of the operation.
+     728             :     ///
+     729             :     /// # Returns
+     730             :     ///
+     731             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     732           5 :     fn beta_i(&self) -> CalculatorFloat {
+     733           5 :         CalculatorFloat::from(0.0)
+     734           5 :     }
+     735             :     /// Returns global_phase parameter of the operation.
+     736             :     ///
+     737             :     /// # Returns
+     738             :     ///
+     739             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     740           5 :     fn global_phase(&self) -> CalculatorFloat {
+     741           5 :         CalculatorFloat::from(PI / 2.0)
+     742           5 :     }
+     743             : }
+     744             : 
+     745             : /// The square root of the XPower gate: $e^{-i \frac{\pi}{4} \sigma^x}$.
+     746             : ///
+     747             : /// $$
+     748             : /// U = \frac{1}{\sqrt(2)}\begin{pmatrix}
+     749             : /// 1 & -i \\\\
+     750             : /// -i & 1
+     751             : /// \end{pmatrix}
+     752             : /// $$
+     753             : ///
+     754             : #[derive(
+     755           1 :     Debug,
+     756           8 :     Clone,
+     757           8 :     PartialEq,
+     758           3 :     roqoqo_derive::InvolveQubits,
+     759          25 :     roqoqo_derive::Operate,
+     760           3 :     roqoqo_derive::Substitute,
+     761           3 :     roqoqo_derive::OperateSingleQubit,
+     762             : )]
+     763             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     764             : pub struct SqrtPauliX {
+     765             :     /// The qubit the unitary gate is applied to.
+     766             :     qubit: usize,
+     767             : }
+     768             : 
+     769             : #[allow(non_upper_case_globals)]
+     770             : const TAGS_SqrtPauliX: &[&str; 4] = &[
+     771             :     "Operation",
+     772             :     "GateOperation",
+     773             :     "SingleQubitGateOperation",
+     774             :     "SqrtPauliX",
+     775             : ];
+     776             : 
+     777             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     778             : impl OperateGate for SqrtPauliX {
+     779             :     /// Returns unitary matrix of the gate.
+     780             :     ///
+     781             :     /// # Returns
+     782             :     ///
+     783             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     784             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+     785           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     786           2 :         let theta: f64 = PI / 2.0;
+     787           2 :         let c: f64 = (theta / 2.0).cos();
+     788           2 :         let s: f64 = (theta / 2.0).sin();
+     789           2 :         Ok(array![
+     790           2 :             [Complex64::new(c, 0.0), Complex64::new(0.0, -1.0 * s)],
+     791           2 :             [Complex64::new(0.0, -1.0 * s), Complex64::new(c, 0.0)]
+     792           2 :         ])
+     793           2 :     }
+     794             : }
+     795             : 
+     796             : /// Trait for unitary operations acting on exactly one qubit.
+     797             : impl OperateSingleQubitGate for SqrtPauliX {
+     798             :     /// Returns the alpha_r parameter of the operation.
+     799             :     ///
+     800             :     /// # Returns
+     801             :     ///
+     802             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     803           2 :     fn alpha_r(&self) -> CalculatorFloat {
+     804           2 :         CalculatorFloat::from((PI / 4.0).cos())
+     805           2 :     }
+     806             :     /// Returns the alpha_i parameter of the operation.
+     807             :     ///
+     808             :     /// # Returns
+     809             :     ///
+     810             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     811           2 :     fn alpha_i(&self) -> CalculatorFloat {
+     812           2 :         CalculatorFloat::from(0.0)
+     813           2 :     }
+     814             :     /// Returns the beta_r parameter of the operation.
+     815             :     ///
+     816             :     /// # Returns
+     817             :     ///
+     818             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     819           2 :     fn beta_r(&self) -> CalculatorFloat {
+     820           2 :         CalculatorFloat::from(0.0)
+     821           2 :     }
+     822             :     /// Returns the beta_i parameter of the operation.
+     823             :     ///
+     824             :     /// # Returns
+     825             :     ///
+     826             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     827           2 :     fn beta_i(&self) -> CalculatorFloat {
+     828           2 :         CalculatorFloat::from((PI / 4.0).sin() * (-1.0))
+     829           2 :     }
+     830             :     /// Returns global_phase parameter of the operation.
+     831             :     ///
+     832             :     /// # Returns
+     833             :     ///
+     834             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     835           2 :     fn global_phase(&self) -> CalculatorFloat {
+     836           2 :         CalculatorFloat::from(0.0)
+     837           2 :     }
+     838             : }
+     839             : 
+     840             : /// The inverse square root of the XPower gate: $e^{i \frac{\pi}{2} \sigma^x}$.
+     841             : ///
+     842             : /// $$
+     843             : /// U = \frac{1}{\sqrt{2}} \begin{pmatrix}
+     844             : /// 1 & i \\\\
+     845             : ///  i & 1
+     846             : /// \end{pmatrix}
+     847             : /// $$
+     848             : ///
+     849             : #[derive(
+     850           1 :     Debug,
+     851           8 :     Clone,
+     852           8 :     PartialEq,
+     853           3 :     roqoqo_derive::InvolveQubits,
+     854          25 :     roqoqo_derive::Operate,
+     855           3 :     roqoqo_derive::Substitute,
+     856           3 :     roqoqo_derive::OperateSingleQubit,
+     857             : )]
+     858             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     859             : pub struct InvSqrtPauliX {
+     860             :     /// The qubit the unitary gate is applied to.
+     861             :     qubit: usize,
+     862             : }
+     863             : 
+     864             : #[allow(non_upper_case_globals)]
+     865             : const TAGS_InvSqrtPauliX: &[&str; 4] = &[
+     866             :     "Operation",
+     867             :     "GateOperation",
+     868             :     "SingleQubitGateOperation",
+     869             :     "InvSqrtPauliX",
+     870             : ];
+     871             : 
+     872             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     873             : impl OperateGate for InvSqrtPauliX {
+     874             :     /// Returns unitary matrix of the gate.
+     875             :     ///
+     876             :     /// # Returns
+     877             :     ///
+     878             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     879             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+     880           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     881           2 :         let theta: f64 = PI / 2.0;
+     882           2 :         let c: f64 = (theta / 2.0).cos();
+     883           2 :         let s: f64 = (theta / 2.0).sin();
+     884           2 :         Ok(array![
+     885           2 :             [Complex64::new(c, 0.0), Complex64::new(0.0, 1.0 * s)],
+     886           2 :             [Complex64::new(0.0, 1.0 * s), Complex64::new(c, 0.0)]
+     887           2 :         ])
+     888           2 :     }
+     889             : }
+     890             : 
+     891             : /// Trait for unitary operations acting on exactly one qubit.
+     892             : impl OperateSingleQubitGate for InvSqrtPauliX {
+     893             :     /// Returns the alpha_r parameter of the operation.
+     894             :     ///
+     895             :     /// # Returns
+     896             :     ///
+     897             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     898           2 :     fn alpha_r(&self) -> CalculatorFloat {
+     899           2 :         CalculatorFloat::from((PI / 4.0).cos())
+     900           2 :     }
+     901             :     /// Returns the alpha_i parameter of the operation.
+     902             :     ///
+     903             :     /// # Returns
+     904             :     ///
+     905             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     906           2 :     fn alpha_i(&self) -> CalculatorFloat {
+     907           2 :         CalculatorFloat::from(0.0)
+     908           2 :     }
+     909             :     /// Returns the beta_r parameter of the operation.
+     910             :     ///
+     911             :     /// # Returns
+     912             :     ///
+     913             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+     914           2 :     fn beta_r(&self) -> CalculatorFloat {
+     915           2 :         CalculatorFloat::from(0.0)
+     916           2 :     }
+     917             :     /// Returns the beta_i parameter of the operation.
+     918             :     ///
+     919             :     /// # Returns
+     920             :     ///
+     921             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+     922           2 :     fn beta_i(&self) -> CalculatorFloat {
+     923           2 :         CalculatorFloat::from((PI / 4.0).sin())
+     924           2 :     }
+     925             :     /// Returns global_phase parameter of the operation.
+     926             :     ///
+     927             :     /// # Returns
+     928             :     ///
+     929             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+     930           2 :     fn global_phase(&self) -> CalculatorFloat {
+     931           2 :         CalculatorFloat::from(0.0)
+     932           2 :     }
+     933             : }
+     934             : 
+     935             : /// The Hadamard gate.
+     936             : ///
+     937             : /// $$
+     938             : /// U = \frac{1}{\sqrt{2}} \begin{pmatrix}
+     939             : /// 1 & 1\\\\
+     940             : ///  1 & -1
+     941             : /// \end{pmatrix}
+     942             : /// $$
+     943             : ///
+     944             : #[derive(
+     945           1 :     Debug,
+     946           8 :     Clone,
+     947          18 :     PartialEq,
+     948           3 :     roqoqo_derive::InvolveQubits,
+     949          46 :     roqoqo_derive::Operate,
+     950           3 :     roqoqo_derive::Substitute,
+     951           3 :     roqoqo_derive::OperateSingleQubit,
+     952             : )]
+     953             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     954             : pub struct Hadamard {
+     955             :     /// The qubit the unitary gate is applied to.
+     956             :     qubit: usize,
+     957             : }
+     958             : 
+     959             : #[allow(non_upper_case_globals)]
+     960             : const TAGS_Hadamard: &[&str; 4] = &[
+     961             :     "Operation",
+     962             :     "GateOperation",
+     963             :     "SingleQubitGateOperation",
+     964             :     "Hadamard",
+     965             : ];
+     966             : 
+     967             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+     968             : impl OperateGate for Hadamard {
+     969             :     /// Returns unitary matrix of the gate.
+     970             :     ///
+     971             :     /// # Returns
+     972             :     ///
+     973             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     974             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+     975           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     976           2 :         let f: f64 = 1.0 / ((2.0_f64).sqrt());
+     977           2 :         Ok(array![
+     978           2 :             [Complex64::new(f, 0.0), Complex64::new(f, 0.0)],
+     979           2 :             [Complex64::new(f, 0.0), Complex64::new(-1.0 * f, 0.0)]
+     980           2 :         ])
+     981           2 :     }
+     982             : }
+     983             : 
+     984             : /// Trait for unitary operations acting on exactly one qubit.
+     985             : impl OperateSingleQubitGate for Hadamard {
+     986             :     /// Returns the alpha_r parameter of the operation.
+     987             :     ///
+     988             :     /// # Returns
+     989             :     ///
+     990             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+     991           3 :     fn alpha_r(&self) -> CalculatorFloat {
+     992           3 :         CalculatorFloat::from(0.0)
+     993           3 :     }
+     994             :     /// Returns the alpha_i parameter of the operation.
+     995             :     ///
+     996             :     /// # Returns
+     997             :     ///
+     998             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+     999           3 :     fn alpha_i(&self) -> CalculatorFloat {
+    1000           3 :         CalculatorFloat::from(-1.0 / ((2.0_f64).sqrt()))
+    1001           3 :     }
+    1002             :     /// Returns the beta_r parameter of the operation.
+    1003             :     ///
+    1004             :     /// # Returns
+    1005             :     ///
+    1006             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1007           3 :     fn beta_r(&self) -> CalculatorFloat {
+    1008           3 :         CalculatorFloat::from(0.0)
+    1009           3 :     }
+    1010             :     /// Returns the beta_i parameter of the operation.
+    1011             :     ///
+    1012             :     /// # Returns
+    1013             :     ///
+    1014             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1015           3 :     fn beta_i(&self) -> CalculatorFloat {
+    1016           3 :         CalculatorFloat::from(-1.0 / ((2.0_f64).sqrt()))
+    1017           3 :     }
+    1018             :     /// Returns global_phase parameter of the operation.
+    1019             :     ///
+    1020             :     /// # Returns
+    1021             :     ///
+    1022             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+    1023           2 :     fn global_phase(&self) -> CalculatorFloat {
+    1024           2 :         CalculatorFloat::from(PI / 2.0)
+    1025           2 :     }
+    1026             : }
+    1027             : 
+    1028             : /// The S gate.
+    1029             : ///
+    1030             : /// $$
+    1031             : /// U = \frac{1}{\sqrt{2}} \begin{pmatrix}
+    1032             : /// 1 & 0\\\\
+    1033             : ///  0 & i
+    1034             : /// \end{pmatrix}
+    1035             : /// $$
+    1036             : ///
+    1037             : #[derive(
+    1038           1 :     Debug,
+    1039           8 :     Clone,
+    1040           8 :     PartialEq,
+    1041           3 :     roqoqo_derive::InvolveQubits,
+    1042          25 :     roqoqo_derive::Operate,
+    1043           3 :     roqoqo_derive::Substitute,
+    1044           3 :     roqoqo_derive::OperateSingleQubit,
+    1045             : )]
+    1046             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1047             : pub struct SGate {
+    1048             :     /// The qubit the unitary gate is applied to.
+    1049             :     qubit: usize,
+    1050             : }
+    1051             : 
+    1052             : #[allow(non_upper_case_globals)]
+    1053             : const TAGS_SGate: &[&str; 4] = &[
+    1054             :     "Operation",
+    1055             :     "GateOperation",
+    1056             :     "SingleQubitGateOperation",
+    1057             :     "SGate",
+    1058             : ];
+    1059             : 
+    1060             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+    1061             : impl OperateGate for SGate {
+    1062             :     /// Returns unitary matrix of the gate.
+    1063             :     ///
+    1064             :     /// # Returns
+    1065             :     ///
+    1066             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1067             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+    1068           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1069           2 :         Ok(array![
+    1070           2 :             [Complex64::new(1.0, 0.0), Complex64::new(0.0, 0.0)],
+    1071           2 :             [Complex64::new(0.0, 0.0), Complex64::new(0.0, 1.0)]
+    1072           2 :         ])
+    1073           2 :     }
+    1074             : }
+    1075             : 
+    1076             : /// Trait for unitary operations acting on exactly one qubit.
+    1077             : impl OperateSingleQubitGate for SGate {
+    1078             :     /// Returns the alpha_r parameter of the operation.
+    1079             :     ///
+    1080             :     /// # Returns
+    1081             :     ///
+    1082             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+    1083           2 :     fn alpha_r(&self) -> CalculatorFloat {
+    1084           2 :         CalculatorFloat::from(1.0 / ((2.0_f64).sqrt()))
+    1085           2 :     }
+    1086             :     /// Returns the alpha_i parameter of the operation.
+    1087             :     ///
+    1088             :     /// # Returns
+    1089             :     ///
+    1090             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+    1091           2 :     fn alpha_i(&self) -> CalculatorFloat {
+    1092           2 :         CalculatorFloat::from(-1.0 / ((2.0_f64).sqrt()))
+    1093           2 :     }
+    1094             :     /// Returns the beta_r parameter of the operation.
+    1095             :     ///
+    1096             :     /// # Returns
+    1097             :     ///
+    1098             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1099           2 :     fn beta_r(&self) -> CalculatorFloat {
+    1100           2 :         CalculatorFloat::from(0.0)
+    1101           2 :     }
+    1102             :     /// Returns the beta_i parameter of the operation.
+    1103             :     ///
+    1104             :     /// # Returns
+    1105             :     ///
+    1106             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1107           2 :     fn beta_i(&self) -> CalculatorFloat {
+    1108           2 :         CalculatorFloat::from(0.0)
+    1109           2 :     }
+    1110             :     /// Returns global_phase parameter of the operation.
+    1111             :     ///
+    1112             :     /// # Returns
+    1113             :     ///
+    1114             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+    1115           2 :     fn global_phase(&self) -> CalculatorFloat {
+    1116           2 :         CalculatorFloat::from(PI / 4.0)
+    1117           2 :     }
+    1118             : }
+    1119             : 
+    1120             : /// The T gate.
+    1121             : ///
+    1122             : /// $$
+    1123             : /// U = \frac{1}{\sqrt{2}} \begin{pmatrix}
+    1124             : /// 1 & 0\\\\
+    1125             : ///  0 & e^{i \frac{\pi}{4}}
+    1126             : /// \end{pmatrix}
+    1127             : /// $$
+    1128             : ///
+    1129             : #[derive(
+    1130           1 :     Debug,
+    1131           8 :     Clone,
+    1132           8 :     PartialEq,
+    1133           3 :     roqoqo_derive::InvolveQubits,
+    1134          25 :     roqoqo_derive::Operate,
+    1135           3 :     roqoqo_derive::Substitute,
+    1136           3 :     roqoqo_derive::OperateSingleQubit,
+    1137             : )]
+    1138             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1139             : pub struct TGate {
+    1140             :     /// The qubit the unitary gate is applied to.
+    1141             :     qubit: usize,
+    1142             : }
+    1143             : 
+    1144             : #[allow(non_upper_case_globals)]
+    1145             : const TAGS_TGate: &[&str; 4] = &[
+    1146             :     "Operation",
+    1147             :     "GateOperation",
+    1148             :     "SingleQubitGateOperation",
+    1149             :     "TGate",
+    1150             : ];
+    1151             : 
+    1152             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+    1153             : impl OperateGate for TGate {
+    1154             :     /// Returns unitary matrix of the gate.
+    1155             :     ///
+    1156             :     /// # Returns
+    1157             :     ///
+    1158             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1159             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+    1160           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1161           2 :         Ok(array![
+    1162           2 :             [Complex64::new(1.0, 0.0), Complex64::new(0.0, 0.0)],
+    1163           2 :             [
+    1164           2 :                 Complex64::new(0.0, 0.0),
+    1165           2 :                 Complex64::new((PI / 4.0).cos(), (PI / 4.0).sin())
+    1166           2 :             ] //exp(i*pi/4) = cos(pi/4) + i*sin(pi/4)
+    1167           2 :         ])
+    1168           2 :     }
+    1169             : }
+    1170             : 
+    1171             : /// Trait for unitary operations acting on exactly one qubit.
+    1172             : impl OperateSingleQubitGate for TGate {
+    1173             :     /// Returns the alpha_r parameter of the operation.
+    1174             :     ///
+    1175             :     /// # Returns
+    1176             :     ///
+    1177             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+    1178           2 :     fn alpha_r(&self) -> CalculatorFloat {
+    1179           2 :         CalculatorFloat::from((PI / 8.0).cos())
+    1180           2 :     }
+    1181             :     /// Returns the alpha_i parameter of the operation.
+    1182             :     ///
+    1183             :     /// # Returns
+    1184             :     ///
+    1185             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+    1186           2 :     fn alpha_i(&self) -> CalculatorFloat {
+    1187           2 :         CalculatorFloat::from((-1.0) * (PI / 8.0).sin())
+    1188           2 :     }
+    1189             :     /// Returns the beta_r parameter of the operation.
+    1190             :     ///
+    1191             :     /// # Returns
+    1192             :     ///
+    1193             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1194           2 :     fn beta_r(&self) -> CalculatorFloat {
+    1195           2 :         CalculatorFloat::from(0.0)
+    1196           2 :     }
+    1197             :     /// Returns the beta_i parameter of the operation.
+    1198             :     ///
+    1199             :     /// # Returns
+    1200             :     ///
+    1201             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1202           2 :     fn beta_i(&self) -> CalculatorFloat {
+    1203           2 :         CalculatorFloat::from(0.0)
+    1204           2 :     }
+    1205             :     /// Returns global_phase parameter of the operation.
+    1206             :     ///
+    1207             :     /// # Returns
+    1208             :     ///
+    1209             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+    1210           2 :     fn global_phase(&self) -> CalculatorFloat {
+    1211           2 :         CalculatorFloat::from(PI / 8.0)
+    1212           2 :     }
+    1213             : }
+    1214             : 
+    1215             : /// The phase shift gate applied on state |1>.
+    1216             : ///
+    1217             : /// Rotation around Z-axis by an arbitrary angle $\theta$ (AC Stark shift of the state |1>).
+    1218             : ///
+    1219             : /// $$
+    1220             : /// U = \begin{pmatrix}
+    1221             : /// 1 & 0\\\\
+    1222             : ///  0 & e^{i \theta}
+    1223             : /// \end{pmatrix}
+    1224             : /// $$
+    1225             : ///
+    1226             : #[derive(
+    1227           1 :     Debug,
+    1228           9 :     Clone,
+    1229          10 :     PartialEq,
+    1230           3 :     roqoqo_derive::InvolveQubits,
+    1231          35 :     roqoqo_derive::Operate,
+    1232           5 :     roqoqo_derive::Substitute,
+    1233           3 :     roqoqo_derive::OperateSingleQubit,
+    1234          19 :     roqoqo_derive::Rotate,
+    1235             : )]
+    1236             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1237             : pub struct PhaseShiftState1 {
+    1238             :     /// The qubit the unitary gate is applied to.
+    1239             :     qubit: usize,
+    1240             :     /// The angle $\theta$ of the rotation, in the interval from 0 to $2 \pi$.
+    1241             :     theta: CalculatorFloat,
+    1242             : }
+    1243             : 
+    1244             : #[allow(non_upper_case_globals)]
+    1245             : const TAGS_PhaseShiftState1: &[&str; 5] = &[
+    1246             :     "Operation",
+    1247             :     "GateOperation",
+    1248             :     "SingleQubitGateOperation",
+    1249             :     "Rotation",
+    1250             :     "PhaseShiftState1",
+    1251             : ];
+    1252             : 
+    1253             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+    1254             : impl OperateGate for PhaseShiftState1 {
+    1255             :     /// Returns unitary matrix of the gate.
+    1256             :     ///
+    1257             :     /// # Returns
+    1258             :     ///
+    1259             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1260             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+    1261           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1262           2 :         let theta: f64 = f64::try_from(self.theta().clone())?;
+    1263           2 :         Ok(array![
+    1264           2 :             [Complex64::new(1.0, 0.0), Complex64::new(0.0, 0.0)],
+    1265           2 :             [
+    1266           2 :                 Complex64::new(0.0, 0.0),
+    1267           2 :                 Complex64::new(theta.cos(), theta.sin())
+    1268           2 :             ]
+    1269           2 :         ])
+    1270           2 :     }
+    1271             : }
+    1272             : 
+    1273             : /// Trait for unitary operations acting on exactly one qubit.
+    1274             : impl OperateSingleQubitGate for PhaseShiftState1 {
+    1275             :     /// Returns the alpha_r parameter of the operation.
+    1276             :     ///
+    1277             :     /// # Returns
+    1278             :     ///
+    1279             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+    1280           3 :     fn alpha_r(&self) -> CalculatorFloat {
+    1281           3 :         (self.theta().clone() / 2.0).cos()
+    1282           3 :     }
+    1283             :     /// Returns the alpha_i parameter of the operation.
+    1284             :     ///
+    1285             :     /// # Returns
+    1286             :     ///
+    1287             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+    1288           3 :     fn alpha_i(&self) -> CalculatorFloat {
+    1289           3 :         (self.theta().clone() / 2.0).sin() * (-1.0)
+    1290           3 :     }
+    1291             :     /// Returns the beta_r parameter of the operation.
+    1292             :     ///
+    1293             :     /// # Returns
+    1294             :     ///
+    1295             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1296           3 :     fn beta_r(&self) -> CalculatorFloat {
+    1297           3 :         CalculatorFloat::from(0.0)
+    1298           3 :     }
+    1299             :     /// Returns the beta_i parameter of the operation.
+    1300             :     ///
+    1301             :     /// # Returns
+    1302             :     ///
+    1303             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1304           3 :     fn beta_i(&self) -> CalculatorFloat {
+    1305           3 :         CalculatorFloat::from(0.0)
+    1306           3 :     }
+    1307             :     /// Returns global_phase parameter of the operation.
+    1308             :     ///
+    1309             :     /// # Returns
+    1310             :     ///
+    1311             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+    1312           3 :     fn global_phase(&self) -> CalculatorFloat {
+    1313           3 :         self.theta().clone() / 2.0
+    1314           3 :     }
+    1315             : }
+    1316             : 
+    1317             : /// The phase shift gate applied on state |0>.
+    1318             : ///
+    1319             : /// Rotation around Z-axis by an arbitrary angle $\theta$ (AC Stark shift of the state |0>).
+    1320             : ///
+    1321             : /// $$
+    1322             : /// U = \begin{pmatrix}
+    1323             : /// e^{i \theta} & 0\\\\
+    1324             : ///  0 & 1
+    1325             : /// \end{pmatrix}
+    1326             : /// $$
+    1327             : ///
+    1328             : #[derive(
+    1329           1 :     Debug,
+    1330           9 :     Clone,
+    1331          10 :     PartialEq,
+    1332           3 :     roqoqo_derive::InvolveQubits,
+    1333          35 :     roqoqo_derive::Operate,
+    1334           5 :     roqoqo_derive::Substitute,
+    1335           3 :     roqoqo_derive::OperateSingleQubit,
+    1336          19 :     roqoqo_derive::Rotate,
+    1337             : )]
+    1338             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1339             : pub struct PhaseShiftState0 {
+    1340             :     /// The qubit the unitary gate is applied to.
+    1341             :     qubit: usize,
+    1342             :     /// The angle $\theta$ of the rotation, in the interval from 0 to $2 \pi$.
+    1343             :     theta: CalculatorFloat,
+    1344             : }
+    1345             : 
+    1346             : #[allow(non_upper_case_globals)]
+    1347             : const TAGS_PhaseShiftState0: &[&str; 5] = &[
+    1348             :     "Operation",
+    1349             :     "GateOperation",
+    1350             :     "SingleQubitGateOperation",
+    1351             :     "Rotation",
+    1352             :     "PhaseShiftState0",
+    1353             : ];
+    1354             : 
+    1355             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+    1356             : impl OperateGate for PhaseShiftState0 {
+    1357             :     /// Returns unitary matrix of the gate.
+    1358             :     ///
+    1359             :     /// # Returns
+    1360             :     ///
+    1361             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1362             :     /// * `Err(RoqoqoError)` - The parameter conversion to f64 failed (here, not possible).
+    1363           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1364           2 :         let theta: f64 = f64::try_from(self.theta().clone())?;
+    1365           2 :         Ok(array![
+    1366           2 :             [
+    1367           2 :                 Complex64::new(theta.cos(), theta.sin()),
+    1368           2 :                 Complex64::new(0.0, 0.0)
+    1369           2 :             ],
+    1370           2 :             [Complex64::new(0.0, 0.0), Complex64::new(1.0, 0.0)]
+    1371           2 :         ])
+    1372           2 :     }
+    1373             : }
+    1374             : 
+    1375             : /// Trait for unitary operations acting on exactly one qubit.
+    1376             : impl OperateSingleQubitGate for PhaseShiftState0 {
+    1377             :     /// Returns the alpha_r parameter of the operation.
+    1378             :     ///
+    1379             :     /// # Returns
+    1380             :     ///
+    1381             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+    1382           3 :     fn alpha_r(&self) -> CalculatorFloat {
+    1383           3 :         (self.theta().clone() / 2.0).cos()
+    1384           3 :     }
+    1385             :     /// Returns the alpha_i parameter of the operation.
+    1386             :     ///
+    1387             :     /// # Returns
+    1388             :     ///
+    1389             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+    1390           3 :     fn alpha_i(&self) -> CalculatorFloat {
+    1391           3 :         (self.theta().clone() / 2.0).sin()
+    1392           3 :     }
+    1393             :     /// Returns the beta_r parameter of the operation.
+    1394             :     ///
+    1395             :     /// # Returns
+    1396             :     ///
+    1397             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1398           3 :     fn beta_r(&self) -> CalculatorFloat {
+    1399           3 :         CalculatorFloat::from(0.0)
+    1400           3 :     }
+    1401             :     /// Returns the beta_i parameter of the operation.
+    1402             :     ///
+    1403             :     /// # Returns
+    1404             :     ///
+    1405             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1406           3 :     fn beta_i(&self) -> CalculatorFloat {
+    1407           3 :         CalculatorFloat::from(0.0)
+    1408           3 :     }
+    1409             :     /// Returns global_phase parameter of the operation.
+    1410             :     ///
+    1411             :     /// # Returns
+    1412             :     ///
+    1413             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+    1414           3 :     fn global_phase(&self) -> CalculatorFloat {
+    1415           3 :         self.theta().clone() / 2.0
+    1416           3 :     }
+    1417             : }
+    1418             : 
+    1419             : /// Implements a rotation around an axis in the x-y plane in spherical coordinates.
+    1420             : ///
+    1421             : /// $$
+    1422             : /// U = \begin{pmatrix}
+    1423             : /// \cos(\frac{\theta}{2}) & 0\\\\
+    1424             : /// 0 & \cos(\frac{\theta}{2})
+    1425             : /// \end{pmatrix}
+    1426             : /// \+ \begin{pmatrix}
+    1427             : /// -i \sin(\frac{\theta}{2}) v_z  &  \sin(\frac{\theta}{2}) \left(-i v_x - v_y \right)\\\\
+    1428             : /// \sin(\frac{\theta}{2}) \left(-i v_x + v_y \right) & i \sin(\frac{\theta}{2}) v_z
+    1429             : /// \end{pmatrix}
+    1430             : ///  $$
+    1431             : ///
+    1432             : /// with
+    1433             : /// $ v_x = \sin(\theta_{sph}) \cos(\phi_{sph}) $,
+    1434             : /// $ v_y = \sin(\theta_{sph}) \sin(\phi_{sph}) $,
+    1435             : /// $ v_z = \cos(\theta_{sph})$.
+    1436             : ///
+    1437             : #[derive(
+    1438           1 :     Debug,
+    1439          11 :     Clone,
+    1440          10 :     PartialEq,
+    1441           3 :     roqoqo_derive::InvolveQubits,
+    1442           3 :     roqoqo_derive::Operate,
+    1443           5 :     roqoqo_derive::Substitute,
+    1444           5 :     roqoqo_derive::OperateSingleQubit,
+    1445          12 :     roqoqo_derive::Rotate,
+    1446             : )]
+    1447             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1448             : pub struct RotateAroundSphericalAxis {
+    1449             :     /// The qubit the unitary gate is applied to.
+    1450             :     qubit: usize,
+    1451             :     /// The angle $\theta$ of the rotation, in the interval from 0 to $2^* 2 \pi$.
+    1452             :     theta: CalculatorFloat,
+    1453             :     /// The rotation axis, unit-vector spherical coordinates $\theta_{sph}$.
+    1454             :     spherical_theta: CalculatorFloat,
+    1455             :     /// The rotation axis, unit-vector spherical coordinates $\phi_{sph}$  gives the angle in the x-y plane.
+    1456             :     spherical_phi: CalculatorFloat,
+    1457             : }
+    1458             : 
+    1459             : #[allow(non_upper_case_globals)]
+    1460             : const TAGS_RotateAroundSphericalAxis: &[&str; 5] = &[
+    1461             :     "Operation",
+    1462             :     "GateOperation",
+    1463             :     "SingleQubitGateOperation",
+    1464             :     "Rotation",
+    1465             :     "RotateAroundSphericalAxis",
+    1466             : ];
+    1467             : 
+    1468             : /// Trait for all operations acting with a unitary gate on a set of qubits.
+    1469             : impl OperateGate for RotateAroundSphericalAxis {
+    1470             :     /// Returns unitary matrix of the gate.
+    1471             :     ///
+    1472             :     /// # Returns
+    1473             :     ///
+    1474             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1475             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1476           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1477           2 :         let c: f64 = (f64::try_from(self.theta.clone())? / 2.0).cos();
+    1478           2 :         let s: f64 = (f64::try_from(self.theta.clone())? / 2.0).sin();
+    1479           2 :         let vx: f64 = ((f64::try_from(self.spherical_theta.clone())?).sin())
+    1480           2 :             * ((f64::try_from(self.spherical_phi.clone())?).cos());
+    1481           2 :         let vy: f64 = ((f64::try_from(self.spherical_theta.clone())?).sin())
+    1482           2 :             * ((f64::try_from(self.spherical_phi.clone())?).sin());
+    1483           2 :         let vz: f64 = (f64::try_from(self.spherical_theta.clone())?).cos();
+    1484           2 :         Ok(array![
+    1485           2 :             [
+    1486           2 :                 Complex64::new(c, -1.0 * s * vz),
+    1487           2 :                 Complex64::new(-1.0 * s * vy, -1.0 * s * vx)
+    1488           2 :             ],
+    1489           2 :             [
+    1490           2 :                 Complex64::new(s * vy, -1.0 * s * vx),
+    1491           2 :                 Complex64::new(c, s * vz)
+    1492           2 :             ]
+    1493           2 :         ])
+    1494           2 :     }
+    1495             : }
+    1496             : 
+    1497             : /// Trait for unitary operations acting on exactly one qubit.
+    1498             : impl OperateSingleQubitGate for RotateAroundSphericalAxis {
+    1499             :     /// Returns the alpha_r parameter of the operation.
+    1500             :     ///
+    1501             :     /// # Returns
+    1502             :     ///
+    1503             :     /// * `alpha_r` - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.
+    1504          11 :     fn alpha_r(&self) -> CalculatorFloat {
+    1505          11 :         (self.theta.clone() / 2.0).cos()
+    1506          11 :     }
+    1507             :     /// Returns the alpha_i parameter of the operation.
+    1508             :     ///
+    1509             :     /// # Returns
+    1510             :     ///
+    1511             :     /// * `alpha_i` - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.
+    1512          11 :     fn alpha_i(&self) -> CalculatorFloat {
+    1513          11 :         let s = (self.theta.clone() / 2.0).sin();
+    1514          11 :         let vz = (self.spherical_theta.clone()).cos();
+    1515          11 :         s * vz * (-1.0) // CHECK sign (?)
+    1516          11 :     }
+    1517             :     /// Returns the beta_r parameter of the operation.
+    1518             :     ///
+    1519             :     /// # Returns
+    1520             :     ///
+    1521             :     /// * `beta_r` - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1522          11 :     fn beta_r(&self) -> CalculatorFloat {
+    1523          11 :         let s = (self.theta.clone() / 2.0).sin();
+    1524          11 :         let vy = (self.spherical_phi.clone()).sin();
+    1525          11 :         let st = (self.spherical_theta.clone()).sin();
+    1526          11 :         s * vy * st
+    1527          11 :     }
+    1528             :     /// Returns the beta_i parameter of the operation.
+    1529             :     ///
+    1530             :     /// # Returns
+    1531             :     ///
+    1532             :     /// * `beta_i` - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.
+    1533          11 :     fn beta_i(&self) -> CalculatorFloat {
+    1534          11 :         let s = (self.theta.clone() / 2.0).sin();
+    1535          11 :         let vx = (self.spherical_phi.clone()).cos();
+    1536          11 :         let st = (self.spherical_theta.clone()).sin();
+    1537          11 :         s * vx * st * (-1.0)
+    1538          11 :     }
+    1539             :     /// Returns global_phase parameter of the operation.
+    1540             :     ///
+    1541             :     /// # Returns
+    1542             :     ///
+    1543             :     /// * `global_phase` - The global phase phi $ \phi $ of the single-qubit unitary.
+    1544          11 :     fn global_phase(&self) -> CalculatorFloat {
+    1545          11 :         CalculatorFloat::from(0.0)
+    1546          11 :     }
+    1547             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.func-sort-c.html b/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.func-sort-c.html new file mode 100644 index 00000000..1dfe39bc --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.func-sort-c.html @@ -0,0 +1,1792 @@ + + + + + + + LCOV - coverage.lcov - src/operations/two_qubit_gate_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - two_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:11261126100.0 %
Date:2021-11-09 13:25:48Functions:430430100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov>::delta_imag1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov>::delta_real1
<roqoqo::operations::two_qubit_gate_operations::CNOT as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::CNOT as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::CNOT as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::CNOT as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction>::t_imag1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction>::t_real1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::FSwap as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::FSwap as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::FSwap as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::FSwap as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::Fsim as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::Fsim as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::Fsim as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::Fsim as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::Fsim>::delta1
<roqoqo::operations::two_qubit_gate_operations::Fsim>::t1
<roqoqo::operations::two_qubit_gate_operations::Fsim>::u1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation>::phi1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian>::phi1
<roqoqo::operations::two_qubit_gate_operations::ISwap as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::ISwap as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ISwap as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ISwap as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::KakDecomposition as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::KakDecomposition as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::KakDecomposition as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::KakDecomposition as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction>::t1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ>::phi1
<roqoqo::operations::two_qubit_gate_operations::Qsim as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::Qsim as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::Qsim as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::Qsim as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::Qsim>::x1
<roqoqo::operations::two_qubit_gate_operations::Qsim>::y1
<roqoqo::operations::two_qubit_gate_operations::Qsim>::z1
<roqoqo::operations::two_qubit_gate_operations::SWAP as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::SWAP as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::SWAP as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::SWAP as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction>::x1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction>::y1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction>::z1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::XY as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::XY as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::XY as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov>::new2
<roqoqo::operations::two_qubit_gate_operations::CNOT>::new2
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction>::new2
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY>::new2
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ>::new2
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift>::new2
<roqoqo::operations::two_qubit_gate_operations::FSwap>::new2
<roqoqo::operations::two_qubit_gate_operations::Fsim>::new2
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::GivensRotation>::new2
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian>::new2
<roqoqo::operations::two_qubit_gate_operations::ISwap>::new2
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap>::new2
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX>::new2
<roqoqo::operations::two_qubit_gate_operations::PMInteraction>::new2
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ>::new2
<roqoqo::operations::two_qubit_gate_operations::Qsim>::new2
<roqoqo::operations::two_qubit_gate_operations::SWAP>::new2
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction>::new2
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap>::new2
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX>::new2
<roqoqo::operations::two_qubit_gate_operations::XY as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::XY>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.func.html b/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.func.html new file mode 100644 index 00000000..2b3be325 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.func.html @@ -0,0 +1,1792 @@ + + + + + + + LCOV - coverage.lcov - src/operations/two_qubit_gate_operations.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - two_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:11261126100.0 %
Date:2021-11-09 13:25:48Functions:430430100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov>::delta_imag1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov>::delta_real1
<roqoqo::operations::two_qubit_gate_operations::Bogoliubov>::new2
<roqoqo::operations::two_qubit_gate_operations::CNOT as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::CNOT as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::CNOT as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::CNOT as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::CNOT as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::CNOT>::new2
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction>::new2
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction>::t_imag1
<roqoqo::operations::two_qubit_gate_operations::ComplexPMInteraction>::t_real1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliY>::new2
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ControlledPauliZ>::new2
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ControlledPhaseShift>::new2
<roqoqo::operations::two_qubit_gate_operations::FSwap as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::FSwap as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::FSwap as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::FSwap as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::FSwap as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::FSwap>::new2
<roqoqo::operations::two_qubit_gate_operations::Fsim as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::Fsim as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::Fsim as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::Fsim as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::Fsim as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::Fsim>::delta1
<roqoqo::operations::two_qubit_gate_operations::Fsim>::new2
<roqoqo::operations::two_qubit_gate_operations::Fsim>::t1
<roqoqo::operations::two_qubit_gate_operations::Fsim>::u1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::GivensRotation>::new2
<roqoqo::operations::two_qubit_gate_operations::GivensRotation>::phi1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian>::new2
<roqoqo::operations::two_qubit_gate_operations::GivensRotationLittleEndian>::phi1
<roqoqo::operations::two_qubit_gate_operations::ISwap as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::ISwap as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::ISwap as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::ISwap as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::ISwap as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::ISwap>::new2
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::InvSqrtISwap>::new2
<roqoqo::operations::two_qubit_gate_operations::KakDecomposition as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::KakDecomposition as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::KakDecomposition as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::KakDecomposition as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::MolmerSorensenXX>::new2
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::PMInteraction>::new2
<roqoqo::operations::two_qubit_gate_operations::PMInteraction>::t1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ>::new2
<roqoqo::operations::two_qubit_gate_operations::PhaseShiftedControlledZ>::phi1
<roqoqo::operations::two_qubit_gate_operations::Qsim as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::Qsim as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::Qsim as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::Qsim as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::Qsim as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::Qsim>::new2
<roqoqo::operations::two_qubit_gate_operations::Qsim>::x1
<roqoqo::operations::two_qubit_gate_operations::Qsim>::y1
<roqoqo::operations::two_qubit_gate_operations::Qsim>::z1
<roqoqo::operations::two_qubit_gate_operations::SWAP as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::SWAP as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::SWAP as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::SWAP as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::SWAP as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::SWAP>::new2
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction>::new2
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction>::x1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction>::y1
<roqoqo::operations::two_qubit_gate_operations::SpinInteraction>::z1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as core::clone::Clone>::clone1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::SqrtISwap>::new2
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::VariableMSXX>::new2
<roqoqo::operations::two_qubit_gate_operations::XY as core::clone::Clone>::clone2
<roqoqo::operations::two_qubit_gate_operations::XY as core::cmp::PartialEq>::eq1
<roqoqo::operations::two_qubit_gate_operations::XY as core::cmp::PartialEq>::ne1
<roqoqo::operations::two_qubit_gate_operations::XY as core::fmt::Debug>::fmt1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::InvolveQubits>::involved_qubits1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Operate>::hqslang1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Operate>::is_parametrized1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Operate>::tags1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::OperateGate>::unitary_matrix1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::OperateTwoQubit>::control1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::OperateTwoQubit>::target1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::OperateTwoQubitGate>::kak_decomposition1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Rotate>::powercf1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Rotate>::theta1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits::{closure#0}1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits::{closure#1}1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits::{closure#2}1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::remap_qubits::{closure#3}1
<roqoqo::operations::two_qubit_gate_operations::XY as roqoqo::operations::Substitute>::substitute_parameters1
<roqoqo::operations::two_qubit_gate_operations::XY>::new2
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.gcov.html b/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.gcov.html new file mode 100644 index 00000000..c4e3a7c7 --- /dev/null +++ b/roqoqo/coveragehtml/src/operations/two_qubit_gate_operations.rs.gcov.html @@ -0,0 +1,2345 @@ + + + + + + + LCOV - coverage.lcov - src/operations/two_qubit_gate_operations.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src/operations - two_qubit_gate_operations.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:11261126100.0 %
Date:2021-11-09 13:25:48Functions:430430100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use crate::operations::single_qubit_gate_operations::*;
+      14             : use crate::prelude::*;
+      15             : use crate::Circuit;
+      16             : use crate::RoqoqoError;
+      17             : use ndarray::{array, Array2};
+      18             : use num_complex::Complex64;
+      19             : use qoqo_calculator::{CalculatorComplex, CalculatorFloat};
+      20             : #[cfg(feature = "overrotate")]
+      21             : use rand_distr::{Distribution, Normal};
+      22             : use std::convert::TryFrom;
+      23             : use std::f64::consts::PI;
+      24             : 
+      25             : /// The KAK decomposition of a two-qubit gate.
+      26             : ///
+      27             : /// Each two-qubit gate can be described by a KAK decomposition (<http://arxiv.org/abs/quant-ph/0507171>).
+      28             : ///
+      29             : /// A two qubit gate is decomposed into four single qubit gates, one for each qubit acting before and after applying the
+      30             : /// entangling operation based on the k_vector:  
+      31             : ///
+      32             : /// U(k_vector) = exp(i (k_vector(0) XX + k_vector(1) YY + k_vector(2) ZZ))
+      33             : ///
+      34             : /// This struct contains all information on the KAK decomposition of a two qubit gate.
+      35           4 : #[derive(Debug, Clone, PartialEq)]
+      36             : pub struct KakDecomposition {
+      37             :     /// Global phase of KAK decomposition
+      38             :     pub global_phase: CalculatorFloat,
+      39             :     /// Three component vector of the KAK decomposition
+      40             :     pub k_vector: [CalculatorFloat; 3],
+      41             :     /// Circuit including operations acting on control and target qubits before two-qubit entangling
+      42             :     pub circuit_before: Option<Circuit>,
+      43             :     /// Circuit including operations acting on control and target qubits after two-qubit entangling
+      44             :     pub circuit_after: Option<Circuit>,
+      45             : }
+      46             : 
+      47             : /// Implements the CNOT controlled not gate.
+      48             : ///
+      49             : /// $$
+      50             : /// U = \begin{pmatrix}
+      51             : /// 1 & 0 & 0 & 0 \\\\
+      52             : /// 0 & 1 & 0 & 0 \\\\
+      53             : /// 0 & 0 & 0 & 1 \\\\
+      54             : /// 0 & 0 & 1 & 0
+      55             : /// \end{pmatrix}
+      56             : /// $$
+      57             : ///
+      58             : #[allow(clippy::upper_case_acronyms)]
+      59             : #[derive(
+      60           1 :     Debug,
+      61           4 :     Clone,
+      62          13 :     PartialEq,
+      63           1 :     roqoqo_derive::InvolveQubits,
+      64          36 :     roqoqo_derive::Operate,
+      65           3 :     roqoqo_derive::Substitute,
+      66          10 :     roqoqo_derive::OperateTwoQubit,
+      67             : )]
+      68             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      69             : pub struct CNOT {
+      70             :     /// The index of the most significant qubit in the unitary representation. Here, the qubit that controls the application of NOT on the target qubit.
+      71             :     control: usize,
+      72             :     /// The index of the least significant qubit in the unitary representation. Here, the qubit NOT is applied to.
+      73             :     target: usize,
+      74             : }
+      75             : 
+      76             : #[allow(non_upper_case_globals)]
+      77             : const TAGS_CNOT: &[&str; 4] = &[
+      78             :     "Operation",
+      79             :     "GateOperation",
+      80             :     "TwoQubitGateOperation",
+      81             :     "CNOT",
+      82             : ];
+      83             : 
+      84             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+      85             : impl OperateGate for CNOT {
+      86             :     /// Returns unitary matrix of the gate.
+      87             :     ///
+      88             :     /// # Returns
+      89             :     ///
+      90             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+      91             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+      92           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+      93           2 :         Ok(array![
+      94           2 :             [
+      95           2 :                 Complex64::new(1.0, 0.0),
+      96           2 :                 Complex64::new(0.0, 0.0),
+      97           2 :                 Complex64::new(0.0, 0.0),
+      98           2 :                 Complex64::new(0.0, 0.0)
+      99           2 :             ],
+     100           2 :             [
+     101           2 :                 Complex64::new(0.0, 0.0),
+     102           2 :                 Complex64::new(1.0, 0.0),
+     103           2 :                 Complex64::new(0.0, 0.0),
+     104           2 :                 Complex64::new(0.0, 0.0)
+     105           2 :             ],
+     106           2 :             [
+     107           2 :                 Complex64::new(0.0, 0.0),
+     108           2 :                 Complex64::new(0.0, 0.0),
+     109           2 :                 Complex64::new(0.0, 0.0),
+     110           2 :                 Complex64::new(1.0, 0.0)
+     111           2 :             ],
+     112           2 :             [
+     113           2 :                 Complex64::new(0.0, 0.0),
+     114           2 :                 Complex64::new(0.0, 0.0),
+     115           2 :                 Complex64::new(1.0, 0.0),
+     116           2 :                 Complex64::new(0.0, 0.0)
+     117           2 :             ],
+     118           2 :         ])
+     119           2 :     }
+     120             : }
+     121             : 
+     122             : /// Trait for all gate operations acting on exactly two qubits.
+     123             : impl OperateTwoQubitGate for CNOT {
+     124             :     /// Returns [KakDecomposition] of the  gate.
+     125             :     ///
+     126             :     /// # Returns
+     127             :     ///
+     128             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     129           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     130           4 :         let mut circuit_b = Circuit::new();
+     131           4 :         circuit_b += RotateZ::new(self.control, CalculatorFloat::FRAC_PI_2);
+     132           4 :         circuit_b += RotateY::new(self.control, CalculatorFloat::FRAC_PI_2);
+     133           4 :         circuit_b += RotateX::new(self.target, CalculatorFloat::FRAC_PI_2);
+     134           4 : 
+     135           4 :         let mut circuit_a = Circuit::new();
+     136           4 :         circuit_a += RotateY::new(self.control, CalculatorFloat::FRAC_PI_2 * (-1.0));
+     137           4 : 
+     138           4 :         KakDecomposition {
+     139           4 :             global_phase: CalculatorFloat::FRAC_PI_4,
+     140           4 :             k_vector: [
+     141           4 :                 CalculatorFloat::FRAC_PI_4,
+     142           4 :                 CalculatorFloat::ZERO,
+     143           4 :                 CalculatorFloat::ZERO,
+     144           4 :             ],
+     145           4 :             circuit_before: Some(circuit_b),
+     146           4 :             circuit_after: Some(circuit_a),
+     147           4 :         }
+     148           4 :     }
+     149             : }
+     150             : 
+     151             : /// Implements the SWAP gate.
+     152             : ///
+     153             : /// $$
+     154             : /// U = \begin{pmatrix}
+     155             : /// 1 & 0 & 0 & 0 \\\\
+     156             : /// 0 & 0 & 1 & 0 \\\\
+     157             : /// 0 & 1 & 0 & 0 \\\\
+     158             : /// 0 & 0 & 0 & 1
+     159             : /// \end{pmatrix}
+     160             : /// $$
+     161             : ///
+     162             : #[allow(clippy::upper_case_acronyms)]
+     163             : #[derive(
+     164           1 :     Debug,
+     165           4 :     Clone,
+     166           7 :     PartialEq,
+     167           1 :     roqoqo_derive::InvolveQubits,
+     168          24 :     roqoqo_derive::Operate,
+     169           3 :     roqoqo_derive::Substitute,
+     170           6 :     roqoqo_derive::OperateTwoQubit,
+     171             : )]
+     172             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     173             : pub struct SWAP {
+     174             :     /// The index of the most significant qubit in the unitary representation.
+     175             :     control: usize,
+     176             :     /// The index of the least significant qubit in the unitary representation.
+     177             :     target: usize,
+     178             : }
+     179             : 
+     180             : #[allow(non_upper_case_globals)]
+     181             : const TAGS_SWAP: &[&str; 4] = &[
+     182             :     "Operation",
+     183             :     "GateOperation",
+     184             :     "TwoQubitGateOperation",
+     185             :     "SWAP",
+     186             : ];
+     187             : 
+     188             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     189             : impl OperateGate for SWAP {
+     190             :     /// Returns unitary matrix of the gate.
+     191             :     ///
+     192             :     /// # Returns
+     193             :     ///
+     194             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     195             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+     196           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     197           2 :         Ok(array![
+     198           2 :             [
+     199           2 :                 Complex64::new(1.0, 0.0),
+     200           2 :                 Complex64::new(0.0, 0.0),
+     201           2 :                 Complex64::new(0.0, 0.0),
+     202           2 :                 Complex64::new(0.0, 0.0)
+     203           2 :             ],
+     204           2 :             [
+     205           2 :                 Complex64::new(0.0, 0.0),
+     206           2 :                 Complex64::new(0.0, 0.0),
+     207           2 :                 Complex64::new(1.0, 0.0),
+     208           2 :                 Complex64::new(0.0, 0.0)
+     209           2 :             ],
+     210           2 :             [
+     211           2 :                 Complex64::new(0.0, 0.0),
+     212           2 :                 Complex64::new(1.0, 0.0),
+     213           2 :                 Complex64::new(0.0, 0.0),
+     214           2 :                 Complex64::new(0.0, 0.0)
+     215           2 :             ],
+     216           2 :             [
+     217           2 :                 Complex64::new(0.0, 0.0),
+     218           2 :                 Complex64::new(0.0, 0.0),
+     219           2 :                 Complex64::new(0.0, 0.0),
+     220           2 :                 Complex64::new(1.0, 0.0)
+     221           2 :             ],
+     222           2 :         ])
+     223           2 :     }
+     224             : }
+     225             : 
+     226             : /// Trait for all gate operations acting on exactly two qubits.
+     227             : impl OperateTwoQubitGate for SWAP {
+     228             :     /// Returns [KakDecomposition] of the gate.
+     229             :     ///
+     230             :     /// # Returns
+     231             :     ///
+     232             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     233           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     234           4 :         KakDecomposition {
+     235           4 :             global_phase: CalculatorFloat::from((-1.0) * PI / 4.0),
+     236           4 :             k_vector: [
+     237           4 :                 CalculatorFloat::FRAC_PI_4,
+     238           4 :                 CalculatorFloat::FRAC_PI_4,
+     239           4 :                 CalculatorFloat::FRAC_PI_4,
+     240           4 :             ],
+     241           4 :             circuit_before: None,
+     242           4 :             circuit_after: None,
+     243           4 :         }
+     244           4 :     }
+     245             : }
+     246             : 
+     247             : /// The ISwap gate.
+     248             : ///
+     249             : /// $$
+     250             : /// U = \begin{pmatrix}
+     251             : /// 1 & 0 & 0 & 0 \\\\
+     252             : /// 0 & 0 & i & 0 \\\\
+     253             : /// 0 & i & 0 & 0 \\\\
+     254             : /// 0 & 0 & 0 & 1
+     255             : /// \end{pmatrix}
+     256             : /// $$
+     257             : ///
+     258             : #[allow(clippy::upper_case_acronyms)]
+     259             : #[derive(
+     260           1 :     Debug,
+     261           4 :     Clone,
+     262           7 :     PartialEq,
+     263           1 :     roqoqo_derive::InvolveQubits,
+     264          24 :     roqoqo_derive::Operate,
+     265           3 :     roqoqo_derive::Substitute,
+     266           6 :     roqoqo_derive::OperateTwoQubit,
+     267             : )]
+     268             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     269             : pub struct ISwap {
+     270             :     /// The index of the most significant qubit in the unitary representation.
+     271             :     control: usize,
+     272             :     /// The index of the least significant qubit in the unitary representation.
+     273             :     target: usize,
+     274             : }
+     275             : 
+     276             : #[allow(non_upper_case_globals)]
+     277             : const TAGS_ISwap: &[&str; 4] = &[
+     278             :     "Operation",
+     279             :     "GateOperation",
+     280             :     "TwoQubitGateOperation",
+     281             :     "ISwap",
+     282             : ];
+     283             : 
+     284             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     285             : impl OperateGate for ISwap {
+     286             :     /// Returns unitary matrix of the gate.
+     287             :     ///
+     288             :     /// # Returns
+     289             :     ///
+     290             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     291             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+     292           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     293           2 :         Ok(array![
+     294           2 :             [
+     295           2 :                 Complex64::new(1.0, 0.0),
+     296           2 :                 Complex64::new(0.0, 0.0),
+     297           2 :                 Complex64::new(0.0, 0.0),
+     298           2 :                 Complex64::new(0.0, 0.0)
+     299           2 :             ],
+     300           2 :             [
+     301           2 :                 Complex64::new(0.0, 0.0),
+     302           2 :                 Complex64::new(0.0, 0.0),
+     303           2 :                 Complex64::new(0.0, 1.0),
+     304           2 :                 Complex64::new(0.0, 0.0)
+     305           2 :             ],
+     306           2 :             [
+     307           2 :                 Complex64::new(0.0, 0.0),
+     308           2 :                 Complex64::new(0.0, 1.0),
+     309           2 :                 Complex64::new(0.0, 0.0),
+     310           2 :                 Complex64::new(0.0, 0.0)
+     311           2 :             ],
+     312           2 :             [
+     313           2 :                 Complex64::new(0.0, 0.0),
+     314           2 :                 Complex64::new(0.0, 0.0),
+     315           2 :                 Complex64::new(0.0, 0.0),
+     316           2 :                 Complex64::new(1.0, 0.0)
+     317           2 :             ],
+     318           2 :         ])
+     319           2 :     }
+     320             : }
+     321             : 
+     322             : /// Trait for all gate operations acting on exactly two qubits.
+     323             : impl OperateTwoQubitGate for ISwap {
+     324             :     /// Returns [KakDecomposition] of the gate.
+     325             :     ///
+     326             :     /// # Returns
+     327             :     ///
+     328             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     329           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     330           4 :         KakDecomposition {
+     331           4 :             global_phase: CalculatorFloat::ZERO,
+     332           4 :             k_vector: [
+     333           4 :                 CalculatorFloat::FRAC_PI_4,
+     334           4 :                 CalculatorFloat::FRAC_PI_4,
+     335           4 :                 CalculatorFloat::ZERO,
+     336           4 :             ],
+     337           4 :             circuit_before: None,
+     338           4 :             circuit_after: None,
+     339           4 :         }
+     340           4 :     }
+     341             : }
+     342             : 
+     343             : /// The fermionic SWAP gate.
+     344             : ///
+     345             : /// $$
+     346             : /// U = \begin{pmatrix}
+     347             : /// 1 & 0 & 0 & 0 \\\\
+     348             : /// 0 & 0 & 1 & 0 \\\\
+     349             : /// 0 & 1 & 0 & 0 \\\\
+     350             : /// 0 & 0 & 0 & -1
+     351             : /// \end{pmatrix}
+     352             : /// $$
+     353             : ///
+     354             : #[allow(clippy::upper_case_acronyms)]
+     355             : #[derive(
+     356           1 :     Debug,
+     357           4 :     Clone,
+     358           7 :     PartialEq,
+     359           1 :     roqoqo_derive::InvolveQubits,
+     360          24 :     roqoqo_derive::Operate,
+     361           3 :     roqoqo_derive::Substitute,
+     362           8 :     roqoqo_derive::OperateTwoQubit,
+     363             : )]
+     364             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     365             : pub struct FSwap {
+     366             :     /// The index of the most significant qubit in the unitary representation.
+     367             :     control: usize,
+     368             :     /// The index of the least significant qubit in the unitary representation.
+     369             :     target: usize,
+     370             : }
+     371             : 
+     372             : #[allow(non_upper_case_globals)]
+     373             : const TAGS_FSwap: &[&str; 4] = &[
+     374             :     "Operation",
+     375             :     "GateOperation",
+     376             :     "TwoQubitGateOperation",
+     377             :     "FSwap",
+     378             : ];
+     379             : 
+     380             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     381             : impl OperateGate for FSwap {
+     382             :     /// Returns unitary matrix of the gate.
+     383             :     ///
+     384             :     /// # Returns
+     385             :     ///
+     386             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     387             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+     388           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     389           2 :         Ok(array![
+     390           2 :             [
+     391           2 :                 Complex64::new(1.0, 0.0),
+     392           2 :                 Complex64::new(0.0, 0.0),
+     393           2 :                 Complex64::new(0.0, 0.0),
+     394           2 :                 Complex64::new(0.0, 0.0)
+     395           2 :             ],
+     396           2 :             [
+     397           2 :                 Complex64::new(0.0, 0.0),
+     398           2 :                 Complex64::new(0.0, 0.0),
+     399           2 :                 Complex64::new(1.0, 0.0),
+     400           2 :                 Complex64::new(0.0, 0.0)
+     401           2 :             ],
+     402           2 :             [
+     403           2 :                 Complex64::new(0.0, 0.0),
+     404           2 :                 Complex64::new(1.0, 0.0),
+     405           2 :                 Complex64::new(0.0, 0.0),
+     406           2 :                 Complex64::new(0.0, 0.0)
+     407           2 :             ],
+     408           2 :             [
+     409           2 :                 Complex64::new(0.0, 0.0),
+     410           2 :                 Complex64::new(0.0, 0.0),
+     411           2 :                 Complex64::new(0.0, 0.0),
+     412           2 :                 Complex64::new(-1.0, 0.0)
+     413           2 :             ],
+     414           2 :         ])
+     415           2 :     }
+     416             : }
+     417             : 
+     418             : /// Trait for all gate operations acting on exactly two qubits.
+     419             : impl OperateTwoQubitGate for FSwap {
+     420             :     /// Returns [KakDecomposition] of the gate.
+     421             :     ///
+     422             :     /// # Returns
+     423             :     ///
+     424             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     425           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     426           4 :         let mut circuit_b = Circuit::new();
+     427           4 :         circuit_b += RotateZ::new(self.control, CalculatorFloat::FRAC_PI_2 * (-1.0));
+     428           4 :         circuit_b += RotateZ::new(self.target, CalculatorFloat::FRAC_PI_2 * (-1.0));
+     429           4 : 
+     430           4 :         KakDecomposition {
+     431           4 :             global_phase: CalculatorFloat::FRAC_PI_2 * (-1.0),
+     432           4 :             k_vector: [
+     433           4 :                 CalculatorFloat::FRAC_PI_4,
+     434           4 :                 CalculatorFloat::FRAC_PI_4,
+     435           4 :                 CalculatorFloat::ZERO,
+     436           4 :             ],
+     437           4 :             circuit_before: Some(circuit_b),
+     438           4 :             circuit_after: None,
+     439           4 :         }
+     440           4 :     }
+     441             : }
+     442             : 
+     443             : /// The square root ISwap gate.
+     444             : ///
+     445             : /// $$
+     446             : /// U = \begin{pmatrix}
+     447             : /// 1 & 0 & 0 & 0 \\\\
+     448             : /// 0 & \frac{1}{\sqrt{2}} & \frac{i}{\sqrt{2}} & 0 \\\\
+     449             : /// 0 & \frac{i}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 \\\\
+     450             : /// 0 & 0 & 0 & 1
+     451             : /// \end{pmatrix}
+     452             : /// $$
+     453             : ///
+     454             : #[allow(clippy::upper_case_acronyms)]
+     455             : #[derive(
+     456           1 :     Debug,
+     457           4 :     Clone,
+     458           7 :     PartialEq,
+     459           1 :     roqoqo_derive::InvolveQubits,
+     460          24 :     roqoqo_derive::Operate,
+     461           3 :     roqoqo_derive::Substitute,
+     462           6 :     roqoqo_derive::OperateTwoQubit,
+     463             : )]
+     464             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     465             : pub struct SqrtISwap {
+     466             :     /// The index of the most significant qubit in the unitary representation.
+     467             :     control: usize,
+     468             :     /// The index of the least significant qubit in the unitary representation.
+     469             :     target: usize,
+     470             : }
+     471             : 
+     472             : #[allow(non_upper_case_globals)]
+     473             : const TAGS_SqrtISwap: &[&str; 4] = &[
+     474             :     "Operation",
+     475             :     "GateOperation",
+     476             :     "TwoQubitGateOperation",
+     477             :     "SqrtISwap",
+     478             : ];
+     479             : 
+     480             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     481             : impl OperateGate for SqrtISwap {
+     482             :     /// Returns unitary matrix of the gate.
+     483             :     ///
+     484             :     /// # Returns
+     485             :     ///
+     486             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     487             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+     488           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     489           2 :         let f: f64 = 1.0 / ((2.0_f64).sqrt());
+     490           2 :         Ok(array![
+     491           2 :             [
+     492           2 :                 Complex64::new(1.0, 0.0),
+     493           2 :                 Complex64::new(0.0, 0.0),
+     494           2 :                 Complex64::new(0.0, 0.0),
+     495           2 :                 Complex64::new(0.0, 0.0)
+     496           2 :             ],
+     497           2 :             [
+     498           2 :                 Complex64::new(0.0, 0.0),
+     499           2 :                 Complex64::new(f, 0.0),
+     500           2 :                 Complex64::new(0.0, f),
+     501           2 :                 Complex64::new(0.0, 0.0)
+     502           2 :             ],
+     503           2 :             [
+     504           2 :                 Complex64::new(0.0, 0.0),
+     505           2 :                 Complex64::new(0.0, f),
+     506           2 :                 Complex64::new(f, 0.0),
+     507           2 :                 Complex64::new(0.0, 0.0)
+     508           2 :             ],
+     509           2 :             [
+     510           2 :                 Complex64::new(0.0, 0.0),
+     511           2 :                 Complex64::new(0.0, 0.0),
+     512           2 :                 Complex64::new(0.0, 0.0),
+     513           2 :                 Complex64::new(1.0, 0.0)
+     514           2 :             ],
+     515           2 :         ])
+     516           2 :     }
+     517             : }
+     518             : 
+     519             : /// Trait for all gate operations acting on exactly two qubits.
+     520             : impl OperateTwoQubitGate for SqrtISwap {
+     521             :     /// Returns [KakDecomposition] of the gate.
+     522             :     ///
+     523             :     /// # Returns
+     524             :     ///
+     525             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     526           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     527           4 :         KakDecomposition {
+     528           4 :             global_phase: CalculatorFloat::ZERO,
+     529           4 :             k_vector: [
+     530           4 :                 CalculatorFloat::from(PI / 8.0),
+     531           4 :                 CalculatorFloat::from(PI / 8.0),
+     532           4 :                 CalculatorFloat::ZERO,
+     533           4 :             ],
+     534           4 :             circuit_before: None,
+     535           4 :             circuit_after: None,
+     536           4 :         }
+     537           4 :     }
+     538             : }
+     539             : 
+     540             : /// The inverse square root ISwap gate.
+     541             : ///
+     542             : /// $$
+     543             : /// U = \begin{pmatrix}
+     544             : /// 1 & 0 & 0 & 0 \\\\
+     545             : /// 0 & \frac{1}{\sqrt{2}} & \frac{-i}{\sqrt{2}} & 0 \\\\
+     546             : /// 0 & \frac{-i}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 \\\\
+     547             : /// 0 & 0 & 0 & 1
+     548             : /// \end{pmatrix}
+     549             : /// $$
+     550             : ///
+     551             : #[allow(clippy::upper_case_acronyms)]
+     552             : #[derive(
+     553           1 :     Debug,
+     554           4 :     Clone,
+     555           7 :     PartialEq,
+     556           1 :     roqoqo_derive::InvolveQubits,
+     557          24 :     roqoqo_derive::Operate,
+     558           3 :     roqoqo_derive::Substitute,
+     559           6 :     roqoqo_derive::OperateTwoQubit,
+     560             : )]
+     561             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     562             : pub struct InvSqrtISwap {
+     563             :     /// The index of the most significant qubit in the unitary representation.
+     564             :     control: usize,
+     565             :     /// The index of the least significant qubit in the unitary representation.
+     566             :     target: usize,
+     567             : }
+     568             : 
+     569             : #[allow(non_upper_case_globals)]
+     570             : const TAGS_InvSqrtISwap: &[&str; 4] = &[
+     571             :     "Operation",
+     572             :     "GateOperation",
+     573             :     "TwoQubitGateOperation",
+     574             :     "InvSqrtISwap",
+     575             : ];
+     576             : 
+     577             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     578             : impl OperateGate for InvSqrtISwap {
+     579             :     /// Returns unitary matrix of the gate.
+     580             :     ///
+     581             :     /// # Returns
+     582             :     ///
+     583             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     584             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+     585           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     586           2 :         let f: f64 = 1.0 / ((2.0_f64).sqrt());
+     587           2 :         Ok(array![
+     588           2 :             [
+     589           2 :                 Complex64::new(1.0, 0.0),
+     590           2 :                 Complex64::new(0.0, 0.0),
+     591           2 :                 Complex64::new(0.0, 0.0),
+     592           2 :                 Complex64::new(0.0, 0.0)
+     593           2 :             ],
+     594           2 :             [
+     595           2 :                 Complex64::new(0.0, 0.0),
+     596           2 :                 Complex64::new(f, 0.0),
+     597           2 :                 Complex64::new(0.0, (-1.0) * f),
+     598           2 :                 Complex64::new(0.0, 0.0)
+     599           2 :             ],
+     600           2 :             [
+     601           2 :                 Complex64::new(0.0, 0.0),
+     602           2 :                 Complex64::new(0.0, (-1.0) * f),
+     603           2 :                 Complex64::new(f, 0.0),
+     604           2 :                 Complex64::new(0.0, 0.0)
+     605           2 :             ],
+     606           2 :             [
+     607           2 :                 Complex64::new(0.0, 0.0),
+     608           2 :                 Complex64::new(0.0, 0.0),
+     609           2 :                 Complex64::new(0.0, 0.0),
+     610           2 :                 Complex64::new(1.0, 0.0)
+     611           2 :             ],
+     612           2 :         ])
+     613           2 :     }
+     614             : }
+     615             : 
+     616             : /// Trait for all gate operations acting on exactly two qubits.
+     617             : impl OperateTwoQubitGate for InvSqrtISwap {
+     618             :     /// Returns [KakDecomposition] of the gate.
+     619             :     ///
+     620             :     /// # Returns
+     621             :     ///
+     622             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     623           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     624           4 :         KakDecomposition {
+     625           4 :             global_phase: CalculatorFloat::ZERO,
+     626           4 :             k_vector: [
+     627           4 :                 CalculatorFloat::from((-1.0) * PI / 8.0),
+     628           4 :                 CalculatorFloat::from((-1.0) * PI / 8.0),
+     629           4 :                 CalculatorFloat::ZERO,
+     630           4 :             ],
+     631           4 :             circuit_before: None,
+     632           4 :             circuit_after: None,
+     633           4 :         }
+     634           4 :     }
+     635             : }
+     636             : 
+     637             : /// The XY gate.
+     638             : ///
+     639             : /// $$
+     640             : /// U = \begin{pmatrix}
+     641             : /// 1 & 0 & 0 & 0 \\\\
+     642             : /// 0 & \cos(\theta/2) & i \sin(\theta/2) & 0 \\\\
+     643             : /// 0 & i \sin(\theta/2) & \cos(\theta/2) & 0 \\\\
+     644             : /// 0 & 0 & 0 & 1
+     645             : /// \end{pmatrix}
+     646             : /// $$
+     647             : ///
+     648             : #[allow(clippy::upper_case_acronyms)]
+     649             : #[derive(
+     650           1 :     Debug,
+     651           5 :     Clone,
+     652           9 :     PartialEq,
+     653           1 :     roqoqo_derive::InvolveQubits,
+     654          33 :     roqoqo_derive::Operate,
+     655           6 :     roqoqo_derive::Substitute,
+     656           6 :     roqoqo_derive::OperateTwoQubit,
+     657           3 :     roqoqo_derive::Rotate,
+     658             : )]
+     659             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     660             : pub struct XY {
+     661             :     /// The index of the most significant qubit in the unitary representation.
+     662             :     control: usize,
+     663             :     /// The index of the least significant qubit in the unitary representation.
+     664             :     target: usize,
+     665             :     /// The rotation angle $\theta$.
+     666             :     theta: CalculatorFloat,
+     667             : }
+     668             : 
+     669             : #[allow(non_upper_case_globals)]
+     670             : const TAGS_XY: &[&str; 5] = &[
+     671             :     "Operation",
+     672             :     "GateOperation",
+     673             :     "TwoQubitGateOperation",
+     674             :     "Rotation",
+     675             :     "XY",
+     676             : ];
+     677             : 
+     678             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     679             : impl OperateGate for XY {
+     680             :     /// Returns unitary matrix of the gate.
+     681             :     ///
+     682             :     /// # Returns
+     683             :     ///
+     684             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     685             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+     686           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     687           2 :         let c: f64 = (f64::try_from(self.theta.clone())? / 2.0).cos();
+     688           2 :         let s: f64 = (f64::try_from(self.theta.clone())? / 2.0).sin();
+     689           2 :         Ok(array![
+     690           2 :             [
+     691           2 :                 Complex64::new(1.0, 0.0),
+     692           2 :                 Complex64::new(0.0, 0.0),
+     693           2 :                 Complex64::new(0.0, 0.0),
+     694           2 :                 Complex64::new(0.0, 0.0)
+     695           2 :             ],
+     696           2 :             [
+     697           2 :                 Complex64::new(0.0, 0.0),
+     698           2 :                 Complex64::new(c, 0.0),
+     699           2 :                 Complex64::new(0.0, s),
+     700           2 :                 Complex64::new(0.0, 0.0)
+     701           2 :             ],
+     702           2 :             [
+     703           2 :                 Complex64::new(0.0, 0.0),
+     704           2 :                 Complex64::new(0.0, s),
+     705           2 :                 Complex64::new(c, 0.0),
+     706           2 :                 Complex64::new(0.0, 0.0)
+     707           2 :             ],
+     708           2 :             [
+     709           2 :                 Complex64::new(0.0, 0.0),
+     710           2 :                 Complex64::new(0.0, 0.0),
+     711           2 :                 Complex64::new(0.0, 0.0),
+     712           2 :                 Complex64::new(1.0, 0.0)
+     713           2 :             ],
+     714           2 :         ])
+     715           2 :     }
+     716             : }
+     717             : 
+     718             : /// Trait for all gate operations acting on exactly two qubits.
+     719             : impl OperateTwoQubitGate for XY {
+     720             :     /// Returns [KakDecomposition] of the gate.
+     721             :     ///
+     722             :     /// # Returns
+     723             :     ///
+     724             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     725           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     726           4 :         KakDecomposition {
+     727           4 :             global_phase: CalculatorFloat::ZERO,
+     728           4 :             k_vector: [
+     729           4 :                 self.theta.clone() / 4.0,
+     730           4 :                 self.theta.clone() / 4.0,
+     731           4 :                 CalculatorFloat::ZERO,
+     732           4 :             ],
+     733           4 :             circuit_before: None,
+     734           4 :             circuit_after: None,
+     735           4 :         }
+     736           4 :     }
+     737             : }
+     738             : 
+     739             : /// Implements the controlled-PhaseShift gate.
+     740             : ///
+     741             : /// $$
+     742             : /// U = \begin{pmatrix}
+     743             : /// 1 & 0 & 0 & 0 \\\\
+     744             : /// 0 & 1 & 0 & 0 \\\\
+     745             : /// 0 & 0 & 1 & 0 \\\\
+     746             : /// 0 & 0 & 0 & e^{i \theta}
+     747             : /// \end{pmatrix}
+     748             : /// $$
+     749             : ///
+     750             : #[allow(clippy::upper_case_acronyms)]
+     751             : #[derive(
+     752           1 :     Debug,
+     753           5 :     Clone,
+     754           9 :     PartialEq,
+     755           1 :     roqoqo_derive::InvolveQubits,
+     756          33 :     roqoqo_derive::Operate,
+     757           6 :     roqoqo_derive::Substitute,
+     758           8 :     roqoqo_derive::OperateTwoQubit,
+     759           3 :     roqoqo_derive::Rotate,
+     760             : )]
+     761             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     762             : pub struct ControlledPhaseShift {
+     763             :     /// The index of the most significant qubit in the unitary representation. Here, the qubit that controls the application of the phase-shift on the target qubit.
+     764             :     control: usize,
+     765             :     /// The index of the least significant qubit in the unitary representation. Here, the qubit phase-shift is applied to.
+     766             :     target: usize,
+     767             :     /// The rotation angle $\theta$.
+     768             :     theta: CalculatorFloat,
+     769             : }
+     770             : 
+     771             : #[allow(non_upper_case_globals)]
+     772             : const TAGS_ControlledPhaseShift: &[&str; 5] = &[
+     773             :     "Operation",
+     774             :     "GateOperation",
+     775             :     "TwoQubitGateOperation",
+     776             :     "Rotation",
+     777             :     "ControlledPhaseShift",
+     778             : ];
+     779             : 
+     780             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     781             : impl OperateGate for ControlledPhaseShift {
+     782             :     /// Returns unitary matrix of the gate.
+     783             :     ///
+     784             :     /// # Returns
+     785             :     ///
+     786             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     787             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+     788           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     789             :         // exp(i*x) = cos(x)+i*sin(x)
+     790           2 :         let c: f64 = (f64::try_from(self.theta.clone())?).cos();
+     791           2 :         let s: f64 = (f64::try_from(self.theta.clone())?).sin();
+     792           2 :         Ok(array![
+     793           2 :             [
+     794           2 :                 Complex64::new(1.0, 0.0),
+     795           2 :                 Complex64::new(0.0, 0.0),
+     796           2 :                 Complex64::new(0.0, 0.0),
+     797           2 :                 Complex64::new(0.0, 0.0)
+     798           2 :             ],
+     799           2 :             [
+     800           2 :                 Complex64::new(0.0, 0.0),
+     801           2 :                 Complex64::new(1.0, 0.0),
+     802           2 :                 Complex64::new(0.0, 0.0),
+     803           2 :                 Complex64::new(0.0, 0.0)
+     804           2 :             ],
+     805           2 :             [
+     806           2 :                 Complex64::new(0.0, 0.0),
+     807           2 :                 Complex64::new(0.0, 0.0),
+     808           2 :                 Complex64::new(1.0, 0.0),
+     809           2 :                 Complex64::new(0.0, 0.0)
+     810           2 :             ],
+     811           2 :             [
+     812           2 :                 Complex64::new(0.0, 0.0),
+     813           2 :                 Complex64::new(0.0, 0.0),
+     814           2 :                 Complex64::new(0.0, 0.0),
+     815           2 :                 Complex64::new(c, s)
+     816           2 :             ],
+     817           2 :         ])
+     818           2 :     }
+     819             : }
+     820             : 
+     821             : /// Trait for all gate operations acting on exactly two qubits.
+     822             : impl OperateTwoQubitGate for ControlledPhaseShift {
+     823             :     /// Returns [KakDecomposition] of the gate.
+     824             :     ///
+     825             :     /// # Returns
+     826             :     ///
+     827             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     828           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     829           4 :         let mut circuit_b = Circuit::new();
+     830           4 :         circuit_b += RotateZ::new(self.control, self.theta.clone() / 2.0);
+     831           4 :         circuit_b += RotateZ::new(self.target, self.theta.clone() / 2.0);
+     832           4 : 
+     833           4 :         KakDecomposition {
+     834           4 :             global_phase: self.theta.clone() / 4.0,
+     835           4 :             k_vector: [
+     836           4 :                 CalculatorFloat::ZERO,
+     837           4 :                 CalculatorFloat::ZERO,
+     838           4 :                 self.theta.clone() / 4.0,
+     839           4 :             ],
+     840           4 :             circuit_before: Some(circuit_b),
+     841           4 :             circuit_after: None,
+     842           4 :         }
+     843           4 :     }
+     844             : }
+     845             : 
+     846             : /// The controlled-PauliY gate.
+     847             : ///
+     848             : /// $$
+     849             : /// U = \begin{pmatrix}
+     850             : /// 1 & 0 & 0 & 0 \\\\
+     851             : /// 0 & 1 & 0 & 0 \\\\
+     852             : /// 0 & 0 & 0 & -i \\\\
+     853             : /// 0 & 0 & i & 0
+     854             : /// \end{pmatrix}
+     855             : /// $$
+     856             : ///
+     857             : #[allow(clippy::upper_case_acronyms)]
+     858             : #[derive(
+     859           1 :     Debug,
+     860           4 :     Clone,
+     861           7 :     PartialEq,
+     862           1 :     roqoqo_derive::InvolveQubits,
+     863          24 :     roqoqo_derive::Operate,
+     864           3 :     roqoqo_derive::Substitute,
+     865          10 :     roqoqo_derive::OperateTwoQubit,
+     866             : )]
+     867             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     868             : pub struct ControlledPauliY {
+     869             :     /// The index of the most significant qubit in the unitary representation. Here, the qubit that controls the application of PauliY gate on the target qubit.
+     870             :     control: usize,
+     871             :     /// The index of the least significant qubit in the unitary representation. Here, the qubit PauliY is applied to.
+     872             :     target: usize,
+     873             : }
+     874             : 
+     875             : #[allow(non_upper_case_globals)]
+     876             : const TAGS_ControlledPauliY: &[&str; 4] = &[
+     877             :     "Operation",
+     878             :     "GateOperation",
+     879             :     "TwoQubitGateOperation",
+     880             :     "ControlledPauliY",
+     881             : ];
+     882             : 
+     883             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     884             : impl OperateGate for ControlledPauliY {
+     885             :     /// Returns unitary matrix of the gate.
+     886             :     ///
+     887             :     /// # Returns
+     888             :     ///
+     889             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     890             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+     891           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     892           2 :         Ok(array![
+     893           2 :             [
+     894           2 :                 Complex64::new(1.0, 0.0),
+     895           2 :                 Complex64::new(0.0, 0.0),
+     896           2 :                 Complex64::new(0.0, 0.0),
+     897           2 :                 Complex64::new(0.0, 0.0)
+     898           2 :             ],
+     899           2 :             [
+     900           2 :                 Complex64::new(0.0, 0.0),
+     901           2 :                 Complex64::new(1.0, 0.0),
+     902           2 :                 Complex64::new(0.0, 0.0),
+     903           2 :                 Complex64::new(0.0, 0.0)
+     904           2 :             ],
+     905           2 :             [
+     906           2 :                 Complex64::new(0.0, 0.0),
+     907           2 :                 Complex64::new(0.0, 0.0),
+     908           2 :                 Complex64::new(0.0, 0.0),
+     909           2 :                 Complex64::new(0.0, -1.0)
+     910           2 :             ],
+     911           2 :             [
+     912           2 :                 Complex64::new(0.0, 0.0),
+     913           2 :                 Complex64::new(0.0, 0.0),
+     914           2 :                 Complex64::new(0.0, 1.0),
+     915           2 :                 Complex64::new(0.0, 0.0)
+     916           2 :             ],
+     917           2 :         ])
+     918           2 :     }
+     919             : }
+     920             : 
+     921             : /// Trait for all gate operations acting on exactly two qubits.
+     922             : impl OperateTwoQubitGate for ControlledPauliY {
+     923             :     /// Returns [KakDecomposition] of the gate.
+     924             :     ///
+     925             :     /// # Returns
+     926             :     ///
+     927             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+     928           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+     929           4 :         let mut circuit_b = Circuit::new();
+     930           4 :         circuit_b += RotateZ::new(self.control, CalculatorFloat::FRAC_PI_2);
+     931           4 :         circuit_b += RotateY::new(self.target, CalculatorFloat::FRAC_PI_2);
+     932           4 :         circuit_b += RotateX::new(self.target, CalculatorFloat::FRAC_PI_2);
+     933           4 : 
+     934           4 :         let mut circuit_a = Circuit::new();
+     935           4 :         circuit_a += RotateX::new(self.target, CalculatorFloat::FRAC_PI_2 * (-1.0));
+     936           4 : 
+     937           4 :         KakDecomposition {
+     938           4 :             global_phase: CalculatorFloat::FRAC_PI_4,
+     939           4 :             k_vector: [
+     940           4 :                 CalculatorFloat::ZERO,
+     941           4 :                 CalculatorFloat::ZERO,
+     942           4 :                 CalculatorFloat::FRAC_PI_4,
+     943           4 :             ],
+     944           4 :             circuit_before: Some(circuit_b),
+     945           4 :             circuit_after: Some(circuit_a),
+     946           4 :         }
+     947           4 :     }
+     948             : }
+     949             : 
+     950             : /// The controlled-PauliZ gate.
+     951             : ///
+     952             : /// $$
+     953             : /// U = \begin{pmatrix}
+     954             : /// 1 & 0 & 0 & 0 \\\\
+     955             : /// 0 & 1 & 0 & 0 \\\\
+     956             : /// 0 & 0 & 1 & 0 \\\\
+     957             : /// 0 & 0 & 0 & -1
+     958             : /// \end{pmatrix}
+     959             : /// $$
+     960             : ///
+     961             : #[allow(clippy::upper_case_acronyms)]
+     962             : #[derive(
+     963           1 :     Debug,
+     964           4 :     Clone,
+     965           7 :     PartialEq,
+     966           1 :     roqoqo_derive::InvolveQubits,
+     967          24 :     roqoqo_derive::Operate,
+     968           3 :     roqoqo_derive::Substitute,
+     969           8 :     roqoqo_derive::OperateTwoQubit,
+     970             : )]
+     971             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+     972             : pub struct ControlledPauliZ {
+     973             :     /// The index of the most significant qubit in the unitary representation. Here, the qubit that controls the application of PauliZ gate on the target qubit.
+     974             :     control: usize,
+     975             :     /// The index of the least significant qubit in the unitary representation. Here, the qubit PauliZ is applied to.
+     976             :     target: usize,
+     977             : }
+     978             : 
+     979             : #[allow(non_upper_case_globals)]
+     980             : const TAGS_ControlledPauliZ: &[&str; 4] = &[
+     981             :     "Operation",
+     982             :     "GateOperation",
+     983             :     "TwoQubitGateOperation",
+     984             :     "ControlledPauliZ",
+     985             : ];
+     986             : 
+     987             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+     988             : impl OperateGate for ControlledPauliZ {
+     989             :     /// Returns unitary matrix of the gate.
+     990             :     ///
+     991             :     /// # Returns
+     992             :     ///
+     993             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+     994             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+     995           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+     996           2 :         Ok(array![
+     997           2 :             [
+     998           2 :                 Complex64::new(1.0, 0.0),
+     999           2 :                 Complex64::new(0.0, 0.0),
+    1000           2 :                 Complex64::new(0.0, 0.0),
+    1001           2 :                 Complex64::new(0.0, 0.0)
+    1002           2 :             ],
+    1003           2 :             [
+    1004           2 :                 Complex64::new(0.0, 0.0),
+    1005           2 :                 Complex64::new(1.0, 0.0),
+    1006           2 :                 Complex64::new(0.0, 0.0),
+    1007           2 :                 Complex64::new(0.0, 0.0)
+    1008           2 :             ],
+    1009           2 :             [
+    1010           2 :                 Complex64::new(0.0, 0.0),
+    1011           2 :                 Complex64::new(0.0, 0.0),
+    1012           2 :                 Complex64::new(1.0, 0.0),
+    1013           2 :                 Complex64::new(0.0, 0.0)
+    1014           2 :             ],
+    1015           2 :             [
+    1016           2 :                 Complex64::new(0.0, 0.0),
+    1017           2 :                 Complex64::new(0.0, 0.0),
+    1018           2 :                 Complex64::new(0.0, 0.0),
+    1019           2 :                 Complex64::new(-1.0, 0.0)
+    1020           2 :             ],
+    1021           2 :         ])
+    1022           2 :     }
+    1023             : }
+    1024             : 
+    1025             : /// Trait for all gate operations acting on exactly two qubits.
+    1026             : impl OperateTwoQubitGate for ControlledPauliZ {
+    1027             :     /// Returns [KakDecomposition] of the gate.
+    1028             :     ///
+    1029             :     /// # Returns
+    1030             :     ///
+    1031             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1032           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1033           4 :         let mut circuit_b = Circuit::new();
+    1034           4 :         circuit_b += RotateZ::new(self.control, CalculatorFloat::FRAC_PI_2);
+    1035           4 :         circuit_b += RotateZ::new(self.target, CalculatorFloat::FRAC_PI_2);
+    1036           4 : 
+    1037           4 :         KakDecomposition {
+    1038           4 :             global_phase: CalculatorFloat::FRAC_PI_4,
+    1039           4 :             k_vector: [
+    1040           4 :                 CalculatorFloat::ZERO,
+    1041           4 :                 CalculatorFloat::ZERO,
+    1042           4 :                 CalculatorFloat::FRAC_PI_4,
+    1043           4 :             ],
+    1044           4 :             circuit_before: Some(circuit_b),
+    1045           4 :             circuit_after: None,
+    1046           4 :         }
+    1047           4 :     }
+    1048             : }
+    1049             : 
+    1050             : /// The fixed phase MolmerSorensen XX gate.
+    1051             : ///
+    1052             : /// <http://arxiv.org/abs/1705.02771>
+    1053             : ///
+    1054             : /// $$
+    1055             : /// U = \frac{1}{\sqrt{2}} \begin{pmatrix}
+    1056             : /// 1 & 0 & 0 & -i \\\\
+    1057             : /// 0 &1 & -i & 0 \\\\
+    1058             : /// 0 & -i & 1 & 0 \\\\
+    1059             : /// -i & 0 & 0 & 1
+    1060             : /// \end{pmatrix}
+    1061             : /// $$
+    1062             : ///
+    1063             : #[allow(clippy::upper_case_acronyms)]
+    1064             : #[derive(
+    1065           1 :     Debug,
+    1066           4 :     Clone,
+    1067           7 :     PartialEq,
+    1068           1 :     roqoqo_derive::InvolveQubits,
+    1069          24 :     roqoqo_derive::Operate,
+    1070           3 :     roqoqo_derive::Substitute,
+    1071           6 :     roqoqo_derive::OperateTwoQubit,
+    1072             : )]
+    1073             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1074             : pub struct MolmerSorensenXX {
+    1075             :     /// The index of the most significant qubit in the unitary representation. The gate is symmetric under the exchange of qubits.
+    1076             :     control: usize,
+    1077             :     /// The index of the least significant qubit in the unitary representation. The gate is symmetric under the exchange of qubits.
+    1078             :     target: usize,
+    1079             : }
+    1080             : 
+    1081             : #[allow(non_upper_case_globals)]
+    1082             : const TAGS_MolmerSorensenXX: &[&str; 4] = &[
+    1083             :     "Operation",
+    1084             :     "GateOperation",
+    1085             :     "TwoQubitGateOperation",
+    1086             :     "MolmerSorensenXX",
+    1087             : ];
+    1088             : 
+    1089             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1090             : impl OperateGate for MolmerSorensenXX {
+    1091             :     /// Returns unitary matrix of the gate.
+    1092             :     ///
+    1093             :     /// # Returns
+    1094             :     ///
+    1095             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1096             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed (here, not possible).
+    1097           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1098           2 :         let f: f64 = 1.0 / ((2.0_f64).sqrt());
+    1099           2 :         Ok(array![
+    1100           2 :             [
+    1101           2 :                 Complex64::new(f, 0.0),
+    1102           2 :                 Complex64::new(0.0, 0.0),
+    1103           2 :                 Complex64::new(0.0, 0.0),
+    1104           2 :                 Complex64::new(0.0, (-1.0) * f)
+    1105           2 :             ],
+    1106           2 :             [
+    1107           2 :                 Complex64::new(0.0, 0.0),
+    1108           2 :                 Complex64::new(f, 0.0),
+    1109           2 :                 Complex64::new(0.0, (-1.0) * f),
+    1110           2 :                 Complex64::new(0.0, 0.0)
+    1111           2 :             ],
+    1112           2 :             [
+    1113           2 :                 Complex64::new(0.0, 0.0),
+    1114           2 :                 Complex64::new(0.0, (-1.0) * f),
+    1115           2 :                 Complex64::new(f, 0.0),
+    1116           2 :                 Complex64::new(0.0, 0.0)
+    1117           2 :             ],
+    1118           2 :             [
+    1119           2 :                 Complex64::new(0.0, (-1.0) * f),
+    1120           2 :                 Complex64::new(0.0, 0.0),
+    1121           2 :                 Complex64::new(0.0, 0.0),
+    1122           2 :                 Complex64::new(f, 0.0)
+    1123           2 :             ],
+    1124           2 :         ])
+    1125           2 :     }
+    1126             : }
+    1127             : 
+    1128             : /// Trait for all gate operations acting on exactly two qubits.
+    1129             : impl OperateTwoQubitGate for MolmerSorensenXX {
+    1130             :     /// Returns [KakDecomposition] of the gate.
+    1131             :     ///
+    1132             :     /// # Returns
+    1133             :     ///
+    1134             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1135           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1136           4 :         KakDecomposition {
+    1137           4 :             global_phase: CalculatorFloat::ZERO,
+    1138           4 :             k_vector: [
+    1139           4 :                 CalculatorFloat::from((-1.0) * PI / 4.0),
+    1140           4 :                 CalculatorFloat::ZERO,
+    1141           4 :                 CalculatorFloat::ZERO,
+    1142           4 :             ],
+    1143           4 :             circuit_before: None,
+    1144           4 :             circuit_after: None,
+    1145           4 :         }
+    1146           4 :     }
+    1147             : }
+    1148             : 
+    1149             : /// The variable-angle MolmerSorensen XX gate.
+    1150             : ///
+    1151             : /// $$
+    1152             : /// U = \begin{pmatrix}
+    1153             : /// \cos(\theta/2) & 0 & 0 & -i \sin(\theta/2) \\\\
+    1154             : /// 0 & \cos(\theta/2) & -i \sin(\theta/2) & 0 \\\\
+    1155             : /// 0 & -i \sin(\theta/2) & \cos(\theta/2) & 0 \\\\
+    1156             : /// -i \sin(\theta/2) & 0 & 0 & \cos(\theta/2)
+    1157             : /// \end{pmatrix}
+    1158             : /// $$
+    1159             : ///
+    1160             : #[allow(clippy::upper_case_acronyms)]
+    1161             : #[derive(
+    1162           1 :     Debug,
+    1163           6 :     Clone,
+    1164          10 :     PartialEq,
+    1165           1 :     roqoqo_derive::InvolveQubits,
+    1166          37 :     roqoqo_derive::Operate,
+    1167           8 :     roqoqo_derive::Substitute,
+    1168          10 :     roqoqo_derive::OperateTwoQubit,
+    1169           3 :     roqoqo_derive::Rotate,
+    1170             : )]
+    1171             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1172             : pub struct VariableMSXX {
+    1173             :     /// The index of the most significant qubit in the unitary representation. The gate is symmetric under the exchange of qubits.
+    1174             :     control: usize,
+    1175             :     /// The index of the least significant qubit in the unitary representation. The gate is symmetric under the exchange of qubits.
+    1176             :     target: usize,
+    1177             :     /// The rotation angle $\theta$.
+    1178             :     theta: CalculatorFloat,
+    1179             : }
+    1180             : 
+    1181             : #[allow(non_upper_case_globals)]
+    1182             : const TAGS_VariableMSXX: &[&str; 5] = &[
+    1183             :     "Operation",
+    1184             :     "GateOperation",
+    1185             :     "TwoQubitGateOperation",
+    1186             :     "Rotation",
+    1187             :     "VariableMSXX",
+    1188             : ];
+    1189             : 
+    1190             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1191             : impl OperateGate for VariableMSXX {
+    1192             :     /// Returns unitary matrix of the gate.
+    1193             :     ///
+    1194             :     /// # Returns
+    1195             :     ///
+    1196             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1197             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1198           3 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1199           3 :         let c: f64 = (f64::try_from(self.theta.clone())? / 2.0).cos();
+    1200           3 :         let s: f64 = (f64::try_from(self.theta.clone())? / 2.0).sin();
+    1201           3 :         Ok(array![
+    1202           3 :             [
+    1203           3 :                 Complex64::new(c, 0.0),
+    1204           3 :                 Complex64::new(0.0, 0.0),
+    1205           3 :                 Complex64::new(0.0, 0.0),
+    1206           3 :                 Complex64::new(0.0, (-1.0) * s)
+    1207           3 :             ],
+    1208           3 :             [
+    1209           3 :                 Complex64::new(0.0, 0.0),
+    1210           3 :                 Complex64::new(c, 0.0),
+    1211           3 :                 Complex64::new(0.0, (-1.0) * s),
+    1212           3 :                 Complex64::new(0.0, 0.0)
+    1213           3 :             ],
+    1214           3 :             [
+    1215           3 :                 Complex64::new(0.0, 0.0),
+    1216           3 :                 Complex64::new(0.0, (-1.0) * s),
+    1217           3 :                 Complex64::new(c, 0.0),
+    1218           3 :                 Complex64::new(0.0, 0.0)
+    1219           3 :             ],
+    1220           3 :             [
+    1221           3 :                 Complex64::new(0.0, (-1.0) * s),
+    1222           3 :                 Complex64::new(0.0, 0.0),
+    1223           3 :                 Complex64::new(0.0, 0.0),
+    1224           3 :                 Complex64::new(c, 0.0)
+    1225           3 :             ],
+    1226           3 :         ])
+    1227           3 :     }
+    1228             : }
+    1229             : 
+    1230             : /// Trait for all gate operations acting on exactly two qubits.
+    1231             : impl OperateTwoQubitGate for VariableMSXX {
+    1232             :     /// Returns [KakDecomposition] of the gate.
+    1233             :     ///
+    1234             :     /// # Returns
+    1235             :     ///
+    1236             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1237           8 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1238           8 :         KakDecomposition {
+    1239           8 :             global_phase: CalculatorFloat::ZERO,
+    1240           8 :             k_vector: [
+    1241           8 :                 self.theta.clone() * (-1.0 / 2.0),
+    1242           8 :                 CalculatorFloat::ZERO,
+    1243           8 :                 CalculatorFloat::ZERO,
+    1244           8 :             ],
+    1245           8 :             circuit_before: None,
+    1246           8 :             circuit_after: None,
+    1247           8 :         }
+    1248           8 :     }
+    1249             : }
+    1250             : 
+    1251             : /// The Givens rotation interaction gate in big endian notation: $e^{-\mathrm{i} \theta (X_c Y_t - Y_c X_t)}\cdot e^{-i \phi Z_t/2}$.
+    1252             : ///
+    1253             : /// Where $X_c$ is the Pauli matrix $\sigma^x$ acting on the control qubit, $Y_t$ is the Pauli matrix $\sigma^y$ acting on the target qubit,
+    1254             : /// and $Z_t$ is the Pauli matrix $\sigma^z$ acting on the target qubit.
+    1255             : ///
+    1256             : /// The unitary matrix representation is:
+    1257             : /// $$
+    1258             : /// U = \begin{pmatrix}
+    1259             : /// 1 & 0 & 0 & 0 \\\\
+    1260             : /// 0 & \cos(\theta) \cdot e^{i \phi} & \sin(\theta)  & 0 \\\\
+    1261             : /// 0 & -\sin(\theta) \cdot e^{i \phi} & \cos(\theta)  & 0 \\\\
+    1262             : /// 0 & 0 & 0 & e^{i \phi}
+    1263             : /// \end{pmatrix}
+    1264             : /// $$
+    1265             : ///
+    1266             : #[allow(clippy::upper_case_acronyms)]
+    1267             : #[derive(
+    1268           1 :     Debug,
+    1269           5 :     Clone,
+    1270           9 :     PartialEq,
+    1271           1 :     roqoqo_derive::InvolveQubits,
+    1272           2 :     roqoqo_derive::Operate,
+    1273           6 :     roqoqo_derive::Substitute,
+    1274           8 :     roqoqo_derive::OperateTwoQubit,
+    1275           3 :     roqoqo_derive::Rotate,
+    1276             : )]
+    1277             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1278             : pub struct GivensRotation {
+    1279             :     /// The index of the most significant qubit in the unitary representation.
+    1280             :     control: usize,
+    1281             :     /// The index of the least significant qubit in the unitary representation.
+    1282             :     target: usize,
+    1283             :     /// The rotation angle $\theta$.
+    1284             :     theta: CalculatorFloat,
+    1285             :     /// The phase $\phi$ of the rotation.
+    1286             :     phi: CalculatorFloat,
+    1287             : }
+    1288             : 
+    1289             : #[allow(non_upper_case_globals)]
+    1290             : const TAGS_GivensRotation: &[&str; 5] = &[
+    1291             :     "Operation",
+    1292             :     "GateOperation",
+    1293             :     "TwoQubitGateOperation",
+    1294             :     "Rotation",
+    1295             :     "GivensRotation",
+    1296             : ];
+    1297             : 
+    1298             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1299             : impl OperateGate for GivensRotation {
+    1300             :     /// Returns unitary matrix of the gate.
+    1301             :     ///
+    1302             :     /// # Returns
+    1303             :     ///
+    1304             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1305             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1306           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1307           2 :         let ct: f64 = (f64::try_from(self.theta.clone())?).cos();
+    1308           2 :         let st: f64 = (f64::try_from(self.theta.clone())?).sin();
+    1309             :         // exp(i*phi) = cos(phi)+i*sin(phi)
+    1310           2 :         let cp: f64 = (f64::try_from(self.phi.clone())?).cos();
+    1311           2 :         let sp: f64 = (f64::try_from(self.phi.clone())?).sin();
+    1312           2 :         Ok(array![
+    1313           2 :             [
+    1314           2 :                 Complex64::new(1.0, 0.0),
+    1315           2 :                 Complex64::new(0.0, 0.0),
+    1316           2 :                 Complex64::new(0.0, 0.0),
+    1317           2 :                 Complex64::new(0.0, 0.0)
+    1318           2 :             ],
+    1319           2 :             [
+    1320           2 :                 Complex64::new(0.0, 0.0),
+    1321           2 :                 Complex64::new(ct * cp, ct * sp),
+    1322           2 :                 Complex64::new(st, 0.0),
+    1323           2 :                 Complex64::new(0.0, 0.0)
+    1324           2 :             ],
+    1325           2 :             [
+    1326           2 :                 Complex64::new(0.0, 0.0),
+    1327           2 :                 Complex64::new((-1.0) * st * cp, (-1.0) * st * sp),
+    1328           2 :                 Complex64::new(ct, 0.0),
+    1329           2 :                 Complex64::new(0.0, 0.0)
+    1330           2 :             ],
+    1331           2 :             [
+    1332           2 :                 Complex64::new(0.0, 0.0),
+    1333           2 :                 Complex64::new(0.0, 0.0),
+    1334           2 :                 Complex64::new(0.0, 0.0),
+    1335           2 :                 Complex64::new(cp, sp)
+    1336           2 :             ],
+    1337           2 :         ])
+    1338           2 :     }
+    1339             : }
+    1340             : 
+    1341             : /// Trait for all gate operations acting on exactly two qubits.
+    1342             : impl OperateTwoQubitGate for GivensRotation {
+    1343             :     /// Returns [KakDecomposition] of the gate.
+    1344             :     ///
+    1345             :     /// # Returns
+    1346             :     ///
+    1347             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1348           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1349           4 :         let mut circuit_b = Circuit::new();
+    1350           4 :         circuit_b += RotateZ::new(self.target, self.phi.clone() + (PI / 2.0));
+    1351           4 : 
+    1352           4 :         let mut circuit_a = Circuit::new();
+    1353           4 :         circuit_a += RotateZ::new(self.target, CalculatorFloat::FRAC_PI_2 * (-1.0));
+    1354           4 : 
+    1355           4 :         KakDecomposition {
+    1356           4 :             global_phase: self.phi.clone() / 2.0,
+    1357           4 :             k_vector: [
+    1358           4 :                 self.theta.clone() / 2.0,
+    1359           4 :                 self.theta.clone() / 2.0,
+    1360           4 :                 CalculatorFloat::ZERO,
+    1361           4 :             ],
+    1362           4 :             circuit_before: Some(circuit_b),
+    1363           4 :             circuit_after: Some(circuit_a),
+    1364           4 :         }
+    1365           4 :     }
+    1366             : }
+    1367             : 
+    1368             : /// The Givens rotation interaction gate in little endian notation: $e^{-\mathrm{i} \theta (X_c Y_t -Y_c  X_t)}\cdot e^{-i \phi Z_c/2}$.
+    1369             : ///
+    1370             : /// Where $X_c$ is the Pauli matrix $\sigma^x$ acting on the control qubit, $Y_t$ is the Pauli matrix $\sigma^y$ acting on the target qubit,
+    1371             : /// and $Z_c$ is the Pauli matrix $\sigma^z$ acting on the control qubit.
+    1372             : ///
+    1373             : /// The unitary matrix representation is:
+    1374             : /// $$
+    1375             : /// U = \begin{pmatrix}
+    1376             : /// 1 & 0 & 0 & 0 \\\\
+    1377             : /// 0 & \cos(\theta) & \sin(\theta)  & 0 \\\\
+    1378             : /// 0 & -\sin(\theta) \cdot e^{i \phi} & \cos(\theta) \cdot e^{i \phi}  & 0 \\\\
+    1379             : /// 0 & 0 & 0 & e^{i \phi}
+    1380             : /// \end{pmatrix}
+    1381             : /// $$
+    1382             : ///
+    1383             : #[allow(clippy::upper_case_acronyms)]
+    1384             : #[derive(
+    1385           1 :     Debug,
+    1386           5 :     Clone,
+    1387           9 :     PartialEq,
+    1388           1 :     roqoqo_derive::InvolveQubits,
+    1389           2 :     roqoqo_derive::Operate,
+    1390           6 :     roqoqo_derive::Substitute,
+    1391           8 :     roqoqo_derive::OperateTwoQubit,
+    1392           3 :     roqoqo_derive::Rotate,
+    1393             : )]
+    1394             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1395             : pub struct GivensRotationLittleEndian {
+    1396             :     /// The index of the most significant qubit in the unitary representation.
+    1397             :     control: usize,
+    1398             :     /// The index of the least significant qubit in the unitary representation.
+    1399             :     target: usize,
+    1400             :     /// The rotation angle $\theta$.
+    1401             :     theta: CalculatorFloat,
+    1402             :     /// The phase $\phi$ of the rotation.
+    1403             :     phi: CalculatorFloat,
+    1404             : }
+    1405             : 
+    1406             : #[allow(non_upper_case_globals)]
+    1407             : const TAGS_GivensRotationLittleEndian: &[&str; 5] = &[
+    1408             :     "Operation",
+    1409             :     "GateOperation",
+    1410             :     "TwoQubitGateOperation",
+    1411             :     "Rotation",
+    1412             :     "GivensRotationLittleEndian",
+    1413             : ];
+    1414             : 
+    1415             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1416             : impl OperateGate for GivensRotationLittleEndian {
+    1417             :     /// Returns unitary matrix of the gate.
+    1418             :     ///
+    1419             :     /// # Returns
+    1420             :     ///
+    1421             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1422             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1423           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1424           2 :         let ct: f64 = (f64::try_from(self.theta.clone())?).cos();
+    1425           2 :         let st: f64 = (f64::try_from(self.theta.clone())?).sin();
+    1426             :         // exp(i*phi) = cos(phi)+i*sin(phi)
+    1427           2 :         let cp: f64 = (f64::try_from(self.phi.clone())?).cos();
+    1428           2 :         let sp: f64 = (f64::try_from(self.phi.clone())?).sin();
+    1429           2 :         Ok(array![
+    1430           2 :             [
+    1431           2 :                 Complex64::new(1.0, 0.0),
+    1432           2 :                 Complex64::new(0.0, 0.0),
+    1433           2 :                 Complex64::new(0.0, 0.0),
+    1434           2 :                 Complex64::new(0.0, 0.0)
+    1435           2 :             ],
+    1436           2 :             [
+    1437           2 :                 Complex64::new(0.0, 0.0),
+    1438           2 :                 Complex64::new(ct, 0.0),
+    1439           2 :                 Complex64::new(st, 0.0),
+    1440           2 :                 Complex64::new(0.0, 0.0)
+    1441           2 :             ],
+    1442           2 :             [
+    1443           2 :                 Complex64::new(0.0, 0.0),
+    1444           2 :                 Complex64::new((-1.0) * st * cp, (-1.0) * st * sp),
+    1445           2 :                 Complex64::new(ct * cp, ct * sp),
+    1446           2 :                 Complex64::new(0.0, 0.0)
+    1447           2 :             ],
+    1448           2 :             [
+    1449           2 :                 Complex64::new(0.0, 0.0),
+    1450           2 :                 Complex64::new(0.0, 0.0),
+    1451           2 :                 Complex64::new(0.0, 0.0),
+    1452           2 :                 Complex64::new(cp, sp)
+    1453           2 :             ],
+    1454           2 :         ])
+    1455           2 :     }
+    1456             : }
+    1457             : 
+    1458             : /// Trait for all gate operations acting on exactly two qubits.
+    1459             : impl OperateTwoQubitGate for GivensRotationLittleEndian {
+    1460             :     /// Returns [KakDecomposition] of the gate.
+    1461             :     ///
+    1462             :     /// # Returns
+    1463             :     ///
+    1464             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1465           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1466           4 :         let mut circuit_b = Circuit::new();
+    1467           4 :         circuit_b += RotateZ::new(self.control, CalculatorFloat::FRAC_PI_2 * (-1.0));
+    1468           4 : 
+    1469           4 :         let mut circuit_a = Circuit::new();
+    1470           4 :         circuit_a += RotateZ::new(self.control, self.phi.clone() + (PI / 2.0));
+    1471           4 : 
+    1472           4 :         KakDecomposition {
+    1473           4 :             global_phase: self.phi.clone() / 2.0,
+    1474           4 :             k_vector: [
+    1475           4 :                 self.theta.clone() / 2.0,
+    1476           4 :                 self.theta.clone() / 2.0,
+    1477           4 :                 CalculatorFloat::ZERO,
+    1478           4 :             ],
+    1479           4 :             circuit_before: Some(circuit_b),
+    1480           4 :             circuit_after: Some(circuit_a),
+    1481           4 :         }
+    1482           4 :     }
+    1483             : }
+    1484             : 
+    1485             : /// The qubit simulation (Qsim) gate.
+    1486             : ///
+    1487             : /// $$
+    1488             : /// U = \begin{pmatrix}
+    1489             : /// \cos(x-y) \cdot e^{-i z} & 0 & 0 & -i\sin(x-y)\cdot e^{-i z}\\\\
+    1490             : /// 0 & -i \sin(x+y)\cdot e^{i z} & \cos(x+y)\cdot e^{i z} & 0 \\\\
+    1491             : /// 0 & \cos(x+y)\cdot e^{i z}& -i \sin(x+y)\cdot e^{i z} & 0 \\\\
+    1492             : /// -\sin(x-y)\cdot e^{-i z} & 0 & 0 & \cos(x-y)\cdot e^{-i z}
+    1493             : /// \end{pmatrix}
+    1494             : /// $$
+    1495             : ///
+    1496             : #[allow(clippy::upper_case_acronyms)]
+    1497             : #[derive(
+    1498           1 :     Debug,
+    1499           4 :     Clone,
+    1500           8 :     PartialEq,
+    1501           1 :     roqoqo_derive::InvolveQubits,
+    1502           2 :     roqoqo_derive::Operate,
+    1503           6 :     roqoqo_derive::Substitute,
+    1504           6 :     roqoqo_derive::OperateTwoQubit,
+    1505             : )]
+    1506             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1507             : pub struct Qsim {
+    1508             :     /// The index of the most significant qubit in the unitary representation.
+    1509             :     control: usize,
+    1510             :     /// The index of the least significant qubit in the unitary representation.
+    1511             :     target: usize,
+    1512             :     /// The prefactor of the XX interaction.
+    1513             :     x: CalculatorFloat,
+    1514             :     /// The prefactor of the YY interaction.
+    1515             :     y: CalculatorFloat,
+    1516             :     /// The prefactor of the ZZ interaction.
+    1517             :     z: CalculatorFloat,
+    1518             : }
+    1519             : 
+    1520             : #[allow(non_upper_case_globals)]
+    1521             : const TAGS_Qsim: &[&str; 4] = &[
+    1522             :     "Operation",
+    1523             :     "GateOperation",
+    1524             :     "TwoQubitGateOperation",
+    1525             :     "Qsim",
+    1526             : ];
+    1527             : 
+    1528             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1529             : impl OperateGate for Qsim {
+    1530             :     /// Returns unitary matrix of the gate.
+    1531             :     ///
+    1532             :     /// # Returns
+    1533             :     ///
+    1534             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1535             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1536           3 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1537           3 :         let x: f64 = f64::try_from(self.x.clone())?;
+    1538           3 :         let y: f64 = f64::try_from(self.y.clone())?;
+    1539           3 :         let z: f64 = f64::try_from(self.z.clone())?;
+    1540             : 
+    1541           3 :         let cm: f64 = (x - y).cos();
+    1542           3 :         let cp: f64 = (x + y).cos();
+    1543           3 :         let sm: f64 = (x - y).sin();
+    1544           3 :         let sp: f64 = (x + y).sin();
+    1545           3 : 
+    1546           3 :         // exp(i*z) = cos(z) + i*sin(z)
+    1547           3 :         // exp(-i*z) = cos(z) - i*sin(z)
+    1548           3 :         let cz: f64 = z.cos();
+    1549           3 :         let sz: f64 = z.sin();
+    1550           3 : 
+    1551           3 :         Ok(array![
+    1552           3 :             [
+    1553           3 :                 Complex64::new(cm * cz, (-1.0) * cm * sz),
+    1554           3 :                 Complex64::new(0.0, 0.0),
+    1555           3 :                 Complex64::new(0.0, 0.0),
+    1556           3 :                 Complex64::new((-1.0) * sm * sz, (-1.0) * sm * cz)
+    1557           3 :             ],
+    1558           3 :             [
+    1559           3 :                 Complex64::new(0.0, 0.0),
+    1560           3 :                 Complex64::new(sp * sz, (-1.0) * sp * cz),
+    1561           3 :                 Complex64::new(cp * cz, cp * sz),
+    1562           3 :                 Complex64::new(0.0, 0.0)
+    1563           3 :             ],
+    1564           3 :             [
+    1565           3 :                 Complex64::new(0.0, 0.0),
+    1566           3 :                 Complex64::new(cp * cz, cp * sz),
+    1567           3 :                 Complex64::new(sp * sz, (-1.0) * sp * cz),
+    1568           3 :                 Complex64::new(0.0, 0.0)
+    1569           3 :             ],
+    1570           3 :             [
+    1571           3 :                 Complex64::new((-1.0) * sm * sz, (-1.0) * sm * cz),
+    1572           3 :                 Complex64::new(0.0, 0.0),
+    1573           3 :                 Complex64::new(0.0, 0.0),
+    1574           3 :                 Complex64::new(cm * cz, (-1.0) * cm * sz)
+    1575           3 :             ],
+    1576           3 :         ])
+    1577           3 :     }
+    1578             : }
+    1579             : 
+    1580             : /// Trait for all gate operations acting on exactly two qubits.
+    1581             : impl OperateTwoQubitGate for Qsim {
+    1582             :     /// Returns [KakDecomposition] of the gate.
+    1583             :     ///
+    1584             :     /// # Returns
+    1585             :     ///
+    1586             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1587           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1588           4 :         KakDecomposition {
+    1589           4 :             global_phase: CalculatorFloat::from(-1.0 * PI / 4.0),
+    1590           4 :             k_vector: [
+    1591           4 :                 self.x.clone() * (-1.0) + PI / 4.0,
+    1592           4 :                 self.y.clone() * (-1.0) + PI / 4.0,
+    1593           4 :                 self.z.clone() * (-1.0) + PI / 4.0,
+    1594           4 :             ],
+    1595           4 :             circuit_before: None,
+    1596           4 :             circuit_after: None,
+    1597           4 :         }
+    1598           4 :     }
+    1599             : }
+    1600             : 
+    1601             : /// The fermionic qubit simulation (Fsim) gate.
+    1602             : ///
+    1603             : /// $$
+    1604             : /// U = \begin{pmatrix}
+    1605             : /// \cos(\Delta) & 0 & 0 & i \sin(\Delta) \\\\
+    1606             : /// 0 & -i \sin(t) & \cos(t) & 0 \\\\
+    1607             : /// 0 & \cos(t) & -i \sin(t) & 0 \\\\
+    1608             : /// -\sin(\Delta) \cdot e^{-i U} & 0 & 0 & -\cos(\Delta) \cdot e^{-i U}
+    1609             : /// \end{pmatrix}
+    1610             : /// $$
+    1611             : ///
+    1612             : /// # Note
+    1613             : /// The qubits have to be adjacent, i.e., :math:`|i-j|=1` has to hold. This is the only case
+    1614             : /// in which the gate is valid as a two-qubit gate (due to the Jordan-Wigner transformation).
+    1615             : ///
+    1616             : #[allow(clippy::upper_case_acronyms)]
+    1617             : #[derive(
+    1618           1 :     Debug,
+    1619           5 :     Clone,
+    1620           9 :     PartialEq,
+    1621           1 :     roqoqo_derive::InvolveQubits,
+    1622           2 :     roqoqo_derive::Operate,
+    1623           8 :     roqoqo_derive::Substitute,
+    1624          14 :     roqoqo_derive::OperateTwoQubit,
+    1625             : )]
+    1626             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1627             : pub struct Fsim {
+    1628             :     /// The index of the most significant qubit in the unitary representation.
+    1629             :     control: usize,
+    1630             :     /// The index of the least significant qubit in the unitary representation.
+    1631             :     target: usize,
+    1632             :     /// The hopping strength.
+    1633             :     t: CalculatorFloat,
+    1634             :     /// The interaction strength.
+    1635             :     u: CalculatorFloat,
+    1636             :     /// The Bogoliubov interaction strength $\Delta$.
+    1637             :     delta: CalculatorFloat,
+    1638             : }
+    1639             : 
+    1640             : #[allow(non_upper_case_globals)]
+    1641             : const TAGS_Fsim: &[&str; 4] = &[
+    1642             :     "Operation",
+    1643             :     "GateOperation",
+    1644             :     "TwoQubitGateOperation",
+    1645             :     "Fsim",
+    1646             : ];
+    1647             : 
+    1648             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1649             : impl OperateGate for Fsim {
+    1650             :     /// Returns unitary matrix of the gate.
+    1651             :     ///
+    1652             :     /// # Returns
+    1653             :     ///
+    1654             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1655             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1656           3 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1657           3 :         let t: f64 = f64::try_from(self.t.clone())?;
+    1658           3 :         let u: f64 = f64::try_from(self.u.clone())?;
+    1659           3 :         let d: f64 = f64::try_from(self.delta.clone())?;
+    1660             : 
+    1661           3 :         Ok(array![
+    1662           3 :             [
+    1663           3 :                 Complex64::new(d.cos(), 0.0),
+    1664           3 :                 Complex64::new(0.0, 0.0),
+    1665           3 :                 Complex64::new(0.0, 0.0),
+    1666           3 :                 Complex64::new(0.0, d.sin())
+    1667           3 :             ],
+    1668           3 :             [
+    1669           3 :                 Complex64::new(0.0, 0.0),
+    1670           3 :                 Complex64::new(0.0, (-1.0) * t.sin()),
+    1671           3 :                 Complex64::new(t.cos(), 0.0),
+    1672           3 :                 Complex64::new(0.0, 0.0)
+    1673           3 :             ],
+    1674           3 :             [
+    1675           3 :                 Complex64::new(0.0, 0.0),
+    1676           3 :                 Complex64::new(t.cos(), 0.0),
+    1677           3 :                 Complex64::new(0.0, (-1.0) * t.sin()),
+    1678           3 :                 Complex64::new(0.0, 0.0)
+    1679           3 :             ],
+    1680           3 :             [
+    1681           3 :                 Complex64::new((-1.0) * d.sin() * u.sin(), (-1.0) * d.sin() * u.cos()),
+    1682           3 :                 Complex64::new(0.0, 0.0),
+    1683           3 :                 Complex64::new(0.0, 0.0),
+    1684           3 :                 Complex64::new((-1.0) * d.cos() * u.cos(), d.cos() * u.sin())
+    1685           3 :             ],
+    1686           3 :         ])
+    1687           3 :     }
+    1688             : }
+    1689             : 
+    1690             : /// Trait for all gate operations acting on exactly two qubits.
+    1691             : impl OperateTwoQubitGate for Fsim {
+    1692             :     /// Returns [KakDecomposition] of the gate.
+    1693             :     ///
+    1694             :     /// # Returns
+    1695             :     ///
+    1696             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1697           8 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1698           8 :         let theta = self.u.clone() / (-2.0) - PI / 2.0;
+    1699           8 :         let mut circuit_a = Circuit::new();
+    1700           8 :         circuit_a += RotateZ::new(self.control, theta.clone());
+    1701           8 :         circuit_a += RotateZ::new(self.target, theta);
+    1702           8 : 
+    1703           8 :         KakDecomposition {
+    1704           8 :             global_phase: self.u.clone() / (-4.0) - PI / 2.0,
+    1705           8 :             k_vector: [
+    1706           8 :                 (self.t.clone() / (-2.0) + self.delta.clone() / 2.0 + PI / 4.0),
+    1707           8 :                 (self.t.clone() / (-2.0) - self.delta.clone() / 2.0 + PI / 4.0),
+    1708           8 :                 self.u.clone() / (-4.0),
+    1709           8 :             ],
+    1710           8 :             circuit_before: None,
+    1711           8 :             circuit_after: Some(circuit_a),
+    1712           8 :         }
+    1713           8 :     }
+    1714             : }
+    1715             : 
+    1716             : /// The generalized, anisotropic XYZ Heisenberg interaction between spins.
+    1717             : ///
+    1718             : /// $$
+    1719             : /// e^{-\mathrm{i} (x \cdot X_c X_t + y \cdot Y_c Y_t + z \cdot Z_c Z_t)}
+    1720             : /// $$
+    1721             : ///
+    1722             : /// Where x, y, z are prefactors of the $X_c X_t$, $Y_c Y_t$, $Z_c Z_t$ Pauliproducts acting on control and target qubit,
+    1723             : /// with $XX \equiv \sigma_x \sigma_x$, $YY \equiv \sigma_y \sigma_y$ and $ZZ \equiv \sigma_z \sigma_z$.
+    1724             : ///
+    1725             : #[allow(clippy::upper_case_acronyms)]
+    1726             : #[derive(
+    1727           1 :     Debug,
+    1728           4 :     Clone,
+    1729           8 :     PartialEq,
+    1730           1 :     roqoqo_derive::InvolveQubits,
+    1731           2 :     roqoqo_derive::Operate,
+    1732           6 :     roqoqo_derive::Substitute,
+    1733           6 :     roqoqo_derive::OperateTwoQubit,
+    1734             : )]
+    1735             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1736             : pub struct SpinInteraction {
+    1737             :     /// The index of the most significant qubit in the unitary representation.
+    1738             :     control: usize,
+    1739             :     /// The index of the least significant qubit in the unitary representation.
+    1740             :     target: usize,
+    1741             :     /// The prefactor of the XX interaction.
+    1742             :     x: CalculatorFloat,
+    1743             :     /// The prefactor of the YY interaction.
+    1744             :     y: CalculatorFloat,
+    1745             :     /// The prefactor of the ZZ interaction.
+    1746             :     z: CalculatorFloat,
+    1747             : }
+    1748             : 
+    1749             : #[allow(non_upper_case_globals)]
+    1750             : const TAGS_SpinInteraction: &[&str; 4] = &[
+    1751             :     "Operation",
+    1752             :     "GateOperation",
+    1753             :     "TwoQubitGateOperation",
+    1754             :     "SpinInteraction",
+    1755             : ];
+    1756             : 
+    1757             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1758             : impl OperateGate for SpinInteraction {
+    1759             :     /// Returns unitary matrix of the gate.
+    1760             :     ///
+    1761             :     /// # Returns
+    1762             :     ///
+    1763             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1764             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1765           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1766           2 :         let x: f64 = f64::try_from(self.x.clone())?;
+    1767           2 :         let y: f64 = f64::try_from(self.y.clone())?;
+    1768           2 :         let z: f64 = f64::try_from(self.z.clone())?;
+    1769             : 
+    1770           2 :         let cm: f64 = (x - y).cos();
+    1771           2 :         let cp: f64 = (x + y).cos();
+    1772           2 :         let sm: f64 = (x - y).sin();
+    1773           2 :         let sp: f64 = (x + y).sin();
+    1774           2 : 
+    1775           2 :         // exp(i*z) = cos(z) + i*sin(z)
+    1776           2 :         // exp(-i*z) = cos(z) - i*sin(z)
+    1777           2 :         let cz: f64 = z.cos();
+    1778           2 :         let sz: f64 = z.sin();
+    1779           2 : 
+    1780           2 :         Ok(array![
+    1781           2 :             [
+    1782           2 :                 Complex64::new(cm * cz, (-1.0) * cm * sz),
+    1783           2 :                 Complex64::new(0.0, 0.0),
+    1784           2 :                 Complex64::new(0.0, 0.0),
+    1785           2 :                 Complex64::new((-1.0) * sm * sz, (-1.0) * sm * cz)
+    1786           2 :             ],
+    1787           2 :             [
+    1788           2 :                 Complex64::new(0.0, 0.0),
+    1789           2 :                 Complex64::new(cp * cz, cp * sz),
+    1790           2 :                 Complex64::new(sp * sz, (-1.0) * sp * cz),
+    1791           2 :                 Complex64::new(0.0, 0.0)
+    1792           2 :             ],
+    1793           2 :             [
+    1794           2 :                 Complex64::new(0.0, 0.0),
+    1795           2 :                 Complex64::new(sp * sz, (-1.0) * sp * cz),
+    1796           2 :                 Complex64::new(cp * cz, cp * sz),
+    1797           2 :                 Complex64::new(0.0, 0.0)
+    1798           2 :             ],
+    1799           2 :             [
+    1800           2 :                 Complex64::new((-1.0) * sm * sz, (-1.0) * sm * cz),
+    1801           2 :                 Complex64::new(0.0, 0.0),
+    1802           2 :                 Complex64::new(0.0, 0.0),
+    1803           2 :                 Complex64::new(cm * cz, (-1.0) * cm * sz)
+    1804           2 :             ],
+    1805           2 :         ])
+    1806           2 :     }
+    1807             : }
+    1808             : 
+    1809             : /// Trait for all gate operations acting on exactly two qubits.
+    1810             : impl OperateTwoQubitGate for SpinInteraction {
+    1811             :     /// Returns [KakDecomposition] of the gate.
+    1812             :     ///
+    1813             :     /// # Returns
+    1814             :     ///
+    1815             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1816           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1817           4 :         KakDecomposition {
+    1818           4 :             global_phase: CalculatorFloat::ZERO,
+    1819           4 :             k_vector: [
+    1820           4 :                 self.x.clone() * (-1.0),
+    1821           4 :                 self.y.clone() * (-1.0),
+    1822           4 :                 self.z.clone() * (-1.0),
+    1823           4 :             ],
+    1824           4 :             circuit_before: None,
+    1825           4 :             circuit_after: None,
+    1826           4 :         }
+    1827           4 :     }
+    1828             : }
+    1829             : 
+    1830             : /// The Bogoliubov DeGennes interaction gate.
+    1831             : ///
+    1832             : /// $$
+    1833             : /// e^{-\mathrm{i} Re(\Delta) (X_c X_t - Y_c Y_t)/2 + Im(\Delta) (X_c Y_t+Y_c X_t)/2}
+    1834             : /// $$
+    1835             : ///
+    1836             : /// Where $X_c$ is the Pauli matrix $\sigma^x$ acting on the control qubit, and $Y_t$ is the Pauli matrix $\sigma^y$ acting on the target qubit.
+    1837             : ///
+    1838             : /// The unitary matrix representation is:
+    1839             : /// $$
+    1840             : /// U = \begin{pmatrix}
+    1841             : /// \cos(|\Delta|) & 0 & 0 & \mathrm{i} \sin(|\Delta|) e^{\mathrm{i} \cdot \mathrm{angle}(\Delta)} \\\\
+    1842             : /// 0 & 1 & 0 & 0 \\\\
+    1843             : /// 0 & 0 & 1 & 0 \\\\
+    1844             : ///  \mathrm{i} \sin(|\Delta|) e^{-\mathrm{i} \cdot \mathrm{angle}(\Delta)} & 0 & 0 & \cos(|\Delta|)
+    1845             : /// \end{pmatrix}
+    1846             : /// $$
+    1847             : ///
+    1848             : #[allow(clippy::upper_case_acronyms)]
+    1849             : #[derive(
+    1850           1 :     Debug,
+    1851           4 :     Clone,
+    1852           8 :     PartialEq,
+    1853           1 :     roqoqo_derive::InvolveQubits,
+    1854           2 :     roqoqo_derive::Operate,
+    1855           6 :     roqoqo_derive::Substitute,
+    1856           8 :     roqoqo_derive::OperateTwoQubit,
+    1857             : )]
+    1858             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1859             : pub struct Bogoliubov {
+    1860             :     /// The index of the most significant qubit in the unitary representation.
+    1861             :     control: usize,
+    1862             :     /// The index of the least significant qubit in the unitary representation.
+    1863             :     target: usize,
+    1864             :     /// The real part of the complex Bogoliubov interaction strength $Re(\Delta)$
+    1865             :     delta_real: CalculatorFloat,
+    1866             :     /// The imaginary part of the complex Bogoliubov interaction strength $Im(\Delta)$
+    1867             :     delta_imag: CalculatorFloat,
+    1868             : }
+    1869             : 
+    1870             : #[allow(non_upper_case_globals)]
+    1871             : const TAGS_Bogoliubov: &[&str; 4] = &[
+    1872             :     "Operation",
+    1873             :     "GateOperation",
+    1874             :     "TwoQubitGateOperation",
+    1875             :     "Bogoliubov",
+    1876             : ];
+    1877             : 
+    1878             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1879             : impl OperateGate for Bogoliubov {
+    1880             :     /// Returns unitary matrix of the gate.
+    1881             :     ///
+    1882             :     /// # Returns
+    1883             :     ///
+    1884             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1885             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1886           4 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1887           4 :         let dr: f64 = f64::try_from(self.delta_real.clone())?;
+    1888           4 :         let di: f64 = f64::try_from(self.delta_imag.clone())?;
+    1889           4 :         let delta: Complex64 = Complex64::new(dr, di);
+    1890           4 :         let da: f64 = delta.norm(); //absolute value of delta
+    1891           4 :         let dp: f64 = delta.arg(); // phase of delta
+    1892           4 :         Ok(array![
+    1893           4 :             [
+    1894           4 :                 Complex64::new(da.cos(), 0.0),
+    1895           4 :                 Complex64::new(0.0, 0.0),
+    1896           4 :                 Complex64::new(0.0, 0.0),
+    1897           4 :                 Complex64::new((-1.0) * da.sin() * dp.sin(), da.sin() * dp.cos())
+    1898           4 :             ],
+    1899           4 :             [
+    1900           4 :                 Complex64::new(0.0, 0.0),
+    1901           4 :                 Complex64::new(1.0, 0.0),
+    1902           4 :                 Complex64::new(0.0, 0.0),
+    1903           4 :                 Complex64::new(0.0, 0.0)
+    1904           4 :             ],
+    1905           4 :             [
+    1906           4 :                 Complex64::new(0.0, 0.0),
+    1907           4 :                 Complex64::new(0.0, 0.0),
+    1908           4 :                 Complex64::new(1.0, 0.0),
+    1909           4 :                 Complex64::new(0.0, 0.0)
+    1910           4 :             ],
+    1911           4 :             [
+    1912           4 :                 Complex64::new(da.sin() * dp.sin(), da.sin() * dp.cos()),
+    1913           4 :                 Complex64::new(0.0, 0.0),
+    1914           4 :                 Complex64::new(0.0, 0.0),
+    1915           4 :                 Complex64::new(da.cos(), 0.0)
+    1916           4 :             ],
+    1917           4 :         ])
+    1918           4 :     }
+    1919             : }
+    1920             : 
+    1921             : /// Trait for all gate operations acting on exactly two qubits.
+    1922             : impl OperateTwoQubitGate for Bogoliubov {
+    1923             :     /// Returns [KakDecomposition] of the gate.
+    1924             :     ///
+    1925             :     /// # Returns
+    1926             :     ///
+    1927             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    1928           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    1929           4 :         let dr = self.delta_real.clone();
+    1930           4 :         let di = self.delta_imag.clone();
+    1931           4 :         let delta: CalculatorComplex = CalculatorComplex::new(dr, di);
+    1932           4 : 
+    1933           4 :         let mut circuit_b = Circuit::new();
+    1934           4 :         circuit_b += RotateZ::new(self.target, delta.arg());
+    1935           4 : 
+    1936           4 :         let mut circuit_a = Circuit::new();
+    1937           4 :         circuit_a += RotateZ::new(self.target, delta.arg() * (-1.0));
+    1938           4 : 
+    1939           4 :         KakDecomposition {
+    1940           4 :             global_phase: CalculatorFloat::ZERO,
+    1941           4 :             k_vector: [
+    1942           4 :                 delta.norm() / (2.0),
+    1943           4 :                 delta.norm() / (-2.0),
+    1944           4 :                 CalculatorFloat::ZERO,
+    1945           4 :             ],
+    1946           4 :             circuit_before: Some(circuit_b),
+    1947           4 :             circuit_after: Some(circuit_a),
+    1948           4 :         }
+    1949           4 :     }
+    1950             : }
+    1951             : 
+    1952             : /// The transversal interaction gate.
+    1953             : ///
+    1954             : /// $$
+    1955             : /// e^{-\mathrm{i} \theta (X_c X_t + Y_c Y_t)} = e^{-\mathrm{i} \theta (\sigma^+_c \sigma^-_t + \sigma^-_c \sigma^+_t)}
+    1956             : /// $$
+    1957             : /// Where $X_c$ is the Pauli matrix $\sigma^x$ acting on the control qubit, and $Y_t$ is the Pauli matrix $\sigma^y$ acting on the target qubit.
+    1958             : ///
+    1959             : #[allow(clippy::upper_case_acronyms)]
+    1960             : #[derive(
+    1961           1 :     Debug,
+    1962           4 :     Clone,
+    1963           8 :     PartialEq,
+    1964           1 :     roqoqo_derive::InvolveQubits,
+    1965          32 :     roqoqo_derive::Operate,
+    1966           6 :     roqoqo_derive::Substitute,
+    1967           6 :     roqoqo_derive::OperateTwoQubit,
+    1968             : )]
+    1969             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    1970             : pub struct PMInteraction {
+    1971             :     /// The index of the most significant qubit in the unitary representation.
+    1972             :     control: usize,
+    1973             :     /// The index of the least significant qubit in the unitary representation.
+    1974             :     target: usize,
+    1975             :     /// The strength of the rotation $\theta$.
+    1976             :     t: CalculatorFloat,
+    1977             : }
+    1978             : 
+    1979             : #[allow(non_upper_case_globals)]
+    1980             : const TAGS_PMInteraction: &[&str; 4] = &[
+    1981             :     "Operation",
+    1982             :     "GateOperation",
+    1983             :     "TwoQubitGateOperation",
+    1984             :     "PMInteraction",
+    1985             : ];
+    1986             : 
+    1987             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    1988             : impl OperateGate for PMInteraction {
+    1989             :     /// Returns unitary matrix of the gate.
+    1990             :     ///
+    1991             :     /// # Returns
+    1992             :     ///
+    1993             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    1994             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    1995           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    1996           2 :         let c: f64 = (f64::try_from(self.t.clone())?).cos();
+    1997           2 :         let s: f64 = (f64::try_from(self.t.clone())?).sin();
+    1998           2 :         Ok(array![
+    1999           2 :             [
+    2000           2 :                 Complex64::new(1.0, 0.0),
+    2001           2 :                 Complex64::new(0.0, 0.0),
+    2002           2 :                 Complex64::new(0.0, 0.0),
+    2003           2 :                 Complex64::new(0.0, 0.0)
+    2004           2 :             ],
+    2005           2 :             [
+    2006           2 :                 Complex64::new(0.0, 0.0),
+    2007           2 :                 Complex64::new(c, 0.0),
+    2008           2 :                 Complex64::new(0.0, (-1.0) * s),
+    2009           2 :                 Complex64::new(0.0, 0.0)
+    2010           2 :             ],
+    2011           2 :             [
+    2012           2 :                 Complex64::new(0.0, 0.0),
+    2013           2 :                 Complex64::new(0.0, (-1.0) * s),
+    2014           2 :                 Complex64::new(c, 0.0),
+    2015           2 :                 Complex64::new(0.0, 0.0)
+    2016           2 :             ],
+    2017           2 :             [
+    2018           2 :                 Complex64::new(0.0, 0.0),
+    2019           2 :                 Complex64::new(0.0, 0.0),
+    2020           2 :                 Complex64::new(0.0, 0.0),
+    2021           2 :                 Complex64::new(1.0, 0.0)
+    2022           2 :             ],
+    2023           2 :         ])
+    2024           2 :     }
+    2025             : }
+    2026             : 
+    2027             : /// Trait for all gate operations acting on exactly two qubits.
+    2028             : impl OperateTwoQubitGate for PMInteraction {
+    2029             :     /// Returns [KakDecomposition] of the gate.
+    2030             :     ///
+    2031             :     /// # Returns
+    2032             :     ///
+    2033             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    2034           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    2035           4 :         KakDecomposition {
+    2036           4 :             global_phase: CalculatorFloat::ZERO,
+    2037           4 :             k_vector: [
+    2038           4 :                 self.t.clone() / (-2.0),
+    2039           4 :                 self.t.clone() / (-2.0),
+    2040           4 :                 CalculatorFloat::ZERO,
+    2041           4 :             ],
+    2042           4 :             circuit_before: None,
+    2043           4 :             circuit_after: None,
+    2044           4 :         }
+    2045           4 :     }
+    2046             : }
+    2047             : 
+    2048             : /// The complex hopping gate.
+    2049             : ///
+    2050             : /// $$
+    2051             : /// e^{-\mathrm{i} \left[ Re(\theta) \cdot (X_c X_t + Y_c Y_t) - Im(\theta) \cdot (X_c Y_t - Y_c X_t) \right] }
+    2052             : /// $$
+    2053             : /// Where $X_c$ is the Pauli matrix $\sigma^x$ acting on the control qubit, and $Y_t$ is the Pauli matrix $\sigma^y$ acting on the target qubit.
+    2054             : ///
+    2055             : #[allow(clippy::upper_case_acronyms)]
+    2056             : #[derive(
+    2057           1 :     Debug,
+    2058           4 :     Clone,
+    2059           8 :     PartialEq,
+    2060           1 :     roqoqo_derive::InvolveQubits,
+    2061           2 :     roqoqo_derive::Operate,
+    2062           6 :     roqoqo_derive::Substitute,
+    2063           8 :     roqoqo_derive::OperateTwoQubit,
+    2064             : )]
+    2065             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    2066             : pub struct ComplexPMInteraction {
+    2067             :     /// The index of the most significant qubit in the unitary representation.
+    2068             :     control: usize,
+    2069             :     /// The index of the least significant qubit in the unitary representation.
+    2070             :     target: usize,
+    2071             :     /// The real part of the strength of the rotation $Re(\theta)$.
+    2072             :     t_real: CalculatorFloat,
+    2073             :     /// The imaginary part of the strength of the rotation $Im(\theta)$.
+    2074             :     t_imag: CalculatorFloat,
+    2075             : }
+    2076             : 
+    2077             : #[allow(non_upper_case_globals)]
+    2078             : const TAGS_ComplexPMInteraction: &[&str; 4] = &[
+    2079             :     "Operation",
+    2080             :     "GateOperation",
+    2081             :     "TwoQubitGateOperation",
+    2082             :     "ComplexPMInteraction",
+    2083             : ];
+    2084             : 
+    2085             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    2086             : impl OperateGate for ComplexPMInteraction {
+    2087             :     /// Returns unitary matrix of the gate.
+    2088             :     ///
+    2089             :     /// # Returns
+    2090             :     ///
+    2091             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    2092             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    2093           2 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    2094           2 :         let tr: f64 = f64::try_from(self.t_real.clone())?;
+    2095           2 :         let ti: f64 = f64::try_from(self.t_imag.clone())?;
+    2096           2 :         let t: Complex64 = Complex64::new(tr, ti);
+    2097           2 :         let tn: f64 = t.norm(); //absolute value of delta
+    2098           2 :         let ta: f64 = t.arg(); // phase of delta
+    2099           2 :         Ok(array![
+    2100           2 :             [
+    2101           2 :                 Complex64::new(1.0, 0.0),
+    2102           2 :                 Complex64::new(0.0, 0.0),
+    2103           2 :                 Complex64::new(0.0, 0.0),
+    2104           2 :                 Complex64::new(0.0, 0.0)
+    2105           2 :             ],
+    2106           2 :             [
+    2107           2 :                 Complex64::new(0.0, 0.0),
+    2108           2 :                 Complex64::new(tn.cos(), 0.0),
+    2109           2 :                 Complex64::new((-1.0) * tn.sin() * ta.sin(), (-1.0) * tn.sin() * ta.cos()),
+    2110           2 :                 Complex64::new(0.0, 0.0)
+    2111           2 :             ],
+    2112           2 :             [
+    2113           2 :                 Complex64::new(0.0, 0.0),
+    2114           2 :                 Complex64::new(tn.sin() * ta.sin(), (-1.0) * tn.sin() * ta.cos()),
+    2115           2 :                 Complex64::new(tn.cos(), 0.0),
+    2116           2 :                 Complex64::new(0.0, 0.0)
+    2117           2 :             ],
+    2118           2 :             [
+    2119           2 :                 Complex64::new(0.0, 0.0),
+    2120           2 :                 Complex64::new(0.0, 0.0),
+    2121           2 :                 Complex64::new(0.0, 0.0),
+    2122           2 :                 Complex64::new(1.0, 0.0)
+    2123           2 :             ],
+    2124           2 :         ])
+    2125           2 :     }
+    2126             : }
+    2127             : 
+    2128             : /// Trait for all gate operations acting on exactly two qubits.
+    2129             : impl OperateTwoQubitGate for ComplexPMInteraction {
+    2130             :     /// Returns [KakDecomposition] of the gate.
+    2131             :     ///
+    2132             :     /// # Returns
+    2133             :     ///
+    2134             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    2135           4 :     fn kak_decomposition(&self) -> KakDecomposition {
+    2136           4 :         let tr = self.t_real.clone();
+    2137           4 :         let ti = self.t_imag.clone();
+    2138           4 :         let t: CalculatorComplex = CalculatorComplex::new(tr, ti);
+    2139           4 : 
+    2140           4 :         let mut circuit_b = Circuit::new();
+    2141           4 :         circuit_b += RotateZ::new(self.target, t.arg());
+    2142           4 : 
+    2143           4 :         let mut circuit_a = Circuit::new();
+    2144           4 :         circuit_a += RotateZ::new(self.target, t.arg() * (-1.0));
+    2145           4 : 
+    2146           4 :         KakDecomposition {
+    2147           4 :             global_phase: CalculatorFloat::ZERO,
+    2148           4 :             k_vector: [t.norm() / (-2.0), t.norm() / (-2.0), CalculatorFloat::ZERO],
+    2149           4 :             circuit_before: Some(circuit_b),
+    2150           4 :             circuit_after: Some(circuit_a),
+    2151           4 :         }
+    2152           4 :     }
+    2153             : }
+    2154             : 
+    2155             : /// Implements the phased-shifted controlled-Z gate.
+    2156             : ///
+    2157             : /// Modified, i.e. phase-shifted ControlledPauliZ two-qubit gate (https://arxiv.org/pdf/1908.06101.pdf eq.(1)).
+    2158             : /// The unitary matrix representation is:
+    2159             : ///
+    2160             : /// $$
+    2161             : /// U = \begin{pmatrix}
+    2162             : /// 1 & 0 & 0 & 0 \\\\
+    2163             : /// 0 & e^{i \phi} & 0 & 0 \\\\
+    2164             : /// 0 & 0 & e^{i \phi} & 0 \\\\
+    2165             : /// 0 & 0 & 0 & e^{i (2\cdot\phi - \pi)}
+    2166             : /// \end{pmatrix}
+    2167             : /// $$
+    2168             : ///
+    2169             : #[allow(clippy::upper_case_acronyms)]
+    2170             : #[derive(
+    2171           1 :     Debug,
+    2172           4 :     Clone,
+    2173           8 :     PartialEq,
+    2174           1 :     roqoqo_derive::InvolveQubits,
+    2175          36 :     roqoqo_derive::Operate,
+    2176           6 :     roqoqo_derive::Substitute,
+    2177          26 :     roqoqo_derive::OperateTwoQubit,
+    2178             : )]
+    2179             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+    2180             : pub struct PhaseShiftedControlledZ {
+    2181             :     /// The index of the most significant qubit in the unitary representation. Here, the qubit that controls the application of the phase-shift on the target qubit.
+    2182             :     control: usize,
+    2183             :     /// The index of the least significant qubit in the unitary representation. Here, the qubit phase-shift is applied to.
+    2184             :     target: usize,
+    2185             :     /// The single qubit phase $\phi$.
+    2186             :     phi: CalculatorFloat,
+    2187             : }
+    2188             : 
+    2189             : #[allow(non_upper_case_globals)]
+    2190             : const TAGS_PhaseShiftedControlledZ: &[&str; 4] = &[
+    2191             :     "Operation",
+    2192             :     "GateOperation",
+    2193             :     "TwoQubitGateOperation",
+    2194             :     "PhaseShiftedControlledZ",
+    2195             : ];
+    2196             : 
+    2197             : /// Trait for all Operations acting with a unitary gate on a set of qubits.
+    2198             : impl OperateGate for PhaseShiftedControlledZ {
+    2199             :     /// Returns unitary matrix of the gate.
+    2200             :     ///
+    2201             :     /// # Returns
+    2202             :     ///
+    2203             :     /// * `Ok(Array2<Complex64>)` - The unitary matrix representation of the gate.
+    2204             :     /// * `Err(RoqoqoError)` - The conversion of parameters to f64 failed.
+    2205           6 :     fn unitary_matrix(&self) -> Result<Array2<Complex64>, RoqoqoError> {
+    2206             :         // exp(i*x) = cos(x)+i*sin(x)
+    2207           6 :         let phi: f64 = f64::try_from(self.phi.clone())?;
+    2208           6 :         let cos: f64 = phi.cos();
+    2209           6 :         let sin: f64 = phi.sin();
+    2210           6 :         let cos2: f64 = (2.0 * phi - PI).cos();
+    2211           6 :         let sin2: f64 = (2.0 * phi - PI).sin();
+    2212           6 :         Ok(array![
+    2213           6 :             [
+    2214           6 :                 Complex64::new(1.0, 0.0),
+    2215           6 :                 Complex64::new(0.0, 0.0),
+    2216           6 :                 Complex64::new(0.0, 0.0),
+    2217           6 :                 Complex64::new(0.0, 0.0)
+    2218           6 :             ],
+    2219           6 :             [
+    2220           6 :                 Complex64::new(0.0, 0.0),
+    2221           6 :                 Complex64::new(cos, sin),
+    2222           6 :                 Complex64::new(0.0, 0.0),
+    2223           6 :                 Complex64::new(0.0, 0.0)
+    2224           6 :             ],
+    2225           6 :             [
+    2226           6 :                 Complex64::new(0.0, 0.0),
+    2227           6 :                 Complex64::new(0.0, 0.0),
+    2228           6 :                 Complex64::new(cos, sin),
+    2229           6 :                 Complex64::new(0.0, 0.0)
+    2230           6 :             ],
+    2231           6 :             [
+    2232           6 :                 Complex64::new(0.0, 0.0),
+    2233           6 :                 Complex64::new(0.0, 0.0),
+    2234           6 :                 Complex64::new(0.0, 0.0),
+    2235           6 :                 Complex64::new(cos2, sin2)
+    2236           6 :             ],
+    2237           6 :         ])
+    2238           6 :     }
+    2239             : }
+    2240             : 
+    2241             : /// Trait for all gate operations acting on exactly two qubits.
+    2242             : impl OperateTwoQubitGate for PhaseShiftedControlledZ {
+    2243             :     /// Returns [KakDecomposition] of the gate.
+    2244             :     ///
+    2245             :     /// # Returns
+    2246             :     ///
+    2247             :     /// * struct `KakDecomposition { global_phase, k_vector, circuit_before, circuit_after }`
+    2248          12 :     fn kak_decomposition(&self) -> KakDecomposition {
+    2249          12 :         let mut circuit_b = Circuit::new();
+    2250          12 :         circuit_b += RotateZ::new(self.control, CalculatorFloat::FRAC_PI_2);
+    2251          12 :         circuit_b += RotateZ::new(self.target, CalculatorFloat::FRAC_PI_2);
+    2252          12 : 
+    2253          12 :         let mut circuit_a = Circuit::new();
+    2254          12 :         circuit_a += RotateZ::new(self.control, self.phi.clone());
+    2255          12 :         circuit_a += RotateZ::new(self.target, self.phi.clone());
+    2256          12 : 
+    2257          12 :         let g: CalculatorFloat = CalculatorFloat::FRAC_PI_4 + self.phi.clone();
+    2258          12 :         KakDecomposition {
+    2259          12 :             global_phase: g,
+    2260          12 :             k_vector: [
+    2261          12 :                 CalculatorFloat::ZERO,
+    2262          12 :                 CalculatorFloat::ZERO,
+    2263          12 :                 CalculatorFloat::FRAC_PI_4,
+    2264          12 :             ],
+    2265          12 :             circuit_before: Some(circuit_b),
+    2266          12 :             circuit_after: Some(circuit_a),
+    2267          12 :         }
+    2268          12 :     }
+    2269             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/quantum_program.rs.func-sort-c.html b/roqoqo/coveragehtml/src/quantum_program.rs.func-sort-c.html new file mode 100644 index 00000000..2455fc17 --- /dev/null +++ b/roqoqo/coveragehtml/src/quantum_program.rs.func-sort-c.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.lcov - src/quantum_program.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - quantum_program.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:4646100.0 %
Date:2021-11-09 13:25:48Functions:66100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::quantum_program::QuantumProgram>::run::<integration::quantum_program::TestBackend>1
<roqoqo::quantum_program::QuantumProgram>::run::<integration::quantum_program::TestBackend>::{closure#0}1
<roqoqo::quantum_program::QuantumProgram>::run::<integration::quantum_program::TestBackend>::{closure#1}1
<roqoqo::quantum_program::QuantumProgram>::run::<integration::quantum_program::TestBackend>::{closure#2}1
<roqoqo::quantum_program::QuantumProgram>::run_registers::<integration::quantum_program::TestBackend>1
<roqoqo::quantum_program::QuantumProgram>::run_registers::<integration::quantum_program::TestBackend>::{closure#0}1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/quantum_program.rs.func.html b/roqoqo/coveragehtml/src/quantum_program.rs.func.html new file mode 100644 index 00000000..be4e959a --- /dev/null +++ b/roqoqo/coveragehtml/src/quantum_program.rs.func.html @@ -0,0 +1,96 @@ + + + + + + + LCOV - coverage.lcov - src/quantum_program.rs - functions + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - quantum_program.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:4646100.0 %
Date:2021-11-09 13:25:48Functions:66100.0 %
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Function Name Sort by function nameHit count Sort by hit count
<roqoqo::quantum_program::QuantumProgram>::run::<integration::quantum_program::TestBackend>1
<roqoqo::quantum_program::QuantumProgram>::run::<integration::quantum_program::TestBackend>::{closure#0}1
<roqoqo::quantum_program::QuantumProgram>::run::<integration::quantum_program::TestBackend>::{closure#1}1
<roqoqo::quantum_program::QuantumProgram>::run::<integration::quantum_program::TestBackend>::{closure#2}1
<roqoqo::quantum_program::QuantumProgram>::run_registers::<integration::quantum_program::TestBackend>1
<roqoqo::quantum_program::QuantumProgram>::run_registers::<integration::quantum_program::TestBackend>::{closure#0}1
+
+
+ + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/src/quantum_program.rs.gcov.html b/roqoqo/coveragehtml/src/quantum_program.rs.gcov.html new file mode 100644 index 00000000..173b5643 --- /dev/null +++ b/roqoqo/coveragehtml/src/quantum_program.rs.gcov.html @@ -0,0 +1,241 @@ + + + + + + + LCOV - coverage.lcov - src/quantum_program.rs + + + + + + + + + + + + + + +
LCOV - code coverage report
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Current view:top level - src - quantum_program.rs (source / functions)HitTotalCoverage
Test:coverage.lcovLines:4646100.0 %
Date:2021-11-09 13:25:48Functions:66100.0 %
+
+ + + + + + + + +

+
          Line data    Source code
+
+       1             : // Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
+       2             : //
+       3             : // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+       4             : // in compliance with the License. You may obtain a copy of the License at
+       5             : //
+       6             : //     http://www.apache.org/licenses/LICENSE-2.0
+       7             : //
+       8             : // Unless required by applicable law or agreed to in writing, software distributed under the
+       9             : // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+      10             : // express or implied. See the License for the specific language governing permissions and
+      11             : // limitations under the License.
+      12             : 
+      13             : use std::collections::HashMap;
+      14             : 
+      15             : use crate::backends::{EvaluatingBackend, RegisterResult};
+      16             : use crate::measurements;
+      17             : use crate::measurements::Measure;
+      18             : use crate::RoqoqoBackendError;
+      19             : use std::fmt::{Display, Formatter};
+      20             : /// Represents a quantum program evaluating measurements based on a one or more free float parameters.
+      21             : ///
+      22             : /// The main use of QuantumProgram is to contain a Measurements implementing [crate::measurements::Measure]
+      23             : /// that measures expectation values or output registers of [crate::Circuit] quantum circuits that contain
+      24             : /// symbolic parameters. Circuit with symbolic parameters can not be simulated or executed on real hardware.
+      25             : /// The symbolic parameters need to be replaced with real floating point numbers first.
+      26             : /// A QuantumProgram contains a list of the free parameters (`input_parameter_names`) and can automatically
+      27             : /// replace the parameters with its `run` methods and return the result.
+      28             : ///
+      29             : /// The QuantumProgram should correspond as closely as possible to a normal mulit-parameter function
+      30             : /// in classical computing that can be called with a set of parameters and returns a result.
+      31             : /// It is the intended way to interface between normal program code and roqoqo based quantum programs.
+      32             : ///
+      33             : #[derive(Debug, PartialEq, Clone)]
+      34             : #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
+      35             : pub enum QuantumProgram {
+      36             :     /// Variant for basis rotation measurement based quantum programs
+      37             :     BasisRotation {
+      38             :         /// The measurement that is performed
+      39             :         measurement: measurements::BasisRotation,
+      40             :         /// List of free input parameters that can be set when the QuantumProgram is executed
+      41             :         input_parameter_names: Vec<String>,
+      42             :     },
+      43             :     /// Variant for cheated basis rotation measurement based quantum programs
+      44             :     CheatedBasisRotation {
+      45             :         /// The measurement that is performed
+      46             :         measurement: measurements::CheatedBasisRotation,
+      47             :         /// List of free input parameters that can be set when the QuantumProgram is executed
+      48             :         input_parameter_names: Vec<String>,
+      49             :     },
+      50             :     /// Variant for statevector/density matrix based measurements
+      51             :     Cheated {
+      52             :         /// The measurement that is performed
+      53             :         measurement: measurements::Cheated,
+      54             :         /// List of free input parameters that can be set when the QuantumProgram is executed
+      55             :         input_parameter_names: Vec<String>,
+      56             :     },
+      57             :     /// Variant quantum programs returning full classical registers
+      58             :     ClassicalRegister {
+      59             :         /// The measurement that is performed
+      60             :         measurement: measurements::ClassicalRegister,
+      61             :         /// List of free input parameters that can be set when the QuantumProgram is executed
+      62             :         input_parameter_names: Vec<String>,
+      63             :     },
+      64             : }
+      65             : 
+      66             : impl QuantumProgram {
+      67             :     /// Runs the QuantumProgram and returns expectation values.
+      68             :     ///
+      69             :     /// Runs the quantum programm for a given set of parameters passed in the same order as the parameters
+      70             :     /// listed in `input_parameter_names` and returns expectation values.
+      71             :     ///
+      72             :     /// Arguments:
+      73             :     ///
+      74             :     /// * `backend` - The backend the program is executed on.
+      75             :     /// * `parameters` - List of float ([f64]) parameters of the function call in order of `input_parameter_names`
+      76          10 :     pub fn run<T>(
+      77          10 :         &self,
+      78          10 :         backend: T,
+      79          10 :         parameters: &[f64],
+      80          10 :     ) -> Result<Option<HashMap<String, f64>>, RoqoqoBackendError>
+      81          10 :     where
+      82          10 :         T: EvaluatingBackend,
+      83          10 :     {
+      84          10 :         match self{
+      85           3 :             QuantumProgram::BasisRotation{measurement, input_parameter_names } => {
+      86           3 :                 if parameters.len() != input_parameter_names.len() { return Err(RoqoqoBackendError::GenericError{msg: format!("Wrong number of parameters {} parameters expected {} parameters given", input_parameter_names.len(), parameters.len())})};
+      87           2 :                 let substituted_parameters: HashMap<String, f64> = input_parameter_names.iter().zip(parameters.iter()).map(|(key, value)| (key.clone(), *value)).collect();
+      88           1 :                 let substituted_measurement = measurement.substitute_parameters(
+      89           1 :                     substituted_parameters
+      90           1 :                 )?;
+      91           1 :                 backend.run_measurement(&substituted_measurement)
+      92             :             }
+      93           3 :             QuantumProgram::CheatedBasisRotation{measurement, input_parameter_names } => {
+      94           3 :                 if parameters.len() != input_parameter_names.len() { return Err(RoqoqoBackendError::GenericError{msg: format!("Wrong number of parameters {} parameters expected {} parameters given", input_parameter_names.len(), parameters.len())})};
+      95           2 :                 let substituted_parameters: HashMap<String, f64> = input_parameter_names.iter().zip(parameters.iter()).map(|(key, value)| (key.clone(), *value)).collect();
+      96           1 :                 let substituted_measurement = measurement.substitute_parameters(
+      97           1 :                     substituted_parameters
+      98           1 :                 )?;
+      99           1 :                 backend.run_measurement(&substituted_measurement)
+     100             :             }
+     101           3 :             QuantumProgram::Cheated{measurement, input_parameter_names } => {
+     102           3 :                 if parameters.len() != input_parameter_names.len() { return Err(RoqoqoBackendError::GenericError{msg: format!("Wrong number of parameters {} parameters expected {} parameters given", input_parameter_names.len(), parameters.len())})};
+     103           2 :                 let substituted_parameters: HashMap<String, f64> = input_parameter_names.iter().zip(parameters.iter()).map(|(key, value)| (key.clone(), *value)).collect();
+     104           1 :                 let substituted_measurement = measurement.substitute_parameters(
+     105           1 :                     substituted_parameters
+     106           1 :                 )?;
+     107           1 :                 backend.run_measurement(&substituted_measurement)
+     108             :             }
+     109           1 :             _ => Err(RoqoqoBackendError::GenericError{msg: "A quantum programm returning classical registeres cannot be executed by `run` use `run_registers` instead".to_string()})
+     110             :         }
+     111          10 :     }
+     112             : 
+     113             :     /// Runs the QuantumProgram and returns the classical registers of the quantum program.
+     114             :     ///
+     115             :     /// Runs the quantum programm for a given set of parameters passed in the same order as the parameters
+     116             :     /// listed in `input_parameter_names` and returns the classical register output.  
+     117             :     /// The classical registers usually contain a record of measurement values for the repeated execution
+     118             :     /// of a [crate::Circuit] quantum circuit for real quantum hardware
+     119             :     /// or the readout of the statevector or the density matrix for simulators.
+     120             :     ///
+     121             :     /// Arguments:
+     122             :     ///
+     123             :     /// * `backend` - The backend the program is executed on.
+     124             :     /// * `parameters` - List of float ([f64]) parameters of the function call in order of `input_parameter_names`
+     125           6 :     pub fn run_registers<T>(&self, backend: T, parameters: &[f64]) -> RegisterResult
+     126           6 :     where
+     127           6 :         T: EvaluatingBackend,
+     128           6 :     {
+     129           6 :         match self{
+     130           3 :             QuantumProgram::ClassicalRegister{measurement, input_parameter_names } => {
+     131           3 :                 if parameters.len() != input_parameter_names.len() { return Err(RoqoqoBackendError::GenericError{msg: format!("Wrong number of parameters {} parameters expected {} parameters given", input_parameter_names.len(), parameters.len())})};
+     132           2 :                 let substituted_parameters: HashMap<String, f64> = input_parameter_names.iter().zip(parameters.iter()).map(|(key, value)| (key.clone(), *value)).collect();
+     133           1 :                 let substituted_measurement = measurement.substitute_parameters(
+     134           1 :                     substituted_parameters
+     135           1 :                 )?;
+     136           1 :                 backend.run_measurement_registers(&substituted_measurement)
+     137             :             }
+     138           3 :             _ => Err(RoqoqoBackendError::GenericError{msg: "A quantum programm returning expectation values cannot be executed by `run_registers` use `run` instead".to_string()})
+     139             :         }
+     140           6 :     }
+     141             : }
+     142             : 
+     143             : /// Implements the Display trait for QuantumProgram.
+     144             : impl Display for QuantumProgram {
+     145             :     fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+     146             :         let mut s: String = String::new();
+     147             : 
+     148             :         match self {
+     149             :             QuantumProgram::BasisRotation { .. } => {
+     150             :                 s.push_str(&"QuantumProgram::BasisRotation".to_string());
+     151             :             }
+     152             :             QuantumProgram::CheatedBasisRotation { .. } => {
+     153             :                 s.push_str(&"QuantumProgram::CheatedBasisRotation".to_string());
+     154             :             }
+     155             :             QuantumProgram::Cheated { .. } => {
+     156             :                 s.push_str(&"QuantumProgram::Cheated".to_string());
+     157             :             }
+     158             :             QuantumProgram::ClassicalRegister { .. } => {
+     159             :                 s.push_str(&"QuantumProgram::ClassicalRegister".to_string());
+     160             :             }
+     161             :         }
+     162             : 
+     163             :         write!(f, "{}", s)
+     164             :     }
+     165             : }
+
+
+
+ + + + +
Generated by: LCOV version 1.13
+
+ + + diff --git a/roqoqo/coveragehtml/updown.png b/roqoqo/coveragehtml/updown.png new file mode 100644 index 0000000000000000000000000000000000000000..aa56a238b3e6c435265250f9266cd1b8caba0f20 GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^AT}Qd8;}%R+`Ae`*?77*hG?8mPH5^{)z4*}Q$iB}huR`+ literal 0 HcmV?d00001 diff --git a/roqoqo/tests/integration/operations/two_qubit_gate_operations.rs b/roqoqo/tests/integration/operations/two_qubit_gate_operations.rs index f52d2a29..bd80dcaf 100644 --- a/roqoqo/tests/integration/operations/two_qubit_gate_operations.rs +++ b/roqoqo/tests/integration/operations/two_qubit_gate_operations.rs @@ -26,47 +26,15 @@ use std::convert::TryInto; use std::f64::consts::PI; use test_case::test_case; -// helper function to convert a two-dimensional ndarray to a 2x2 matrix -// output can be used to be converted into a nalebra matrix with `na::Matrix2::from()` -fn convert_array2_matrix2(customarray: Array2) -> [[Complex64; 2]; 2] { - let mut overall_vec: Vec<[Complex64; 2]> = Vec::new(); - for i in 0..2 { - let mut this_vec: Vec = Vec::new(); - for j in 0..2 { - // CAUTION! indices are: "column, row" as required for the naalgebra Matrix in the post-processing - this_vec.push(customarray[[j, i]]); - } - let this_vec_to_array: [Complex64; 2] = this_vec.try_into().unwrap(); - overall_vec.push(this_vec_to_array); - } - let overall_array: [[Complex64; 2]; 2] = [overall_vec[0], overall_vec[1]]; - overall_array -} - // helper function to convert a two-dimensional ndarray to a 4x4 matrix -// output can be used to be converted into a nalebra matrix with `na::Matrix4::from()` -fn convert_array2_matrix4(customarray: Array2) -> [[Complex64; 4]; 4] { - let mut overall_vec: Vec<[Complex64; 4]> = Vec::new(); - for i in 0..4 { - let mut this_vec: Vec = Vec::new(); - for j in 0..4 { - // CAUTION! indices are: "column, row" as required for the naalgebra Matrix in the post-processing - this_vec.push(customarray[[j, i]]); - } - let this_vec_to_array: [Complex64; 4] = this_vec.try_into().unwrap(); - overall_vec.push(this_vec_to_array); - } - let overall_array: [[Complex64; 4]; 4] = [ - overall_vec[0], - overall_vec[1], - overall_vec[2], - overall_vec[3], - ]; - overall_array +// output can be used to be converted into a nalgebra matrix with `na::Matrix4::from()` +fn convert_matrix(customarray: Array2) -> na::DMatrix { + let dim = customarray.dim(); + na::DMatrix::::from_iterator(dim.0, dim.1, customarray.t().iter().cloned()) } // helper function to convert a complex matrix to a matrix with real absolute values -fn convert_normsqr(customarray: na::Matrix4) -> [[f64; 4]; 4] { +fn convert_normsqr(customarray: na::DMatrix) -> [[f64; 4]; 4] { let mut overall_vec: Vec<[f64; 4]> = Vec::new(); for i in [0, 4, 8, 12].iter() { let mut this_vec: Vec = Vec::new(); @@ -163,12 +131,11 @@ fn kak_sigma_matrix( fn test_kakdecomposition(gate: TwoQubitGateOperation) { // k vector let k = gate.kak_decomposition().k_vector; - let sigma_matrix: na::Matrix4 = - na::Matrix4::::from(convert_array2_matrix4(kak_sigma_matrix( - k[0].clone() * (-1.0), - k[1].clone() * (-1.0), - k[2].clone() * (-1.0), - ))); + let sigma_matrix: na::DMatrix = convert_matrix(kak_sigma_matrix( + k[0].clone() * (-1.0), + k[1].clone() * (-1.0), + k[2].clone() * (-1.0), + )); // global phase let g = gate.kak_decomposition().global_phase; @@ -209,13 +176,11 @@ fn test_kakdecomposition(gate: TwoQubitGateOperation) { } } - let target_before_matrix: na::Matrix2 = na::Matrix2::from(convert_array2_matrix2( - target_before.unitary_matrix().unwrap(), - )); - let control_before_matrix: na::Matrix2 = na::Matrix2::from(convert_array2_matrix2( - control_before.unitary_matrix().unwrap(), - )); - let matrix_before: na::Matrix4 = + let target_before_matrix: na::DMatrix = + convert_matrix(target_before.unitary_matrix().unwrap()); + let control_before_matrix: na::DMatrix = + convert_matrix(control_before.unitary_matrix().unwrap()); + let matrix_before: na::DMatrix = control_before_matrix.kronecker(&target_before_matrix); // determine matrix after entanglement @@ -249,17 +214,14 @@ fn test_kakdecomposition(gate: TwoQubitGateOperation) { } } - let target_after_matrix: na::Matrix2 = na::Matrix2::from(convert_array2_matrix2( - target_after.unitary_matrix().unwrap(), - )); - let control_after_matrix: na::Matrix2 = na::Matrix2::from(convert_array2_matrix2( - control_after.unitary_matrix().unwrap(), - )); - let matrix_after: na::Matrix4 = control_after_matrix.kronecker(&target_after_matrix); + let target_after_matrix: na::DMatrix = + convert_matrix(target_after.unitary_matrix().unwrap()); + let control_after_matrix: na::DMatrix = + convert_matrix(control_after.unitary_matrix().unwrap()); + let matrix_after: na::DMatrix = control_after_matrix.kronecker(&target_after_matrix); let decomposed_matrix = matrix_after * sigma_matrix * matrix_before * phase; - let test_matrix: na::Matrix4 = - na::Matrix4::from(convert_array2_matrix4(gate.unitary_matrix().unwrap())); + let test_matrix: na::DMatrix = convert_matrix(gate.unitary_matrix().unwrap()); let epsilon = 1e-12; for i in 0..16 { @@ -303,9 +265,9 @@ fn test_twoqubitgates_unitarity(gate: GateOperation) { let result_array: Array2 = result.unwrap(); // check unitarity with nalgebra // convert ndarray into nalgebra matrix - let result_matrix = na::Matrix4::from(convert_array2_matrix4(result_array)); + let result_matrix: na::DMatrix = convert_matrix(result_array); // calculate matrix product A*A_dagger - let product = result_matrix * result_matrix.adjoint(); + let product = result_matrix.clone() * result_matrix.adjoint(); // convert complex matrix product into real matrix by taking the absolute value of the complex number, which should be sufficient if the matrix is unitary. let matrix_norm: na::Matrix4 = na::Matrix4::from(convert_normsqr(product)); let epsilon = 1e-12; From 5872db5c1d121a1c6e98fe1ad252a29f3d6f08f5 Mon Sep 17 00:00:00 2001 From: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> Date: Wed, 10 Nov 2021 11:35:54 +0100 Subject: [PATCH 02/11] Update build_and_deploy.yml --- .github/workflows/build_and_deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index f919e300..438a393e 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -44,7 +44,7 @@ jobs: {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, {py: 3.9, interpreter: "python3.9"}, - {py: 3.10, interpreter: "python3.10"} + # {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 @@ -87,7 +87,7 @@ jobs: {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, {py: 3.9, interpreter: "python3.9"}, - {py: 3.10, interpreter: "python3.10"} + # {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 @@ -126,7 +126,7 @@ jobs: {py: 3.7, interpreter: "python3.7"}, {py: 3.8, interpreter: "python3.8"}, {py: 3.9, interpreter: "python3.9"}, - {py: 3.10, interpreter: "python3.10"} + # {py: 3.10, interpreter: "python3.10"} ] steps: - uses: actions/checkout@v2 From 345ba55af81f6d18fd6571184547e030e0e36bc8 Mon Sep 17 00:00:00 2001 From: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> Date: Wed, 10 Nov 2021 13:42:53 +0100 Subject: [PATCH 03/11] Update Cargo.toml --- qoqo/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qoqo/Cargo.toml b/qoqo/Cargo.toml index 0bc5a3fc..39e316ed 100644 --- a/qoqo/Cargo.toml +++ b/qoqo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "qoqo" -version = "0.8.1" +version = "0.8.2" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" homepage = "https://github.com/HQSquantumsimulations/qoqo" @@ -58,4 +58,4 @@ default = ["extension-module"] requires-dist = ["numpy", "qoqo_calculator_pyo3>=0.5"] maintainer = "HQS Quantum Simulations GmbH" maintainer-email = "info@quantumsimulations.de" -requires-python = ">=3.6" \ No newline at end of file +requires-python = ">=3.6" From 0da6b9da0db83bb1dbbdf4e3a29a92be60e6b74a Mon Sep 17 00:00:00 2001 From: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> Date: Wed, 10 Nov 2021 13:43:07 +0100 Subject: [PATCH 04/11] Update Cargo.toml --- qoqo-macros/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qoqo-macros/Cargo.toml b/qoqo-macros/Cargo.toml index 0da312f9..641d3560 100644 --- a/qoqo-macros/Cargo.toml +++ b/qoqo-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "qoqo-macros" -version = "0.8.1" +version = "0.8.2" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" readme = "../README.md" From e6e1a3ea341fa7e5dbb34a64227765cf480751ef Mon Sep 17 00:00:00 2001 From: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> Date: Wed, 10 Nov 2021 13:43:24 +0100 Subject: [PATCH 05/11] Update Cargo.toml --- roqoqo-derive/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roqoqo-derive/Cargo.toml b/roqoqo-derive/Cargo.toml index 5084e3f1..fd7bf1dd 100644 --- a/roqoqo-derive/Cargo.toml +++ b/roqoqo-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "roqoqo-derive" -version = "0.8.1" +version = "0.8.2" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" edition = "2021" From 2da8120ef4934688966db677ca9229d3ca2d806f Mon Sep 17 00:00:00 2001 From: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> Date: Wed, 10 Nov 2021 13:43:37 +0100 Subject: [PATCH 06/11] Update Cargo.toml --- roqoqo-test/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roqoqo-test/Cargo.toml b/roqoqo-test/Cargo.toml index b7560dfe..155ec352 100644 --- a/roqoqo-test/Cargo.toml +++ b/roqoqo-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "roqoqo-test" -version = "0.8.1" +version = "0.8.2" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" edition = "2021" @@ -28,4 +28,4 @@ ndarray = { version = "0.15" } [build-dependencies] quote = "1.0" syn = { version = "1.0", features = ["full", "visit"] } -proc-macro2 = "1.0" \ No newline at end of file +proc-macro2 = "1.0" From 8e2d428242697204bc011f9930fac67163c819e8 Mon Sep 17 00:00:00 2001 From: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> Date: Wed, 10 Nov 2021 13:43:53 +0100 Subject: [PATCH 07/11] Update Cargo.toml --- roqoqo/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roqoqo/Cargo.toml b/roqoqo/Cargo.toml index 9b420fd7..a9160acd 100644 --- a/roqoqo/Cargo.toml +++ b/roqoqo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "roqoqo" -version = "0.8.1" +version = "0.8.2" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" edition = "2021" From 0041be337b05643eccb323724f84620b61e8176e Mon Sep 17 00:00:00 2001 From: Nicolas Vogt <45093608+nfwvogt@users.noreply.github.com> Date: Thu, 18 Nov 2021 14:31:09 +0100 Subject: [PATCH 08/11] Add_mulit_qubit_cz (#131) * update dependencies * updated dependencies * Added MultiQubitZZ gate * Added changelog entry --- .gitignore | 4 +- CHANGELOG.md | 6 + Cargo.lock | 10 +- qoqo/src/operations/mod.rs | 1 + .../operations/multi_qubit_gate_operations.rs | 15 + roqoqo-test/src/stochastic_gate_test.rs | 2 +- .../operations/multi_qubit_gate_operations.rs | 62 ++++ .../operations/multi_qubit_gate_operations.rs | 269 ++++++++++++++++++ 8 files changed, 361 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index e0e0d7aa..e5336240 100644 --- a/.gitignore +++ b/.gitignore @@ -4,13 +4,13 @@ target/* *.mypy_cache* *.egg-info* *.coverage -*coveragehtml/* +*coveragehtml* */docs/_build* */docs/generated* *.DS_Store *.ipynb_checkpoints* *.json *.yaml -.vscode/* +*.vscode* *.profraw *.lcov diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ac56719..6edbe3cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,13 @@ This changelog track changes to the qoqo project starting at version 0.5.0 ## Not released + +### Added not released + +* MultiQubitZZ gate. Rotation under a multi-qubit product of Pauli Z operators. + ## 0.8.1 + ### Changed 0.8.1 * Updated to pyo3 0.15.0 diff --git a/Cargo.lock b/Cargo.lock index f4003e13..087073b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -417,7 +417,7 @@ dependencies = [ [[package]] name = "qoqo" -version = "0.8.1" +version = "0.8.2" dependencies = [ "bincode", "nalgebra", @@ -440,7 +440,7 @@ dependencies = [ [[package]] name = "qoqo-macros" -version = "0.8.1" +version = "0.8.2" dependencies = [ "proc-macro2", "quote", @@ -547,7 +547,7 @@ dependencies = [ [[package]] name = "roqoqo" -version = "0.8.1" +version = "0.8.2" dependencies = [ "bincode", "dyn-clone", @@ -570,7 +570,7 @@ dependencies = [ [[package]] name = "roqoqo-derive" -version = "0.8.1" +version = "0.8.2" dependencies = [ "proc-macro2", "quote", @@ -579,7 +579,7 @@ dependencies = [ [[package]] name = "roqoqo-test" -version = "0.8.1" +version = "0.8.2" dependencies = [ "nalgebra", "ndarray", diff --git a/qoqo/src/operations/mod.rs b/qoqo/src/operations/mod.rs index a0e023b0..072d6208 100644 --- a/qoqo/src/operations/mod.rs +++ b/qoqo/src/operations/mod.rs @@ -179,5 +179,6 @@ pub fn operations(_py: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?; + m.add_class::()?; Ok(()) } diff --git a/qoqo/src/operations/multi_qubit_gate_operations.rs b/qoqo/src/operations/multi_qubit_gate_operations.rs index 03ec96cb..08fa7e19 100644 --- a/qoqo/src/operations/multi_qubit_gate_operations.rs +++ b/qoqo/src/operations/multi_qubit_gate_operations.rs @@ -28,9 +28,24 @@ use std::collections::HashMap; #[wrap(Operate, Rotate, OperateMultiQubit, OperateGate, OperateMultiQubitGate)] /// The Molmer-Sorensen gate between multiple qubits. /// +/// The gate applies the rotation under the product of Pauli X operators on multiple qubits. +/// In mathematical terms the gate applies exp(-i * theta/2 * X_i0 * X_i1 * ... * X_in). pub struct MultiQubitMS { /// The qubits involved in the multi qubit Molmer-Sorensen gate. qubits: Vec, /// The angle of the multi qubit Molmer-Sorensen gate. theta: CalculatorFloat, } + +#[allow(clippy::upper_case_acronyms)] +#[wrap(Operate, Rotate, OperateMultiQubit, OperateGate, OperateMultiQubitGate)] +/// The multi qubit Pauli-Z-Product gate. +/// +/// The gate applies the rotation under the product of Pauli Z operators on multiple qubits. +/// In mathematical terms the gate applies exp(-i * theta/2 * Z_i0 * Z_i1 * ... * Z_in). +pub struct MultiQubitZZ { + /// The qubits involved in the multi qubit Molmer-Sorensen gate. + qubits: Vec, + /// The angle of the multi qubit Molmer-Sorensen gate. + theta: CalculatorFloat, +} diff --git a/roqoqo-test/src/stochastic_gate_test.rs b/roqoqo-test/src/stochastic_gate_test.rs index a3fd2dfc..c912084f 100644 --- a/roqoqo-test/src/stochastic_gate_test.rs +++ b/roqoqo-test/src/stochastic_gate_test.rs @@ -162,6 +162,6 @@ pub fn prepare_monte_carlo_gate_test( fn ndarray_to_nalgebra(input: Array2>) -> DMatrix> { let shape = input.shape(); let matrix: DMatrix> = - DMatrix::from_iterator(shape[0], shape[1], input.iter().cloned()); + DMatrix::from_iterator(shape[0], shape[1], input.t().iter().cloned()); matrix } diff --git a/roqoqo/src/operations/multi_qubit_gate_operations.rs b/roqoqo/src/operations/multi_qubit_gate_operations.rs index 674e1254..75dc939a 100644 --- a/roqoqo/src/operations/multi_qubit_gate_operations.rs +++ b/roqoqo/src/operations/multi_qubit_gate_operations.rs @@ -24,6 +24,8 @@ use serde::{Deserialize, Serialize}; /// The Molmer-Sorensen gate between multiple qubits. /// +/// The gate applies the rotation under the product of Pauli X operators on multiple qubits. +/// In mathematical terms the gate applies exp(-i * theta/2 * X_i0 * X_i1 * ... * X_in). #[allow(clippy::upper_case_acronyms)] #[derive( Debug, @@ -86,3 +88,63 @@ impl OperateMultiQubitGate for MultiQubitMS { circuit } } + +/// The multi qubit Pauli-Z-Product gate. +/// +/// The gate applies the rotation under the product of Pauli Z operators on multiple qubits. +/// In mathematical terms the gate applies exp(-i * theta/2 * Z_i0 * Z_i1 * ... * Z_in). +#[allow(clippy::upper_case_acronyms)] +#[derive( + Debug, + Clone, + PartialEq, + roqoqo_derive::InvolveQubits, + roqoqo_derive::Operate, + roqoqo_derive::Substitute, + roqoqo_derive::OperateMultiQubit, + roqoqo_derive::Rotate, +)] +#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] +pub struct MultiQubitZZ { + /// The qubits involved in the multi qubit Molmer-Sorensen gate. + qubits: Vec, + /// The angle of the multi qubit Molmer-Sorensen gate. + theta: CalculatorFloat, +} + +#[allow(non_upper_case_globals)] +const TAGS_MultiQubitZZ: &[&str; 4] = &[ + "Operation", + "GateOperation", + "MultiQubitGateOperation", + "MultiQubitZZ", +]; + +impl OperateGate for MultiQubitZZ { + fn unitary_matrix(&self) -> Result, RoqoqoError> { + let dim = 2_usize.pow(self.qubits.len() as u32); + let mut array: Array2 = Array2::zeros((dim, dim)); + let cos: Complex64 = Complex64::new((self.theta.float()? / 2.0).cos(), 0.0); + let sin: Complex64 = Complex64::new(0.0, -(self.theta.float()? / 2.0).sin()); + for i in 0..dim { + array[(i, i)] = cos + sin; + } + Ok(array) + } +} + +impl OperateMultiQubitGate for MultiQubitZZ { + // Todo fill out circuit + fn circuit(&self) -> Circuit { + let dim = self.qubits.len(); + let mut circuit = Circuit::new(); + for q in self.qubits[1..].iter() { + circuit += operations::CNOT::new(*q - 1, *q); + } + circuit += operations::RotateZ::new(dim - 1, self.theta.clone() / 2); + for q in self.qubits[1..].iter() { + circuit += operations::CNOT::new(dim - *q - 1, dim - *q); + } + circuit + } +} diff --git a/roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs b/roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs index c9c428fd..29a9c01a 100644 --- a/roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs +++ b/roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs @@ -296,3 +296,272 @@ fn test_rotatex_powercf(theta: CalculatorFloat, power: CalculatorFloat) { assert_eq!(power_gate, test_gate); assert_eq!(power_gate.theta(), test_gate.theta()); } + +#[test_case(vec![0,1]; "two_qubit")] +#[test_case(vec![0,1,2]; "three_qubit")] +fn test_circuit_multi_zz(qubits: Vec) { + let gate = MultiQubitZZ::new(qubits.clone(), CalculatorFloat::FRAC_PI_2); + let c = gate.circuit(); + if qubits.len() == 2 { + let mut comparison_circuit = Circuit::new(); + + comparison_circuit += CNOT::new(0, 1); + comparison_circuit += RotateZ::new(1, CalculatorFloat::FRAC_PI_4); + comparison_circuit += CNOT::new(0, 1); + + assert!(c == comparison_circuit); + } + if qubits.len() == 3 { + let mut comparison_circuit = Circuit::new(); + + comparison_circuit += CNOT::new(0, 1); + comparison_circuit += CNOT::new(1, 2); + comparison_circuit += RotateZ::new(2, CalculatorFloat::FRAC_PI_4); + comparison_circuit += CNOT::new(1, 2); + comparison_circuit += CNOT::new(0, 1); + + assert!(c == comparison_circuit); + } +} + +#[test_case(vec![0,1]; "two_qubit")] +fn test_matrix_output_multi_qubit_zz(qubits: Vec) { + let gate = MultiQubitZZ::new(qubits.clone(), CalculatorFloat::FRAC_PI_2); + let f: f64 = 1.0 / ((2.0_f64).sqrt()); + let test_array = array![ + [ + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f) + ], + ]; + let unit = gate.unitary_matrix().unwrap(); + let should_be_zero = unit - test_array; + assert!(should_be_zero.iter().all(|x| x.norm() < f64::EPSILON)); +} + +#[test_case(vec![0,1,2]; "three_qubit")] +fn test_matrix_output_three_multi_qubit_zz(qubits: Vec) { + let gate = MultiQubitZZ::new(qubits.clone(), CalculatorFloat::FRAC_PI_2); + let f: f64 = 1.0 / ((2.0_f64).sqrt()); + let test_array = array![ + [ + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f), + Complex64::new(0.0, 0.0) + ], + [ + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(0.0, 0.0), + Complex64::new(f, (-1.0) * f) + ], + ]; + let unit = gate.unitary_matrix().unwrap(); + let should_be_zero = unit - test_array; + assert!(should_be_zero.iter().all(|x| x.norm() < f64::EPSILON)); +} + +#[test] +fn test_clone_partial_eq_mulit_qubit_ms() { + let qubits = vec![0, 1, 2]; + + let gate = MultiQubitZZ::new(qubits.clone(), CalculatorFloat::FRAC_PI_2); + assert_eq!(gate.hqslang(), "MultiQubitZZ"); + assert_eq!( + gate.tags(), + &[ + "Operation", + "GateOperation", + "MultiQubitGateOperation", + "MultiQubitZZ", + ] + ); + assert!(!gate.is_parametrized()); + let gate1 = MultiQubitZZ::new(qubits.clone(), "theta".into()); + assert!(gate1.is_parametrized()); + let helper = gate != gate1; + assert!(helper); + let gate2 = gate1.clone(); + assert_eq!(gate2, gate1); +} + +#[test] +fn test_operate_mulit_qubit_zz() { + let qubits = vec![0, 1, 2]; + let gate = MultiQubitZZ::new(qubits.clone(), CalculatorFloat::FRAC_PI_2); + assert_eq!(gate.hqslang(), "MultiQubitZZ"); + assert_eq!( + gate.tags(), + &[ + "Operation", + "GateOperation", + "MultiQubitGateOperation", + "MultiQubitZZ", + ] + ); + assert_eq!(gate.qubits(), &vec![0, 1, 2]); + assert!(!gate.is_parametrized()); + let gate1 = MultiQubitZZ::new(qubits.clone(), "theta".into()); + assert!(gate1.is_parametrized()); +} + +#[test] +fn test_substitute_multi_qubit_zz() { + let qubits = vec![0, 1, 2]; + let gate1 = MultiQubitZZ::new(qubits.clone(), "theta".into()); + let gate = MultiQubitZZ::new(qubits.clone(), CalculatorFloat::FRAC_PI_2); + let mut calc = Calculator::new(); + calc.set_variable("theta", std::f64::consts::FRAC_PI_2); + let gate_substituted = roqoqo::operations::Substitute::substitute_parameters(&gate1, &mut calc); + let subs = gate_substituted.unwrap(); + assert_eq!(gate, subs); + let mut mapping: HashMap = std::collections::HashMap::new(); + let _ = mapping.insert(0, 1); + let _ = mapping.insert(1, 2); + let _ = mapping.insert(2, 0); + let remapped = gate1.remap_qubits(&mapping).unwrap(); + let qubits = remapped.qubits(); + assert_eq!(qubits, &vec![1, 2, 0]); +} + +#[test] +fn test_substitute_error_multi_qubit_zz() { + let qubits = vec![0, 1, 2]; + let gate1 = MultiQubitZZ::new(qubits.clone(), "theta".into()); + let mut calc = Calculator::new(); + let gate_substituted = gate1.substitute_parameters(&mut calc); + assert!(gate_substituted.is_err()); + let mut mapping: HashMap = std::collections::HashMap::new(); + let _ = mapping.insert(1, 2); + let _ = mapping.insert(2, 0); + let remapped = gate1.remap_qubits(&mapping); + assert!(remapped.is_err()); +} + +#[test] +fn test_format_error_multi_qubit_zz() { + let qubits = vec![0, 1, 2]; + let gate = MultiQubitZZ::new(qubits.clone(), "theta".into()); + let string = format!("{:?}", gate); + assert!(string.contains("theta")); + assert!(string.contains("MultiQubitZZ")); +} + +#[test] +fn test_involved_qubits_multi_qubit_zz() { + let qubits = vec![0, 1, 2]; + let gate = MultiQubitZZ::new(qubits.clone(), "theta".into()); + let involved_qubits = gate.involved_qubits(); + let mut comp_set: HashSet = HashSet::new(); + let _ = comp_set.insert(0); + let _ = comp_set.insert(1); + let _ = comp_set.insert(2); + assert_eq!(involved_qubits, InvolvedQubits::Set(comp_set)); +} + +/// Test powerfc function for MultiQubitMS with symbolic parameters +#[test_case(CalculatorFloat::from("theta"), CalculatorFloat::from(2.0); "power_2")] +#[test_case(CalculatorFloat::from("theta"), CalculatorFloat::from(1.0 / 2.0); "power_1/2")] +#[test_case(CalculatorFloat::from("theta"), CalculatorFloat::from(1.0); "power_1")] +#[test_case(CalculatorFloat::from("theta"), CalculatorFloat::from(0.0); "power_0")] +#[test_case(CalculatorFloat::from("theta"), CalculatorFloat::from(-2.0); "power_-2.0")] +#[test_case(CalculatorFloat::from("theta"), CalculatorFloat::from("power"); "power_symbolic")] +fn test_rotatex_powercf_multi_qubit_zz(theta: CalculatorFloat, power: CalculatorFloat) { + let qubits = vec![0, 1, 2]; + let gate = MultiQubitZZ::new(qubits.clone(), theta); + + let power_gate = gate.powercf(power.clone()); + let test_theta = power * gate.theta().clone(); + let test_gate = MultiQubitZZ::new(qubits.clone(), test_theta); + assert_eq!(power_gate, test_gate); + assert_eq!(power_gate.theta(), test_gate.theta()); +} From 8d80f251d43aae81d480a1cbeec7ce01a8d21d05 Mon Sep 17 00:00:00 2001 From: Nicolas Vogt <45093608+nfwvogt@users.noreply.github.com> Date: Thu, 18 Nov 2021 16:18:00 +0100 Subject: [PATCH 09/11] Topology_links_interface (#132) * update dependencies * updated dependencies * WIP: two_qubit_edges * Added two_qubit_edges to Device trait --- CHANGELOG.md | 1 + roqoqo/src/devices.rs | 14 ++++++++++++++ roqoqo/tests/integration/devices.rs | 25 +++++++++++++++++++++---- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6edbe3cc..0d43a470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This changelog track changes to the qoqo project starting at version 0.5.0 ### Added not released * MultiQubitZZ gate. Rotation under a multi-qubit product of Pauli Z operators. +* `two_qubit_edges` function in Device trait. Used to create a simple graph-library-agnostic representation of the connectivity graph of a device. ## 0.8.1 diff --git a/roqoqo/src/devices.rs b/roqoqo/src/devices.rs index 746717e8..ad480100 100644 --- a/roqoqo/src/devices.rs +++ b/roqoqo/src/devices.rs @@ -111,6 +111,20 @@ pub trait Device { /// Returns the number of qubits the device supports. fn number_qubits(&self) -> usize; + /// Returns the list of pairs of qubits linked with a native two-qubit-gate in the device. + /// + /// A pair of qubits is considered linked by a native two-qubit-gate if the device + /// can implement a two-qubit-gate btween the two qubits without decomposing it + /// into a sequence of gates that involves a third qubit of the device. + /// The two-qubit-gate also has to form a universal set together with the available + /// single qubit gates. + /// + /// The returned vectors is a simple, graph-library independent, representation of + /// the undirected connectivity graph of the device. + /// It can be used to construct the connectivity graph in a graph library of the users + /// choice from a list of edges and can be used for applications like routing in quantum algorithms. + fn two_qubit_edges(&self) -> Vec<(usize, usize)>; + /// Changes the device topology based on a Pragma operation. /// /// Specific devices and backends can allow changes to the device topology. diff --git a/roqoqo/tests/integration/devices.rs b/roqoqo/tests/integration/devices.rs index 590e819b..7912d967 100644 --- a/roqoqo/tests/integration/devices.rs +++ b/roqoqo/tests/integration/devices.rs @@ -42,10 +42,6 @@ impl TestDevice { } impl Device for TestDevice { - fn number_qubits(&self) -> usize { - self.number_qubits - } - fn single_qubit_gate_time(&self, hqslang: &str, qubit: &usize) -> Option { match self.single_qubit_gates.get(&hqslang.to_string()) { Some(x) => x.get(&qubit).map(|x| *x), @@ -67,6 +63,20 @@ impl Device for TestDevice { fn qubit_decoherence_rates(&self, qubit: &usize) -> Option> { self.rates.get(&qubit).map(|x| x.to_owned()) } + + fn number_qubits(&self) -> usize { + self.number_qubits + } + + fn two_qubit_edges(&self) -> Vec<(usize, usize)> { + let mut edges: Vec<(usize, usize)> = Vec::new(); + for row in 0..self.number_qubits { + for column in row + 1..self.number_qubits { + edges.push((row, column)); + } + } + edges + } } /// Basic functional test @@ -128,6 +138,13 @@ fn it_works() { Some(0.8f64) ); assert_eq!(device.multi_qubit_gate_time("Other", &[0, 1, 2]), None); + + let test_edges = vec![(0, 1), (0, 2), (1, 2)]; + let edges = device.two_qubit_edges(); + assert_eq!(test_edges.len(), edges.len()); + for edge in edges { + assert!(test_edges.contains(&edge)); + } } /// Basic functional test From 4db72bef48b868f1193665c7ca827b810c0f4d47 Mon Sep 17 00:00:00 2001 From: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> Date: Thu, 18 Nov 2021 17:13:20 +0100 Subject: [PATCH 10/11] Increased unittest coverage (#127) * Temporary change of qoqo_calculator * Removed qoqo_calculator branch dependency * Increased version numbers and updated changelog * Fixed input type for DeviceTrait * Fixed unittest * Simplified two qubit gate matrix unittests * Updated to pyo3 0.15.0 * Fixed typo in ci workflow * Removed faulty 3.10 (python) support, will address later * Started unittesting qoqo quantum program * Increased unittest coverage for quantum program * Increased coverage for quantum program and measurements in qoqo * Added unittests for multi qubit gates in qoqo * Increased coverage for multi qubit gate operations and pragma operations * Fixed formatting --- qoqo/Cargo.toml | 4 +- qoqo/qoqo/DEPENDENCIES | 10 +- .../basis_rotation_measurement.rs | 2 +- .../cheated_basis_rotation_measurement.rs | 2 +- qoqo/src/measurements/cheated_measurement.rs | 5 +- .../classical_register_measurement.rs | 5 +- qoqo/src/operations/pragma_operations.rs | 232 +++++++ qoqo/src/quantum_program.rs | 2 +- qoqo/tests/integration/main.rs | 3 + .../basis_rotation_measurement.rs | 54 ++ .../cheated_basis_rotation_measurement.rs | 49 ++ .../measurements/cheated_measurement.rs | 62 ++ .../classical_register_measurement.rs | 35 + qoqo/tests/integration/operations/mod.rs | 3 + .../operations/multi_qubit_gate_operations.rs | 458 +++++++++++++ qoqo/tests/integration/quantum_program.rs | 602 ++++++++++++++++++ roqoqo/tests/integration/quantum_program.rs | 2 +- 17 files changed, 1513 insertions(+), 17 deletions(-) create mode 100644 qoqo/tests/integration/operations/multi_qubit_gate_operations.rs create mode 100644 qoqo/tests/integration/quantum_program.rs diff --git a/qoqo/Cargo.toml b/qoqo/Cargo.toml index 39e316ed..832d4edb 100644 --- a/qoqo/Cargo.toml +++ b/qoqo/Cargo.toml @@ -32,8 +32,8 @@ num-complex = "0.4" thiserror = "1.0" qoqo_calculator = { version="0.5" } qoqo_calculator_pyo3 = {version="0.5", default-features=false} -qoqo-macros = {version="0.8", path="../qoqo-macros"} -roqoqo = {version="0.8", path="../roqoqo", features=["serialize", "overrotate"]} +qoqo-macros = {version="0.8.1", path="../qoqo-macros"} +roqoqo = {version="0.8.1", path="../roqoqo", features=["serialize", "overrotate"]} numpy = "=0.15" bincode = "1.3" serde_json = "1.0" diff --git a/qoqo/qoqo/DEPENDENCIES b/qoqo/qoqo/DEPENDENCIES index 643931ec..872638d4 100644 --- a/qoqo/qoqo/DEPENDENCIES +++ b/qoqo/qoqo/DEPENDENCIES @@ -7710,7 +7710,7 @@ LICENSE: ==================================================== -qoqo 0.8.0 +qoqo 0.8.1 https://github.com/HQSquantumsimulations/qoqo by HQS Quantum Simulations Quantum computing circuit toolkit. Python interface of roqoqo @@ -7922,7 +7922,7 @@ LICENSE: ==================================================== -qoqo-macros 0.8.0 +qoqo-macros 0.8.1 by HQS Quantum Simulations Macros for the qoqo crate License: Apache-2.0 @@ -9865,7 +9865,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ==================================================== -roqoqo 0.8.0 +roqoqo 0.8.1 https://github.com/HQSquantumsimulations/qoqo by HQS Quantum Simulations Rust Quantum Computing Toolkit by HQS @@ -10077,7 +10077,7 @@ LICENSE: ==================================================== -roqoqo-derive 0.8.0 +roqoqo-derive 0.8.1 by HQS Quantum Simulations Maros for the roqoqo crate License: Apache-2.0 @@ -10288,7 +10288,7 @@ LICENSE: ==================================================== -roqoqo-test 0.8.0 +roqoqo-test 0.8.1 https://github.com/HQSquantumsimulations/qoqo by HQS Quantum Simulations Testing helper functions for roqoqo toolkit diff --git a/qoqo/src/measurements/basis_rotation_measurement.rs b/qoqo/src/measurements/basis_rotation_measurement.rs index 8ae11d51..8eed7eb1 100644 --- a/qoqo/src/measurements/basis_rotation_measurement.rs +++ b/qoqo/src/measurements/basis_rotation_measurement.rs @@ -175,7 +175,7 @@ impl BasisRotationWrapper { /// ValueError: Cannot serialize Measurement to bytes. pub fn _internal_to_bincode(&self) -> PyResult<(&'static str, Py)> { let serialized = serialize(&self.internal).map_err(|_| { - PyValueError::new_err("Cannot serialize BasisRoationMeasurement to bytes") + PyValueError::new_err("Cannot serialize BasisRotationMeasurement to bytes") })?; let b: Py = Python::with_gil(|py| -> Py { PyByteArray::new(py, &serialized[..]).into() diff --git a/qoqo/src/measurements/cheated_basis_rotation_measurement.rs b/qoqo/src/measurements/cheated_basis_rotation_measurement.rs index 59e061f7..961b257d 100644 --- a/qoqo/src/measurements/cheated_basis_rotation_measurement.rs +++ b/qoqo/src/measurements/cheated_basis_rotation_measurement.rs @@ -174,7 +174,7 @@ impl CheatedBasisRotationWrapper { /// ValueError: Cannot serialize Measurement to bytes. pub fn _internal_to_bincode(&self) -> PyResult<(&'static str, Py)> { let serialized = serialize(&self.internal).map_err(|_| { - PyValueError::new_err("Cannot serialize BasisRoationMeasurement to bytes") + PyValueError::new_err("Cannot serialize CheatedBasisRotationMeasurement to bytes") })?; let b: Py = Python::with_gil(|py| -> Py { PyByteArray::new(py, &serialized[..]).into() diff --git a/qoqo/src/measurements/cheated_measurement.rs b/qoqo/src/measurements/cheated_measurement.rs index 69687463..cac71171 100644 --- a/qoqo/src/measurements/cheated_measurement.rs +++ b/qoqo/src/measurements/cheated_measurement.rs @@ -174,9 +174,8 @@ impl CheatedWrapper { /// Raises: /// ValueError: Cannot serialize Measurement to bytes. pub fn _internal_to_bincode(&self) -> PyResult<(&'static str, Py)> { - let serialized = serialize(&self.internal).map_err(|_| { - PyValueError::new_err("Cannot serialize BasisRoationMeasurement to bytes") - })?; + let serialized = serialize(&self.internal) + .map_err(|_| PyValueError::new_err("Cannot serialize CheatedMeasurement to bytes"))?; let b: Py = Python::with_gil(|py| -> Py { PyByteArray::new(py, &serialized[..]).into() }); diff --git a/qoqo/src/measurements/classical_register_measurement.rs b/qoqo/src/measurements/classical_register_measurement.rs index 831636ac..2ce8c45f 100644 --- a/qoqo/src/measurements/classical_register_measurement.rs +++ b/qoqo/src/measurements/classical_register_measurement.rs @@ -111,9 +111,8 @@ impl ClassicalRegisterWrapper { /// Raises: /// ValueError: Cannot serialize Measurement to bytes. pub fn _internal_to_bincode(&self) -> PyResult<(&'static str, Py)> { - let serialized = serialize(&self.internal).map_err(|_| { - PyValueError::new_err("Cannot serialize BasisRoationMeasurement to bytes") - })?; + let serialized = serialize(&self.internal) + .map_err(|_| PyValueError::new_err("Cannot serialize ClassicalRegister to bytes"))?; let b: Py = Python::with_gil(|py| -> Py { PyByteArray::new(py, &serialized[..]).into() }); diff --git a/qoqo/src/operations/pragma_operations.rs b/qoqo/src/operations/pragma_operations.rs index a7895f5f..f845be62 100644 --- a/qoqo/src/operations/pragma_operations.rs +++ b/qoqo/src/operations/pragma_operations.rs @@ -1411,3 +1411,235 @@ impl PyObjectProtocol for PragmaChangeDeviceWrapper { } } } + +#[cfg(test)] +mod tests { + use crate::operations::*; + use bincode::serialize; + use roqoqo::operations::*; + use std::collections::HashSet; + + /// Test involved_qubits function for Pragmas with All + #[test] + fn test_pyo3_involved_qubits_all_change_device() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let input_definition: Operation = PragmaChangeDevice::new(&wrapped).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_definition).unwrap(); + let to_involved = operation.call_method0(py, "involved_qubits").unwrap(); + let involved_op: HashSet<&str> = HashSet::extract(to_involved.as_ref(py)).unwrap(); + let mut involved_param: HashSet<&str> = HashSet::new(); + involved_param.insert("All"); + assert_eq!(involved_op, involved_param); + + assert!(PragmaChangeDeviceWrapper::new().is_err()); + } + + #[test] + fn test_pyo3_format_repr_change_device() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let input_measurement: Operation = PragmaChangeDevice::new(&wrapped).unwrap().into(); + let format_repr = format!("PragmaChangeDevice {{ wrapped_tags: {:?}, wrapped_hqslang: {:?}, wrapped_operation: {:?} }}", wrapped.tags(), wrapped.hqslang(), serialize(&wrapped).unwrap()); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_measurement).unwrap(); + let to_format = operation.call_method1(py, "__format__", ("",)).unwrap(); + let format_op: &str = <&str>::extract(to_format.as_ref(py)).unwrap(); + let to_repr = operation.call_method0(py, "__repr__").unwrap(); + let repr_op: &str = <&str>::extract(to_repr.as_ref(py)).unwrap(); + assert_eq!(format_op, format_repr); + assert_eq!(repr_op, format_repr); + } + + #[test] + fn test_pyo3_copy_deepcopy_change_device() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let input_measurement: Operation = PragmaChangeDevice::new(&wrapped).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_measurement).unwrap(); + let copy_op = operation.call_method0(py, "__copy__").unwrap(); + let deepcopy_op = operation.call_method1(py, "__deepcopy__", ("",)).unwrap(); + let copy_deepcopy_param = operation.clone(); + + let comparison_copy = bool::extract( + copy_op + .as_ref(py) + .call_method1("__eq__", (copy_deepcopy_param.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(comparison_copy); + let comparison_deepcopy = bool::extract( + deepcopy_op + .as_ref(py) + .call_method1("__eq__", (copy_deepcopy_param,)) + .unwrap(), + ) + .unwrap(); + assert!(comparison_deepcopy); + } + + #[test] + fn test_pyo3_tags_simple_change_device() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let input_measurement: Operation = PragmaChangeDevice::new(&wrapped).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_measurement).unwrap(); + let to_tag = operation.call_method0(py, "tags").unwrap(); + let tags_op: &Vec<&str> = &Vec::extract(to_tag.as_ref(py)).unwrap(); + let tags_param: &[&str] = &["Operation", "PragmaOperation", "PragmaChangeDevice"]; + assert_eq!(tags_op, tags_param); + } + + #[test] + fn test_pyo3_hqslang_change_device() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let input_measurement: Operation = PragmaChangeDevice::new(&wrapped).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_measurement).unwrap(); + let hqslang_op: String = + String::extract(operation.call_method0(py, "hqslang").unwrap().as_ref(py)).unwrap(); + assert_eq!(hqslang_op, "PragmaChangeDevice".to_string()); + } + + #[test] + fn test_pyo3_is_parametrized_change_device() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let input_measurement: Operation = PragmaChangeDevice::new(&wrapped).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_measurement).unwrap(); + assert!(!bool::extract( + operation + .call_method0(py, "is_parametrized") + .unwrap() + .as_ref(py) + ) + .unwrap()); + } + + #[test] + fn test_pyo3_substitute_parameters() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let first_op: Operation = PragmaChangeDevice::new(&wrapped.clone()).unwrap().into(); + let second_op: Operation = PragmaChangeDevice::new(&wrapped).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(first_op).unwrap(); + let mut substitution_dict: HashMap<&str, f64> = HashMap::new(); + substitution_dict.insert("test", 1.0); + let substitute_op = operation + .call_method1(py, "substitute_parameters", (substitution_dict,)) + .unwrap(); + let substitute_param = convert_operation_to_pyobject(second_op).unwrap(); + + let comparison = bool::extract( + substitute_op + .as_ref(py) + .call_method1("__eq__", (substitute_param.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(comparison); + } + + #[test] + fn test_pyo3_remap_qubits() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let first_op: Operation = PragmaChangeDevice::new(&wrapped.clone()).unwrap().into(); + let second_op: Operation = PragmaChangeDevice::new(&wrapped).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(first_op).unwrap(); + + let mut qubit_mapping: HashMap = HashMap::new(); + qubit_mapping.insert(0, 0); + let remapped_op = operation + .call_method1(py, "remap_qubits", (qubit_mapping,)) + .unwrap(); + let comparison_op = convert_operation_to_pyobject(second_op).unwrap(); + + let comparison = bool::extract( + remapped_op + .call_method1(py, "__eq__", (comparison_op,)) + .unwrap() + .as_ref(py), + ) + .unwrap(); + assert!(comparison); + } + + #[test] + fn test_pyo3_remap_qubits_error() { + let wrapped: Operation = PragmaActiveReset::new(0).into(); + let first_op: Operation = PragmaChangeDevice::new(&wrapped.clone()).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(first_op).unwrap(); + + let mut qubit_mapping: HashMap = HashMap::new(); + qubit_mapping.insert(0, 2); + let remapped_op = operation.call_method1(py, "remap_qubits", (qubit_mapping,)); + assert!(remapped_op.is_err()); + } + + #[test] + fn test_pyo3_richcmp_change_device() { + let wrapped_1: Operation = PragmaActiveReset::new(0).into(); + let definition_1: Operation = PragmaChangeDevice::new(&wrapped_1).unwrap().into(); + let wrapped_2: Operation = PragmaActiveReset::new(1).into(); + let definition_2: Operation = PragmaChangeDevice::new(&wrapped_2).unwrap().into(); + + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation_one = convert_operation_to_pyobject(definition_1).unwrap(); + let operation_two = convert_operation_to_pyobject(definition_2).unwrap(); + + let comparison = bool::extract( + operation_one + .as_ref(py) + .call_method1("__eq__", (operation_two.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(!comparison); + + let comparison = bool::extract( + operation_one + .as_ref(py) + .call_method1("__ne__", (operation_two.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(comparison); + + let comparison = operation_one.call_method1(py, "__eq__", (vec!["fails"],)); + assert!(comparison.is_err()); + + let comparison = operation_one.call_method1(py, "__ge__", (operation_two,)); + assert!(comparison.is_err()); + } +} diff --git a/qoqo/src/quantum_program.rs b/qoqo/src/quantum_program.rs index 7c59b9ea..6de9af31 100644 --- a/qoqo/src/quantum_program.rs +++ b/qoqo/src/quantum_program.rs @@ -98,7 +98,7 @@ impl QuantumProgramWrapper { let (name, encoded) = get_measurement_internal .extract::<(&str, &[u8])>() .map_err(|_| PyTypeError::new_err("measurement is not of type Measurement. Are you using different versions of roqoqo?"))?; - match name{ + match name { "BasisRotation" => { let measure: measurements::BasisRotation = deserialize(encoded).map_err(|_| PyTypeError::new_err("measurement is not of type Measurement. Are you using different versions of roqoqo?"))?; Ok( Self{internal: QuantumProgram::BasisRotation{measurement: measure, input_parameter_names}}) diff --git a/qoqo/tests/integration/main.rs b/qoqo/tests/integration/main.rs index 789ecea9..2a65c0de 100644 --- a/qoqo/tests/integration/main.rs +++ b/qoqo/tests/integration/main.rs @@ -16,5 +16,8 @@ mod operations; #[cfg(test)] mod circuit; +#[cfg(test)] +mod quantum_program; + #[cfg(test)] mod measurements; diff --git a/qoqo/tests/integration/measurements/basis_rotation_measurement.rs b/qoqo/tests/integration/measurements/basis_rotation_measurement.rs index d897a6b9..f7f7f485 100644 --- a/qoqo/tests/integration/measurements/basis_rotation_measurement.rs +++ b/qoqo/tests/integration/measurements/basis_rotation_measurement.rs @@ -12,11 +12,16 @@ //! Integration test for public API of Basis rotation measurement +use bincode::serialize; use pyo3::prelude::*; use pyo3::Python; use qoqo::measurements::{BasisRotationInputWrapper, BasisRotationWrapper}; use qoqo::CircuitWrapper; use roqoqo::registers::{BitOutputRegister, ComplexOutputRegister, FloatOutputRegister}; +use roqoqo::{ + measurements::{BasisRotation, BasisRotationInput}, + Circuit, +}; use std::collections::HashMap; use test_case::test_case; @@ -556,6 +561,55 @@ fn test_pyo3_debug() { }) } +/// Test _internal_to_bincode function +#[test] +fn test_internal_to_bincode() { + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| -> () { + let input_type = py.get_type::(); + let input = input_type + .call1((3, false)) + .unwrap() + .cast_as::>() + .unwrap(); + let tmp_vec: Vec = Vec::new(); + let _ = input + .call_method1("add_pauli_product", ("ro", tmp_vec.clone())) + .unwrap(); + + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + + let br_type = py.get_type::(); + let br = br_type + .call1((Some(CircuitWrapper::new()), circs.clone(), input)) + .unwrap() + .cast_as::>() + .unwrap(); + + let mut roqoqo_bri = BasisRotationInput::new(3, false); + roqoqo_bri + .add_pauli_product("ro".to_string(), tmp_vec) + .unwrap(); + let mut circs: Vec = Vec::new(); + circs.push(Circuit::new()); + let roqoqo_br = BasisRotation { + constant_circuit: Some(Circuit::new()), + circuits: circs.clone(), + input: roqoqo_bri, + }; + let comparison_serialised = serialize(&roqoqo_br).unwrap(); + + let serialised: (&str, Vec) = br + .call_method0("_internal_to_bincode") + .unwrap() + .extract() + .unwrap(); + assert_eq!(serialised.0, "BasisRotation"); + assert_eq!(serialised.1, comparison_serialised); + }) +} + /// Test to_json and from_json functions #[test] fn test_to_from_json() { diff --git a/qoqo/tests/integration/measurements/cheated_basis_rotation_measurement.rs b/qoqo/tests/integration/measurements/cheated_basis_rotation_measurement.rs index 0123754f..47c25feb 100644 --- a/qoqo/tests/integration/measurements/cheated_basis_rotation_measurement.rs +++ b/qoqo/tests/integration/measurements/cheated_basis_rotation_measurement.rs @@ -12,11 +12,16 @@ //! Integration test for public API of Basis rotation measurement +use bincode::serialize; use pyo3::prelude::*; use pyo3::Python; use qoqo::measurements::{CheatedBasisRotationInputWrapper, CheatedBasisRotationWrapper}; use qoqo::CircuitWrapper; use roqoqo::registers::{BitOutputRegister, ComplexOutputRegister, FloatOutputRegister}; +use roqoqo::{ + measurements::{CheatedBasisRotation, CheatedBasisRotationInput}, + Circuit, +}; use std::collections::HashMap; #[test] @@ -338,6 +343,50 @@ fn test_pyo3_debug() { assert!(error.is_err()); } +/// Test _internal_to_bincode function +#[test] +fn test_internal_to_bincode() { + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| -> () { + let input_type = py.get_type::(); + let input = input_type + .call0() + .unwrap() + .cast_as::>() + .unwrap(); + let _ = input.call_method1("add_pauli_product", ("ro",)).unwrap(); + + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + + let br_type = py.get_type::(); + let br = br_type + .call1((Some(CircuitWrapper::new()), circs.clone(), input)) + .unwrap() + .cast_as::>() + .unwrap(); + + let mut roqoqo_bri = CheatedBasisRotationInput::new(); + roqoqo_bri.add_pauli_product("ro".to_string()); + let mut circs: Vec = Vec::new(); + circs.push(Circuit::new()); + let roqoqo_br = CheatedBasisRotation { + constant_circuit: Some(Circuit::new()), + circuits: circs.clone(), + input: roqoqo_bri, + }; + let comparison_serialised = serialize(&roqoqo_br).unwrap(); + + let serialised: (&str, Vec) = br + .call_method0("_internal_to_bincode") + .unwrap() + .extract() + .unwrap(); + assert_eq!(serialised.0, "CheatedBasisRotation"); + assert_eq!(serialised.1, comparison_serialised); + }) +} + /// Test to_json and from_json functions #[test] fn test_to_from_json() { diff --git a/qoqo/tests/integration/measurements/cheated_measurement.rs b/qoqo/tests/integration/measurements/cheated_measurement.rs index ac9e3583..48a24c0c 100644 --- a/qoqo/tests/integration/measurements/cheated_measurement.rs +++ b/qoqo/tests/integration/measurements/cheated_measurement.rs @@ -12,12 +12,17 @@ //! Integration test for public API of Basis rotation measurement +use bincode::serialize; use num_complex::Complex64; use pyo3::prelude::*; use pyo3::Python; use qoqo::measurements::{CheatedInputWrapper, CheatedWrapper}; use qoqo::CircuitWrapper; use roqoqo::registers::{BitOutputRegister, ComplexOutputRegister, FloatOutputRegister}; +use roqoqo::{ + measurements::{Cheated, CheatedInput}, + Circuit, +}; use std::collections::HashMap; use test_case::test_case; @@ -317,6 +322,63 @@ fn test_pyo3_debug() { assert!(error.is_err()); } +/// Test _internal_to_bincode function +#[test] +fn test_internal_to_bincode() { + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| -> () { + let input_type = py.get_type::(); + let input = input_type + .call1((3,)) + .unwrap() + .cast_as::>() + .unwrap(); + let test_matrix = vec![ + (0, 0, Complex64::new(1.0, 0.0)), + (0, 1, Complex64::new(0.0, 0.0)), + (1, 0, Complex64::new(0.0, 0.0)), + (1, 1, Complex64::new(-1.0, 0.0)), + ]; + let _ = input + .call_method1( + "add_operator_exp_val", + ("test_diagonal", test_matrix.clone(), "ro"), + ) + .unwrap(); + + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + + let br_type = py.get_type::(); + let br = br_type + .call1((Some(CircuitWrapper::new()), circs.clone(), input)) + .unwrap() + .cast_as::>() + .unwrap(); + + let mut roqoqo_bri = CheatedInput::new(3); + roqoqo_bri + .add_operator_exp_val("test_diagonal".to_string(), test_matrix, "ro".to_string()) + .unwrap(); + let mut circs: Vec = Vec::new(); + circs.push(Circuit::new()); + let roqoqo_br = Cheated { + constant_circuit: Some(Circuit::new()), + circuits: circs.clone(), + input: roqoqo_bri, + }; + let comparison_serialised = serialize(&roqoqo_br).unwrap(); + + let serialised: (&str, Vec) = br + .call_method0("_internal_to_bincode") + .unwrap() + .extract() + .unwrap(); + assert_eq!(serialised.0, "Cheated"); + assert_eq!(serialised.1, comparison_serialised); + }) +} + /// Test to_json and from_json functions #[test] fn test_to_from_json() { diff --git a/qoqo/tests/integration/measurements/classical_register_measurement.rs b/qoqo/tests/integration/measurements/classical_register_measurement.rs index 29a74fb0..c9bf07f3 100644 --- a/qoqo/tests/integration/measurements/classical_register_measurement.rs +++ b/qoqo/tests/integration/measurements/classical_register_measurement.rs @@ -12,10 +12,12 @@ //! Integration test for public API of Basis rotation measurement +use bincode::serialize; use pyo3::prelude::*; use pyo3::Python; use qoqo::measurements::ClassicalRegisterWrapper; use qoqo::CircuitWrapper; +use roqoqo::{measurements::ClassicalRegister, Circuit}; use std::collections::HashMap; #[test] @@ -117,6 +119,39 @@ fn test_pyo3_debug() { assert_eq!(format!("{:?}", br), debug_string); } +/// Test _internal_to_bincode function +#[test] +fn test_internal_to_bincode() { + pyo3::prepare_freethreaded_python(); + Python::with_gil(|py| -> () { + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + + let br_type = py.get_type::(); + let br = br_type + .call1((Some(CircuitWrapper::new()), circs.clone())) + .unwrap() + .cast_as::>() + .unwrap(); + + let mut circs: Vec = Vec::new(); + circs.push(Circuit::new()); + let roqoqo_br = ClassicalRegister { + constant_circuit: Some(Circuit::new()), + circuits: circs.clone(), + }; + let comparison_serialised = serialize(&roqoqo_br).unwrap(); + + let serialised: (&str, Vec) = br + .call_method0("_internal_to_bincode") + .unwrap() + .extract() + .unwrap(); + assert_eq!(serialised.0, "ClassicalRegister"); + assert_eq!(serialised.1, comparison_serialised); + }) +} + /// Test to_json and from_json functions #[test] fn test_to_from_json() { diff --git a/qoqo/tests/integration/operations/mod.rs b/qoqo/tests/integration/operations/mod.rs index d477696d..099997a5 100644 --- a/qoqo/tests/integration/operations/mod.rs +++ b/qoqo/tests/integration/operations/mod.rs @@ -22,6 +22,9 @@ pub use operation_conversions::*; mod pragma_operations; pub use pragma_operations::*; +mod multi_qubit_gate_operations; +pub use multi_qubit_gate_operations::*; + mod single_qubit_gate_operations; pub use single_qubit_gate_operations::*; diff --git a/qoqo/tests/integration/operations/multi_qubit_gate_operations.rs b/qoqo/tests/integration/operations/multi_qubit_gate_operations.rs new file mode 100644 index 00000000..57571ad8 --- /dev/null +++ b/qoqo/tests/integration/operations/multi_qubit_gate_operations.rs @@ -0,0 +1,458 @@ +// Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software distributed under the +// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing permissions and +// limitations under the License. + +use ndarray::Array2; +use num_complex::Complex64; +use numpy::PyArray2; +use pyo3::prelude::*; +use pyo3::Python; +use qoqo::operations::convert_operation_to_pyobject; +use qoqo::operations::MultiQubitMSWrapper; +use qoqo::CircuitWrapper; +use qoqo_calculator::Calculator; +use qoqo_calculator::CalculatorFloat; +use qoqo_calculator_pyo3::CalculatorFloatWrapper; +use roqoqo::operations::Operation; +use roqoqo::operations::*; +use roqoqo::{Circuit, RoqoqoError}; +use std::collections::HashMap; +use std::convert::TryInto; +use test_case::test_case; + +// helper function to convert CalculatorFloat into a python object +fn convert_cf_to_pyobject( + py: Python, + parameter: CalculatorFloat, +) -> &PyCell { + let parameter_type = py.get_type::(); + match parameter { + CalculatorFloat::Float(x) => parameter_type + .call1((x,)) + .unwrap() + .cast_as::>() + .unwrap(), + CalculatorFloat::Str(x) => parameter_type + .call1((x,)) + .unwrap() + .cast_as::>() + .unwrap(), + } +} + +#[test_case(Operation::from(MultiQubitMS::new(vec![0, 1], CalculatorFloat::ZERO)), (vec![0, 1], 0.0,), "__eq__"; "MultiQubitMS_eq")] +#[test_case(Operation::from(MultiQubitMS::new(vec![2, 3], CalculatorFloat::ZERO)), (vec![0, 1], 0.0,), "__ne__"; "MultiQubitMS_ne")] +fn test_new_multi_qubit_ms(input_operation: Operation, arguments: (Vec, f64), method: &str) { + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + + // Basic initialisation, no errors + let operation_type = py.get_type::(); + let operation_py = operation_type + .call1(arguments) + .unwrap() + .cast_as::>() + .unwrap(); + let comparison = bool::extract( + operation + .as_ref(py) + .call_method1(method, (operation_py,)) + .unwrap(), + ) + .unwrap(); + assert!(comparison); + + // Error initialisation + let result = operation_type.call1(([0, 1], vec!["fails"])); + let result_ref = result.as_ref(); + assert!(result_ref.is_err()); + + // Testing PartialEq, Clone and Debug + let def_wrapper = operation_py.extract::().unwrap(); + let new_op_diff = operation_type + .call1((vec![1, 2], 0.0)) + .unwrap() + .cast_as::>() + .unwrap(); + let def_wrapper_diff = new_op_diff.extract::().unwrap(); + let helper_ne: bool = def_wrapper_diff != def_wrapper.clone(); + assert!(helper_ne); + let helper_eq: bool = def_wrapper == def_wrapper.clone(); + assert!(helper_eq); + + assert_eq!( + format!("{:?}", def_wrapper_diff), + "MultiQubitMSWrapper { internal: MultiQubitMS { qubits: [1, 2], theta: Float(0.0) } }" + ); +} + +/// Test is_parametrized() function for MultiQubitGate Operations +#[test_case(Operation::from(MultiQubitMS::new(vec![0, 1], CalculatorFloat::from("theta"))); "MultiQubitMS")] +fn test_pyo3_is_parametrized(input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + assert!(bool::extract( + operation + .call_method0(py, "is_parametrized") + .unwrap() + .as_ref(py) + ) + .unwrap()); +} + +/// Test is_parametrized = false for MultiQubitGate Operations +#[test_case(Operation::from(MultiQubitMS::new(vec![0, 1], CalculatorFloat::PI)); "MultiQubitMS")] +fn test_pyo3_is_not_parametrized(input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + assert!(!bool::extract( + operation + .call_method0(py, "is_parametrized") + .unwrap() + .as_ref(py) + ) + .unwrap()); +} + +/// Test theta() function for Rotations +#[test_case(CalculatorFloat::from(0), Operation::from(MultiQubitMS::new(vec![0, 1], CalculatorFloat::from(0))); "MultiQubitMS float")] +#[test_case(CalculatorFloat::from("theta"), Operation::from(MultiQubitMS::new(vec![0, 1], CalculatorFloat::from("theta"))); "MultiQubitMS symb")] +fn test_pyo3_theta(theta: CalculatorFloat, input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + let theta_op: CalculatorFloatWrapper = + CalculatorFloatWrapper::extract(operation.call_method0(py, "theta").unwrap().as_ref(py)) + .unwrap(); + let theta_param: CalculatorFloatWrapper = + CalculatorFloatWrapper::extract(convert_cf_to_pyobject(py, theta)).unwrap(); + assert_eq!(theta_op.cf_internal, theta_param.cf_internal); +} + +/// Test qubits() function for MultiQubitGate Operations +#[test_case(vec![0, 1], Operation::from(MultiQubitMS::new(vec![0, 1], CalculatorFloat::from(0))); "MultiQubitMS two")] +#[test_case(vec![0, 1, 2], Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(0))); "MultiQubitMS three")] +fn test_pyo3_qubits(qubit: Vec, input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + let qubit_op: Vec = operation + .call_method0(py, "qubits") + .unwrap() + .as_ref(py) + .extract() + .unwrap(); + assert_eq!(qubit_op, qubit); +} + +/// Test hqslang() function for MultiQubitGate Operations +#[test_case("MultiQubitMS", Operation::from(MultiQubitMS::new(vec![0, 1], CalculatorFloat::from(0))); "MultiQubitMS")] +fn test_pyo3_hqslang(name: &'static str, input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + let name_op: String = + String::extract(operation.call_method0(py, "hqslang").unwrap().as_ref(py)).unwrap(); + assert_eq!(name_op, name.to_string()); +} + +/// Test tags() function for MultiQubitGate Operations +#[test_case( + Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(0))), + vec![ + "Operation", + "GateOperation", + "MultiQubitGateOperation", + // "Rotation", + "MultiQubitMS", + ]; + "MultiQubitMS")] +fn test_pyo3_tags(input_operation: Operation, tags: Vec<&str>) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + let tags_op: Vec = + Vec::::extract(operation.call_method0(py, "tags").unwrap().as_ref(py)).unwrap(); + assert_eq!(tags_op.len(), tags.len()); + for i in 0..tags.len() { + assert_eq!(tags_op[i], tags[i]); + } +} + +/// Test remap_qubits() function for MultiQubitGate Operations +#[test_case(Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(1.3))); "MultiQubitMS")] +fn test_pyo3_remapqubits(input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + // test initial qubit + let qubits: Vec = operation + .call_method0(py, "qubits") + .unwrap() + .as_ref(py) + .extract() + .unwrap(); + assert_eq!(qubits.clone(), vec![0, 1, 2]); + // remap qubits + let mut qubit_mapping: HashMap = HashMap::new(); + qubit_mapping.insert(0, 1); + qubit_mapping.insert(1, 2); + qubit_mapping.insert(2, 0); + let result = operation + .call_method1(py, "remap_qubits", (qubit_mapping,)) + .unwrap(); + // test re-mapped qubit + let qubits_new: Vec = result + .call_method0(py, "qubits") + .unwrap() + .as_ref(py) + .extract() + .unwrap(); + assert_eq!(qubits_new.clone(), vec![1, 2, 0]); + // test that initial and rempapped qubits are different + assert_ne!(qubits, qubits_new); +} + +// test remap_qubits() function returning an error. +#[test_case(Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(1.3))); "MultiQubitMS")] +fn test_pyo3_remapqubits_error(input_operation: Operation) { + // preparation + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + // remap qubits + let qubit_mapping: HashMap = HashMap::new(); + let result = operation.call_method1(py, "remap_qubits", (qubit_mapping,)); + let result_ref = result.as_ref(); + assert!(result_ref.is_err()); +} + +/// Test unitary_matrix() function for MultiQubitGate Operations +#[test_case(Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(1.3))); "MultiQubitMS")] +fn test_pyo3_unitarymatrix(input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation.clone()).unwrap(); + let py_result = operation.call_method0(py, "unitary_matrix").unwrap(); + let result_matrix = py_result + .cast_as::>(py) + .unwrap() + .to_owned_array(); + + // compare to reference matrix obtained in Rust directly (without passing to Python) + let gate: MultiQubitGateOperation = input_operation.try_into().unwrap(); + let rust_matrix: Result, RoqoqoError> = gate.unitary_matrix(); + let test_matrix: Array2 = rust_matrix.unwrap(); + + assert_eq!(result_matrix, test_matrix); +} + +/// Test unitary_matrix() function for MultiQubitGate Operations for the error case +#[test_case(Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from("PI"))); "MultiQubitMS")] +fn test_pyo3_unitarymatrix_error(input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation.clone()).unwrap(); + let py_result = operation.call_method0(py, "unitary_matrix"); + let result_ref = py_result.as_ref(); + assert!(result_ref.is_err()); +} + +/// Test circuit() function for MultiQubitMS +#[test] +fn test_pyo3_circuit_ms() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let input_operation = + Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(1.0))); + let operation = convert_operation_to_pyobject(input_operation.clone()).unwrap(); + let py_result = operation.call_method0(py, "circuit").unwrap(); + let result_circuit: CircuitWrapper = py_result.extract(py).unwrap(); + + let mut circuit = Circuit::new(); + circuit += Hadamard::new(0); + circuit += Hadamard::new(1); + circuit += Hadamard::new(2); + circuit += CNOT::new(0, 1); + circuit += CNOT::new(1, 2); + circuit += RotateZ::new(2, CalculatorFloat::from(0.5)); + circuit += CNOT::new(1, 2); + circuit += CNOT::new(0, 1); + circuit += Hadamard::new(0); + circuit += Hadamard::new(1); + circuit += Hadamard::new(2); + + assert_eq!(result_circuit.internal, circuit); +} + +/// Test copy and deepcopy functions +#[test_case(Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(1.3))); "MultiQubitMS")] +fn test_pyo3_copy_deepcopy(input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + let copy_op = operation.call_method0(py, "__copy__").unwrap(); + let deepcopy_op = operation.call_method1(py, "__deepcopy__", ("",)).unwrap(); + let copy_deepcopy_param = operation.clone(); + + let comparison_copy = bool::extract( + copy_op + .as_ref(py) + .call_method1("__eq__", (copy_deepcopy_param.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(comparison_copy); + let comparison_deepcopy = bool::extract( + deepcopy_op + .as_ref(py) + .call_method1("__eq__", (copy_deepcopy_param,)) + .unwrap(), + ) + .unwrap(); + assert!(comparison_deepcopy); +} + +/// Test format and repr functions +#[test_case( + "MultiQubitMS { qubits: [0, 1, 2], theta: Float(0.0) }", + Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::ZERO)); + "MultiQubitMS")] +fn test_pyo3_format_repr(format_repr: &str, input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + let to_format = operation.call_method1(py, "__format__", ("",)).unwrap(); + let format_op: &str = <&str>::extract(to_format.as_ref(py)).unwrap(); + assert_eq!(format_op, format_repr); + let to_repr = operation.call_method0(py, "__repr__").unwrap(); + let repr_op: &str = <&str>::extract(to_repr.as_ref(py)).unwrap(); + assert_eq!(repr_op, format_repr); +} + +/// Test substitute_parameters() function for one parameter +#[test_case(Operation::from(MultiQubitMS::new(vec![1, 2, 3], CalculatorFloat::from("theta"))); "MultiQubitMS")] +fn test_pyo3_substitute_params_rotate(input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation.clone()).unwrap(); + let mut substitution_dict_py: HashMap<&str, f64> = HashMap::new(); + substitution_dict_py.insert("theta", 1.0); + let substitute_op = operation + .call_method1(py, "substitute_parameters", (substitution_dict_py,)) + .unwrap(); + + let mut substitution_dict: Calculator = Calculator::new(); + substitution_dict.set_variable("theta", 1.0); + let substitute_param = input_operation + .substitute_parameters(&mut substitution_dict) + .unwrap(); + let test_operation = convert_operation_to_pyobject(substitute_param).unwrap(); + + let comparison = bool::extract( + substitute_op + .as_ref(py) + .call_method1("__eq__", (test_operation.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(comparison); +} + +/// Test substitute_parameters() causing an error `None` +#[test_case(Operation::from(MultiQubitMS::new(vec![1, 2], CalculatorFloat::from("test"))); "MultiQubitMS")] +fn test_pyo3_substitute_params_error(input_operation: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(input_operation).unwrap(); + let substitution_dict: HashMap<&str, f64> = HashMap::new(); + let result = operation.call_method1(py, "substitute_parameters", (substitution_dict,)); + let result_ref = result.as_ref(); + assert!(result_ref.is_err()); +} + +#[test_case( + Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(0.005))), + Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(0.005 * 1.5))); "MultiQubitMS")] +fn test_pyo3_rotate_powercf(first_op: Operation, second_op: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(first_op).unwrap(); + + let power = convert_cf_to_pyobject(py, CalculatorFloat::from(1.5)); + let comparison_op = convert_operation_to_pyobject(second_op).unwrap(); + + let remapped_op = operation.call_method1(py, "powercf", (power,)).unwrap(); + let comparison = bool::extract( + remapped_op + .call_method1(py, "__eq__", (comparison_op,)) + .unwrap() + .as_ref(py), + ) + .unwrap(); + assert!(comparison); +} + +/// Test the __richcmp__ function +#[test_case( + Operation::from(MultiQubitMS::new(vec![0, 1, 2], CalculatorFloat::from(0))), + Operation::from(MultiQubitMS::new(vec![1, 2], CalculatorFloat::from(0))); "MultiQubitMS")] +fn test_pyo3_richcmp(definition_1: Operation, definition_2: Operation) { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation_one = convert_operation_to_pyobject(definition_1).unwrap(); + let operation_two = convert_operation_to_pyobject(definition_2).unwrap(); + + let comparison = bool::extract( + operation_one + .as_ref(py) + .call_method1("__eq__", (operation_two.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(!comparison); + + let comparison = bool::extract( + operation_one + .as_ref(py) + .call_method1("__ne__", (operation_two.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(comparison); + + let comparison = operation_one.call_method1(py, "__eq__", (vec!["fails"],)); + assert!(comparison.is_err()); + + let comparison = operation_one.call_method1(py, "__ge__", (operation_two,)); + assert!(comparison.is_err()); +} diff --git a/qoqo/tests/integration/quantum_program.rs b/qoqo/tests/integration/quantum_program.rs new file mode 100644 index 00000000..f13a2e7b --- /dev/null +++ b/qoqo/tests/integration/quantum_program.rs @@ -0,0 +1,602 @@ +// Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software distributed under the +// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +// express or implied. See the License for the specific language governing permissions and +// limitations under the License. + +use pyo3::prelude::*; +use qoqo::measurements::{ + BasisRotationInputWrapper, BasisRotationWrapper, CheatedBasisRotationInputWrapper, + CheatedBasisRotationWrapper, CheatedInputWrapper, CheatedWrapper, ClassicalRegisterWrapper, +}; +use qoqo::operations::convert_operation_to_pyobject; +use qoqo::{ + convert_into_quantum_program, CircuitWrapper, QoqoError, QuantumProgramWrapper, QOQO_VERSION, +}; +use roqoqo::measurements::{ + BasisRotation, BasisRotationInput, Cheated, CheatedBasisRotation, CheatedBasisRotationInput, + CheatedInput, ClassicalRegister, +}; +use roqoqo::operations::Operation; +use roqoqo::operations::*; +use roqoqo::{Circuit, QuantumProgram, ROQOQO_VERSION}; + +#[pyclass(name = "TestBackend", module = "qoqo")] +#[derive(Debug, Clone, Copy)] +struct TestBackend; + +#[pymethods] +impl TestBackend { + fn run_measurement(&self, measurement: Py) -> PyResult> { + return Ok(measurement); + } +} + +fn create_measurement(py: Python) -> &PyCell { + let input_type = py.get_type::(); + let input = input_type + .call0() + .unwrap() + .cast_as::>() + .unwrap(); + let _ = input.call_method1("add_pauli_product", ("ro",)).unwrap(); + + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + let mut circ1 = CircuitWrapper::new(); + circ1.internal += roqoqo::operations::RotateX::new(0, 0.0.into()); + circs.push(circ1); + let br_type = py.get_type::(); + br_type + .call1((Some(CircuitWrapper::new()), circs.clone(), input)) + .unwrap() + .cast_as::>() + .unwrap() +} + +/// Test basic traits of QuantumProgramWrapper +#[test] +fn test_basic_traits() { + Python::with_gil(|py| -> () { + let input = create_measurement(py); + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let program_wrapper = program.extract::().unwrap(); + + let helper_ne: bool = QuantumProgramWrapper::new(input, vec!["error".into()]).unwrap() + != program_wrapper.clone(); + assert!(helper_ne); + let helper_eq: bool = QuantumProgramWrapper::new(input, vec!["test".into()]).unwrap() + == program_wrapper.clone(); + assert!(helper_eq); + + let helper_eq: bool = program_wrapper.clone() == program_wrapper; + assert!(helper_eq); + + assert_eq!( + format!("{:?}", QuantumProgramWrapper::new(input, vec!["test".into()]).unwrap()), + "QuantumProgramWrapper { internal: CheatedBasisRotation { measurement: CheatedBasisRotation { constant_circuit: Some(Circuit { definitions: [], operations: [] }), circuits: [Circuit { definitions: [], operations: [] }, Circuit { definitions: [], operations: [RotateX(RotateX { qubit: 0, theta: Float(0.0) })] }], input: CheatedBasisRotationInput { measured_exp_vals: {}, pauli_product_keys: {\"ro\": 0} } }, input_parameter_names: [\"test\"] } }" + ); + }) +} + +/// Test new and run functions of QuantumProgram with all BasisRotation measurement input +#[test] +fn test_new_run_br() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + + let input_type = py.get_type::(); + let input_instance = input_type + .call1((3, false)) + .unwrap() + .cast_as::>() + .unwrap(); + let _ = input_instance + .call_method1("add_pauli_product", ("ro", vec![0])) + .unwrap(); + + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + let mut circ1 = CircuitWrapper::new(); + circ1.internal += RotateX::new(0, 0.0.into()); + circs.push(circ1.clone()); + let br_type = py.get_type::(); + let input = br_type + .call1((Some(CircuitWrapper::new()), circs.clone(), input_instance)) + .unwrap() + .cast_as::>() + .unwrap(); + + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let program_wrapper = program.extract::().unwrap(); + + let mut bri = BasisRotationInput::new(3, false); + let _ = bri.add_pauli_product("ro".to_string(), vec![0]); + let br = BasisRotation { + constant_circuit: Some(Circuit::new()), + circuits: vec![Circuit::new(), circ1.internal], + input: bri, + }; + + assert_eq!( + program_wrapper, + QuantumProgramWrapper { + internal: QuantumProgram::BasisRotation { + measurement: br.clone(), + input_parameter_names: vec!["test".to_string()] + } + } + ); + + let measurement = BasisRotationWrapper::extract( + program + .call_method1("run", (TestBackend, Some(vec![0.0]))) + .unwrap(), + ) + .unwrap(); + assert_eq!(measurement.internal, br); +} + +/// Test new and run functions of QuantumProgram with all CheatedBasisRotation measurement input +#[test] +fn test_new_run_cheated_br() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + + let input_type = py.get_type::(); + let input_instance = input_type + .call0() + .unwrap() + .cast_as::>() + .unwrap(); + let _ = input_instance + .call_method1("add_pauli_product", ("ro",)) + .unwrap(); + + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + let mut circ1 = CircuitWrapper::new(); + circ1.internal += RotateX::new(0, 0.0.into()); + circs.push(circ1.clone()); + let br_type = py.get_type::(); + let input = br_type + .call1((Some(CircuitWrapper::new()), circs.clone(), input_instance)) + .unwrap() + .cast_as::>() + .unwrap(); + + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let program_wrapper = program.extract::().unwrap(); + + let mut cbri = CheatedBasisRotationInput::new(); + cbri.add_pauli_product("ro".to_string()); + let cbr = CheatedBasisRotation { + constant_circuit: Some(Circuit::new()), + circuits: vec![Circuit::new(), circ1.internal], + input: cbri, + }; + + assert_eq!( + program_wrapper, + QuantumProgramWrapper { + internal: QuantumProgram::CheatedBasisRotation { + measurement: cbr.clone(), + input_parameter_names: vec!["test".to_string()] + } + } + ); + + let measurement = CheatedBasisRotationWrapper::extract( + program + .call_method1("run", (TestBackend, Some(vec![0.0]))) + .unwrap(), + ) + .unwrap(); + assert_eq!(measurement.internal, cbr); + let error = program.call_method1("run_registers", (TestBackend, Some(vec![0.0]))); + assert!(error.is_err()); +} + +/// Test new and run functions of QuantumProgram with all Cheated measurement input +#[test] +fn test_new_run_cheated() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + + let input_type = py.get_type::(); + let input_instance = input_type + .call1((2,)) + .unwrap() + .cast_as::>() + .unwrap(); + + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + let mut circ1 = CircuitWrapper::new(); + circ1.internal += RotateX::new(0, 0.0.into()); + circs.push(circ1.clone()); + let br_type = py.get_type::(); + let input = br_type + .call1((Some(CircuitWrapper::new()), circs.clone(), input_instance)) + .unwrap() + .cast_as::>() + .unwrap(); + + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let program_wrapper = program.extract::().unwrap(); + + let ci = CheatedInput::new(2); + let cheated = Cheated { + constant_circuit: Some(Circuit::new()), + circuits: vec![Circuit::new(), circ1.internal], + input: ci, + }; + + assert_eq!( + program_wrapper, + QuantumProgramWrapper { + internal: QuantumProgram::Cheated { + measurement: cheated.clone(), + input_parameter_names: vec!["test".to_string()] + } + } + ); + + let measurement = CheatedWrapper::extract( + program + .call_method1("run", (TestBackend, Some(vec![0.0]))) + .unwrap(), + ) + .unwrap(); + assert_eq!(measurement.internal, cheated); +} + +/// Test new and run_register functions of QuantumProgram with all ClassicalRegister measurement input +#[test] +fn test_new_run_classical_register() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + + let mut circs: Vec = Vec::new(); + circs.push(CircuitWrapper::new()); + let mut circ1 = CircuitWrapper::new(); + circ1.internal += RotateX::new(0, 0.0.into()); + circs.push(circ1.clone()); + let br_type = py.get_type::(); + let input = br_type + .call1((Some(CircuitWrapper::new()), circs.clone())) + .unwrap() + .cast_as::>() + .unwrap(); + + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let program_wrapper = program.extract::().unwrap(); + + let cr = ClassicalRegister { + constant_circuit: Some(Circuit::new()), + circuits: vec![Circuit::new(), circ1.internal], + }; + + assert_eq!( + program_wrapper, + QuantumProgramWrapper { + internal: QuantumProgram::ClassicalRegister { + measurement: cr.clone(), + input_parameter_names: vec!["test".to_string()] + } + } + ); + + let measurement = ClassicalRegisterWrapper::extract( + program + .call_method1("run_registers", (TestBackend, Some(vec![0.0]))) + .unwrap(), + ) + .unwrap(); + assert_eq!(measurement.internal, cr); + let error = program.call_method1("run", (TestBackend, Some(vec![0.0]))); + assert!(error.is_err()); +} + +/// Test new function of QuantumProgram first error +#[test] +fn test_new_error_1() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + + let circs: Vec = Vec::new(); + let program_type = py.get_type::(); + let program = program_type.call1((circs, vec!["test".to_string()])); + assert!(program.is_err()); +} + +/// Test copy and deepcopy functions of QuantumProgram +#[test] +fn test_copy_deepcopy() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let input = create_measurement(py); + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + + let copy_circ = program.call_method0("__copy__").unwrap(); + let deepcopy_circ = program.call_method1("__deepcopy__", ("",)).unwrap(); + let copy_deepcopy_param = program.clone(); + + let comparison_copy = bool::extract( + copy_circ + .call_method1("__eq__", (copy_deepcopy_param.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(comparison_copy); + let comparison_deepcopy = bool::extract( + deepcopy_circ + .call_method1("__eq__", (copy_deepcopy_param,)) + .unwrap(), + ) + .unwrap(); + assert!(comparison_deepcopy); +} + +/// Test qoqo_versions function of QuantumProgram +#[test] +fn test_qoqo_versions() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let input = create_measurement(py); + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + + let mut rsplit = ROQOQO_VERSION.split('.').take(2); + let mut qsplit = QOQO_VERSION.split('.').take(2); + let rver = format!( + "{}.{}", + rsplit.next().expect("ROQOQO_VERSION badly formatted"), + rsplit.next().expect("ROQOQO_VERSION badly formatted") + ); + let qver = format!( + "{}.{}", + qsplit.next().expect("QOQO_VERSION badly formatted"), + qsplit.next().expect("QOQO_VERSION badly formatted") + ); + + let comparison_copy: Vec<&str> = + Vec::extract(program.call_method0("_qoqo_versions").unwrap()).unwrap(); + assert_eq!(comparison_copy, vec![rver.as_str(), qver.as_str()]); +} + +/// Test to_ and from_bincode functions of QuantumProgram +#[test] +fn test_to_from_bincode() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let input = create_measurement(py); + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + + let serialised = program.call_method0("to_bincode").unwrap(); + let new = program_type + .call1((input, vec!["new".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let deserialised = new.call_method1("from_bincode", (serialised,)).unwrap(); + + let deserialised_error = + new.call_method1("from_bincode", (bincode::serialize("fails").unwrap(),)); + assert!(deserialised_error.is_err()); + + let deserialised_error = + new.call_method1("from_bincode", (bincode::serialize(&vec![0]).unwrap(),)); + assert!(deserialised_error.is_err()); + + let deserialised_error = deserialised.call_method0("from_bincode"); + assert!(deserialised_error.is_err()); + + let serialised_error = serialised.call_method0("to_bincode"); + assert!(serialised_error.is_err()); + + let comparison = + bool::extract(deserialised.call_method1("__eq__", (program,)).unwrap()).unwrap(); + assert!(comparison) +} + +#[test] +fn test_value_error_bincode() { + pyo3::prepare_freethreaded_python(); + let gil = Python::acquire_gil(); + let py = gil.python(); + let input = create_measurement(py); + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + + let program_clone = program.clone(); + let serialised = program.call_method0("to_bincode").unwrap(); + let deserialised = program_clone + .call_method1("from_bincode", (serialised,)) + .unwrap() + .cast_as::>() + .unwrap(); + + let new = program_type + .call1((input, vec!["new".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let deserialised_error = new.call_method1("from_bincode", (deserialised,)); + assert!(deserialised_error.is_err()); +} + +/// Test to_ and from_json functions of QuantumProgram +#[test] +fn test_to_from_json() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let input = create_measurement(py); + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["test".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + + let serialised = program.call_method0("to_json").unwrap(); + let new = program_type + .call1((input, vec!["new".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let deserialised = new.call_method1("from_json", (serialised,)).unwrap(); + + let deserialised_error = + new.call_method1("from_json", (serde_json::to_string("fails").unwrap(),)); + assert!(deserialised_error.is_err()); + + let deserialised_error = + new.call_method1("from_json", (serde_json::to_string(&vec![0]).unwrap(),)); + assert!(deserialised_error.is_err()); + + let serialised_error = serialised.call_method0("to_json"); + assert!(serialised_error.is_err()); + + let deserialised_error = deserialised.call_method0("from_json"); + assert!(deserialised_error.is_err()); + + let comparison = + bool::extract(deserialised.call_method1("__eq__", (program,)).unwrap()).unwrap(); + assert!(comparison) +} + +/// Test the __richcmp__ function +#[test] +fn test_richcmp() { + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let input = create_measurement(py); + let program_type = py.get_type::(); + let program_one = program_type + .call1((input, vec!["one".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let program_two = program_type + .call1((input, vec!["two".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + + let operation1 = convert_operation_to_pyobject(Operation::from(PauliX::new(0))).unwrap(); + + let comparison = + bool::extract(program_one.call_method1("__eq__", (program_two,)).unwrap()).unwrap(); + assert!(!comparison); + let comparison = bool::extract( + program_one + .call_method1("__eq__", (operation1.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(!comparison); + + let comparison = + bool::extract(program_one.call_method1("__ne__", (program_two,)).unwrap()).unwrap(); + assert!(comparison); + let comparison = bool::extract( + program_one + .call_method1("__ne__", (operation1.clone(),)) + .unwrap(), + ) + .unwrap(); + assert!(comparison); + + let comparison = program_one.call_method1("__ge__", (operation1,)); + assert!(comparison.is_err()); +} + +#[test] +fn test_convert_into_program() { + let added_op = Operation::from(PauliX::new(0)); + pyo3::prepare_freethreaded_python(); + let gil = pyo3::Python::acquire_gil(); + let py = gil.python(); + let operation = convert_operation_to_pyobject(added_op).unwrap(); + // let circuit_type = py.get_type::(); + // let circ = circuit_type + // .call0() + // .unwrap() + // .cast_as::>() + // .unwrap(); + + let input = create_measurement(py); + let program_type = py.get_type::(); + let program = program_type + .call1((input, vec!["one".to_string()])) + .unwrap() + .cast_as::>() + .unwrap(); + let comparison = program.call_method1("convert_into_quantum_program", (operation.clone(),)); + assert!(comparison.is_err()); + assert_eq!( + convert_into_quantum_program(operation.as_ref(py)), + Err(QoqoError::CannotExtractObject) + ); + // assert_eq!(convert_into_quantum_program(circ), Err(QoqoError::VersionMismatch)); +} diff --git a/roqoqo/tests/integration/quantum_program.rs b/roqoqo/tests/integration/quantum_program.rs index b9849f3a..8f063bc0 100644 --- a/roqoqo/tests/integration/quantum_program.rs +++ b/roqoqo/tests/integration/quantum_program.rs @@ -160,7 +160,7 @@ fn test_cheated() { #[test] fn test_registers() { - // setting ub BR measurement + // setting up BR measurement let mut circs: Vec = Vec::new(); let mut circ1 = Circuit::new(); let mut circ1_subs = Circuit::new(); From 9ac49a38d48940fdd190487725e783ceb3e3fb6b Mon Sep 17 00:00:00 2001 From: Nicolas Vogt <45093608+nfwvogt@users.noreply.github.com> Date: Thu, 18 Nov 2021 19:14:47 +0100 Subject: [PATCH 11/11] Fix_multi_qubit_zz (#133) * update dependencies * updated dependencies * fixing bug in MultiQubitZZ gate * Update multi_qubit_gate_operations.rs Co-authored-by: kbarkhqs <65908581+kbarkhqs@users.noreply.github.com> --- roqoqo/src/operations/multi_qubit_gate_operations.rs | 12 +++++++++++- .../operations/multi_qubit_gate_operations.rs | 12 ++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/roqoqo/src/operations/multi_qubit_gate_operations.rs b/roqoqo/src/operations/multi_qubit_gate_operations.rs index 75dc939a..daca65dc 100644 --- a/roqoqo/src/operations/multi_qubit_gate_operations.rs +++ b/roqoqo/src/operations/multi_qubit_gate_operations.rs @@ -10,6 +10,8 @@ // express or implied. See the License for the specific language governing permissions and // limitations under the License. +use std::panic; + use crate::operations; use crate::prelude::*; use crate::Circuit; @@ -127,7 +129,15 @@ impl OperateGate for MultiQubitZZ { let cos: Complex64 = Complex64::new((self.theta.float()? / 2.0).cos(), 0.0); let sin: Complex64 = Complex64::new(0.0, -(self.theta.float()? / 2.0).sin()); for i in 0..dim { - array[(i, i)] = cos + sin; + // Fix the signs of the imaginary part due to the ZZZ..ZZ product + let prefactor: f64 = (0..self.qubits.len()) + .map(|q| match i.div_euclid(2usize.pow(q as u32)) % 2 { + 0 => 1.0, + 1 => -1.0, + _ => panic!("Internal division error MuliQubitZZ"), + }) + .product(); + array[(i, i)] = cos + prefactor * sin; } Ok(array) } diff --git a/roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs b/roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs index 29a9c01a..fe444cd5 100644 --- a/roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs +++ b/roqoqo/tests/integration/operations/multi_qubit_gate_operations.rs @@ -337,14 +337,14 @@ fn test_matrix_output_multi_qubit_zz(qubits: Vec) { ], [ Complex64::new(0.0, 0.0), - Complex64::new(f, (-1.0) * f), + Complex64::new(f, f), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0) ], [ Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), - Complex64::new(f, (-1.0) * f), + Complex64::new(f, f), Complex64::new(0.0, 0.0) ], [ @@ -376,7 +376,7 @@ fn test_matrix_output_three_multi_qubit_zz(qubits: Vec) { ], [ Complex64::new(0.0, 0.0), - Complex64::new(f, (-1.0) * f), + Complex64::new(f, f), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), @@ -387,7 +387,7 @@ fn test_matrix_output_three_multi_qubit_zz(qubits: Vec) { [ Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), - Complex64::new(f, (-1.0) * f), + Complex64::new(f, f), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), @@ -409,7 +409,7 @@ fn test_matrix_output_three_multi_qubit_zz(qubits: Vec) { Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), - Complex64::new(f, (-1.0) * f), + Complex64::new(f, f), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0) @@ -442,7 +442,7 @@ fn test_matrix_output_three_multi_qubit_zz(qubits: Vec) { Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), Complex64::new(0.0, 0.0), - Complex64::new(f, (-1.0) * f) + Complex64::new(f, f) ], ]; let unit = gate.unitary_matrix().unwrap();