pyrauli 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {pyrauli-0.1.0 → pyrauli-0.2.0}/CMakeLists.txt +1 -1
  2. {pyrauli-0.1.0 → pyrauli-0.2.0}/PKG-INFO +2 -2
  3. {pyrauli-0.1.0 → pyrauli-0.2.0}/README.md +1 -1
  4. {pyrauli-0.1.0 → pyrauli-0.2.0}/pyproject.toml +1 -1
  5. {pyrauli-0.1.0 → pyrauli-0.2.0}/src/pyrauli/_core/bindings.cpp +71 -1
  6. {pyrauli-0.1.0 → pyrauli-0.2.0}/.clang-format +0 -0
  7. {pyrauli-0.1.0 → pyrauli-0.2.0}/.github/workflows/benchmark.yml +0 -0
  8. {pyrauli-0.1.0 → pyrauli-0.2.0}/.github/workflows/ci.yml +0 -0
  9. {pyrauli-0.1.0 → pyrauli-0.2.0}/.github/workflows/doc.yml +0 -0
  10. {pyrauli-0.1.0 → pyrauli-0.2.0}/.github/workflows/pypi.yml +0 -0
  11. {pyrauli-0.1.0 → pyrauli-0.2.0}/.gitignore +0 -0
  12. {pyrauli-0.1.0 → pyrauli-0.2.0}/LICENSE +0 -0
  13. {pyrauli-0.1.0 → pyrauli-0.2.0}/benchmarks/test_benchmark_circuit.py +0 -0
  14. {pyrauli-0.1.0 → pyrauli-0.2.0}/benchmarks/test_benchmark_observable.py +0 -0
  15. {pyrauli-0.1.0 → pyrauli-0.2.0}/benchmarks/test_benchmark_qiskit.py +0 -0
  16. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/.gitignore +0 -0
  17. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/Makefile +0 -0
  18. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/_static/.gitkeep +0 -0
  19. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/_templates/.gitkeep +0 -0
  20. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/conf.py +0 -0
  21. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/explanation/theory.rst +0 -0
  22. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/guides/how_to_circuit.rst +0 -0
  23. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/guides/how_to_complexity.rst +0 -0
  24. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/guides/how_to_noise.rst +0 -0
  25. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/guides/how_to_observables.rst +0 -0
  26. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/guides/how_to_qiskit.rst +0 -0
  27. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/index.rst +0 -0
  28. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/make.bat +0 -0
  29. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/reference/api.rst +0 -0
  30. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/requirements.txt +0 -0
  31. {pyrauli-0.1.0 → pyrauli-0.2.0}/docs/tutorials/getting_started.rst +0 -0
  32. {pyrauli-0.1.0 → pyrauli-0.2.0}/examples/qiskit_backend.py +0 -0
  33. {pyrauli-0.1.0 → pyrauli-0.2.0}/src/pyrauli/__init__.py +0 -0
  34. {pyrauli-0.1.0 → pyrauli-0.2.0}/src/pyrauli/backend.py +0 -0
  35. {pyrauli-0.1.0 → pyrauli-0.2.0}/src/pyrauli/converters.py +0 -0
  36. {pyrauli-0.1.0 → pyrauli-0.2.0}/src/pyrauli/estimator.py +0 -0
  37. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/snippets/test_basic_circuit.py +0 -0
  38. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/snippets/test_observable_evolution.py +0 -0
  39. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/snippets/test_qiskit_backend_usage.py +0 -0
  40. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/snippets/test_readme.py +0 -0
  41. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_backend.py +0 -0
  42. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_circuit.py +0 -0
  43. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_circuit_qiskit.py +0 -0
  44. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_noise_model.py +0 -0
  45. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_observable.py +0 -0
  46. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_observable_qiskit.py +0 -0
  47. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_pauli.py +0 -0
  48. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_policies.py +0 -0
  49. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_pyrauli.py +0 -0
  50. {pyrauli-0.1.0 → pyrauli-0.2.0}/tests/test_truncator.py +0 -0
@@ -15,7 +15,7 @@ FetchContent_Declare(
15
15
  FetchContent_Declare(
16
16
  propauli
17
17
  GIT_REPOSITORY https://github.com/zefresk/propauli.git
18
- GIT_TAG v1.2.0
18
+ GIT_TAG v2.0.2
19
19
  )
20
20
 
21
21
  FetchContent_MakeAvailable(pybind11 propauli)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pyrauli
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: A very fast and easy to use Quantum circuit simulator relying on Pauli propagation. Compatible with qiskit.
5
5
  License: GNU GENERAL PUBLIC LICENSE
6
6
  Version 3, 29 June 2007
@@ -801,7 +801,7 @@ For comprehensive information, including tutorials, how-to guides, and the full
801
801
 
802
802
  ## benchmarks
803
803
 
804
- **pyrauli** latest benchmarks results are available here: **https://zefresk.github.io/dev/bench/**
804
+ **pyrauli** latest benchmarks results are available here: **https://zefresk.github.io/pyrauli/dev/bench/**
805
805
 
806
806
  ## References
807
807
 
@@ -106,7 +106,7 @@ For comprehensive information, including tutorials, how-to guides, and the full
106
106
 
107
107
  ## benchmarks
108
108
 
109
- **pyrauli** latest benchmarks results are available here: **https://zefresk.github.io/dev/bench/**
109
+ **pyrauli** latest benchmarks results are available here: **https://zefresk.github.io/pyrauli/dev/bench/**
110
110
 
111
111
  ## References
112
112
 
@@ -5,7 +5,7 @@ build-backend = "scikit_build_core.build"
5
5
 
6
6
  [project]
7
7
  name = "pyrauli"
8
- version = "0.1.0"
8
+ version = "0.2.0"
9
9
  description = "A very fast and easy to use Quantum circuit simulator relying on Pauli propagation. Compatible with qiskit."
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.9"
@@ -1,3 +1,4 @@
1
+ #include "pauli_term_container.hpp"
1
2
  #include <pybind11/pybind11.h>
2
3
  #include <pybind11/stl.h>
3
4
  #include <pybind11/operators.h>
@@ -5,6 +6,7 @@
5
6
 
6
7
  #include <sstream>
7
8
  #include <memory>
9
+ #include <string>
8
10
  #include <vector>
9
11
 
10
12
  #include "circuit.hpp"
@@ -17,6 +19,8 @@
17
19
 
18
20
  namespace py = pybind11;
19
21
 
22
+ using PTC = PauliTermContainer<coeff_t>;
23
+
20
24
  // Define alias for our holder types for clarity
21
25
  using TruncatorPtr = std::shared_ptr<Truncator<coeff_t>>;
22
26
  using SchedulingPolicyPtr = std::shared_ptr<SchedulingPolicy>;
@@ -29,7 +33,7 @@ using NeverPolicyPtr = std::shared_ptr<NeverPolicy>;
29
33
  using AlwaysBeforePolicyPtr = std::shared_ptr<AlwaysBeforeSplittingPolicy>;
30
34
  using AlwaysAfterPolicyPtr = std::shared_ptr<AlwaysAfterSplittingPolicy>;
31
35
 
32
- using LambdaPredicate_t = std::function<bool(PauliTerm<coeff_t> const&)>;
36
+ using LambdaPredicate_t = std::function<bool(PauliTermContainer<coeff_t>::NonOwningPauliTermPacked const&)>;
33
37
  using LambdaTruncator = PredicateTruncator<LambdaPredicate_t>;
34
38
  using LambdaTruncatorPtr = std::shared_ptr<LambdaTruncator>;
35
39
 
@@ -305,4 +309,70 @@ PYBIND11_MODULE(_core, m) {
305
309
  "Sets a new policy for when to merge Pauli terms.")
306
310
  .def("set_truncate_policy", &Circuit<coeff_t>::set_truncate_policy,
307
311
  "Sets a new policy for when to truncate the observable.");
312
+
313
+ py::class_<PTC::ReadOnlyNonOwningPauliTermPacked>(m, "ReadOnlyPackedPauliTermView",
314
+ "A read-only, non-owning view of a packed Pauli term.")
315
+ .def_property_readonly("coefficient", &PTC::ReadOnlyNonOwningPauliTermPacked::coefficient,
316
+ "The coefficient of the term.")
317
+ .def_property_readonly("nb_qubits", &PTC::ReadOnlyNonOwningPauliTermPacked::size,
318
+ "The number of qubits in the term.")
319
+ .def("pauli_weight", &PTC::ReadOnlyNonOwningPauliTermPacked::pauli_weight,
320
+ "Calculates the Pauli weight (number of non-identity operators).")
321
+ .def("expectation_value", &PTC::ReadOnlyNonOwningPauliTermPacked::expectation_value,
322
+ "Calculates the expectation value of this single term.")
323
+ .def(
324
+ "to_pauli_term",
325
+ [](const PTC::ReadOnlyNonOwningPauliTermPacked& self) {
326
+ return static_cast<PauliTerm<coeff_t>>(self);
327
+ },
328
+ "Creates an owning PauliTerm copy from this view.")
329
+ .def("__len__", &PTC::ReadOnlyNonOwningPauliTermPacked::size)
330
+ .def("__getitem__", &PTC::ReadOnlyNonOwningPauliTermPacked::get_pauli,
331
+ "Gets the Pauli operator at a specific qubit index.")
332
+ .def(py::self == py::self)
333
+ .def(
334
+ "__eq__",
335
+ [](const PTC::ReadOnlyNonOwningPauliTermPacked& self, const PauliTerm<coeff_t>& other) {
336
+ return self == other;
337
+ },
338
+ "Compares this view with an owning PauliTerm object.")
339
+ .def("__repr__", [](const PTC::ReadOnlyNonOwningPauliTermPacked& pt) {
340
+ std::stringstream ss;
341
+ ss << pt;
342
+ return ss.str();
343
+ });
344
+
345
+ py::class_<PTC::NonOwningPauliTermPacked>(m, "PackedPauliTermView",
346
+ "A mutable, non-owning view of a packed Pauli term.")
347
+ .def_property("coefficient", &PTC::NonOwningPauliTermPacked::coefficient,
348
+ &PTC::NonOwningPauliTermPacked::set_coefficient,
349
+ "The coefficient of the term (read/write).")
350
+ .def_property_readonly("nb_qubits", &PTC::NonOwningPauliTermPacked::size,
351
+ "The number of qubits in the term.")
352
+ .def("pauli_weight", &PTC::NonOwningPauliTermPacked::pauli_weight,
353
+ "Calculates the Pauli weight (number of non-identity operators).")
354
+ .def("expectation_value", &PTC::NonOwningPauliTermPacked::expectation_value,
355
+ "Calculates the expectation value of this single term.")
356
+ .def(
357
+ "to_pauli_term",
358
+ [](const PTC::NonOwningPauliTermPacked& self) { return static_cast<PauliTerm<coeff_t>>(self); },
359
+ "Creates an owning PauliTerm copy from this view.")
360
+ .def("add_coeff", &PTC::NonOwningPauliTermPacked::add_coeff, "Adds a value to the term's coefficient.")
361
+ .def("__len__", &PTC::NonOwningPauliTermPacked::size)
362
+ .def("__getitem__", &PTC::NonOwningPauliTermPacked::get_pauli,
363
+ "Gets the Pauli operator at a specific qubit index.")
364
+ .def("__setitem__", &PTC::NonOwningPauliTermPacked::set_pauli,
365
+ "Sets the Pauli operator at a specific qubit index.")
366
+ .def(py::self == py::self)
367
+ .def(
368
+ "__eq__",
369
+ [](const PTC::NonOwningPauliTermPacked& self, const PauliTerm<coeff_t>& other) {
370
+ return self == other;
371
+ },
372
+ "Compares this view with an owning PauliTerm object.")
373
+ .def("__repr__", [](const PTC::NonOwningPauliTermPacked& pt) {
374
+ std::stringstream ss;
375
+ ss << pt;
376
+ return ss.str();
377
+ });
308
378
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes