pennylane-qrack 0.15.3__py3-none-manylinux_2_31_x86_64.whl → 0.15.6__py3-none-manylinux_2_31_x86_64.whl

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.

Potentially problematic release.


This version of pennylane-qrack might be problematic. Click here for more details.

@@ -16,4 +16,4 @@
16
16
  Version number (major.minor.patch[-label])
17
17
  """
18
18
 
19
- __version__ = "0.15.3"
19
+ __version__ = "0.15.6"
Binary file
@@ -43,6 +43,7 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
43
43
  bool hp;
44
44
  bool nw;
45
45
  size_t shots;
46
+ Qrack::real1_f noise_param;
46
47
  Qrack::QInterfacePtr qsim;
47
48
  std::map<QubitIdType, bitLenInt> qubit_map;
48
49
  std::vector<QrackObservable> obs_cache;
@@ -392,6 +393,7 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
392
393
  , hp(false)
393
394
  , nw(false)
394
395
  , shots(1U)
396
+ , noise_param(ZERO_R1_F)
395
397
  , qsim(nullptr)
396
398
  {
397
399
  // Cut leading '{' and trailing '}'
@@ -413,7 +415,6 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
413
415
  keyMap["'noise'"] = 10;
414
416
 
415
417
  size_t pos;
416
- Qrack::real1_f noiseParam = 0;
417
418
  while ((pos = kwargs.find(":")) != std::string::npos) {
418
419
  std::string key = trim(kwargs.substr(0, pos));
419
420
  kwargs.erase(0, pos + 1U);
@@ -450,8 +451,8 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
450
451
  hp = val;
451
452
  break;
452
453
  case 10:
453
- noiseParam = std::stof(value);
454
- nw = noiseParam > ZERO_R1;
454
+ noise_param = std::stof(value);
455
+ nw = noise_param > ZERO_R1;
455
456
  break;
456
457
  default:
457
458
  break;
@@ -459,8 +460,8 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
459
460
  }
460
461
 
461
462
  qsim = QSIM_CONFIG(0U);
462
- if (noiseParam > ZERO_R1) {
463
- qsim->SetNoiseParameter(noiseParam);
463
+ if (noise_param > ZERO_R1) {
464
+ qsim->SetNoiseParameter(noise_param);
464
465
  }
465
466
  }
466
467
 
@@ -558,12 +559,20 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
558
559
  {
559
560
  // State vector is left empty
560
561
  qsim = QSIM_CONFIG(0U);
562
+ if (noise_param > ZERO_R1) {
563
+ qsim->SetNoiseParameter(noise_param);
564
+ }
561
565
  }
562
566
  [[nodiscard]] auto GetNumQubits() const -> size_t override
563
567
  {
564
568
  return qsim->GetQubitCount();
565
569
  }
566
- void SetDeviceShots(size_t s) override { shots = s; }
570
+ void SetDeviceShots(size_t s) override {
571
+ if ((s > 1U) && (noise_param > ZERO_R1_F)) {
572
+ throw std::domain_error("Shots > 1 can't be simulated with noise on the Qrack back end! (Likely, you want to set mcm_method=\"one-shot\" on your qnode, with multiple shots.)");
573
+ }
574
+ shots = s;
575
+ }
567
576
  [[nodiscard]] auto GetDeviceShots() const -> size_t override { return shots; }
568
577
  void StartTapeRecording() override { tapeRecording = true; }
569
578
  void StopTapeRecording() override { tapeRecording = false; }
@@ -730,6 +739,10 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
730
739
  {
731
740
  RT_FAIL_IF(samples.size() != shots * qsim->GetQubitCount(), "Invalid size for the pre-allocated samples");
732
741
 
742
+ if ((shots > 1U) && (noise_param > ZERO_R1_F)) {
743
+ throw std::domain_error("Shots > 1 can't be simulated with noise on the Qrack back end! (Likely, you want to set mcm_method=\"one-shot\" on your qnode, with multiple shots.)");
744
+ }
745
+
733
746
  if (shots == 1U) {
734
747
  const bitCapInt rev_sample = qsim->MAll();
735
748
  const bitLenInt numQubits = qsim->GetQubitCount();
@@ -755,6 +768,10 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
755
768
  {
756
769
  RT_FAIL_IF(samples.size() != shots * wires.size(), "Invalid size for the pre-allocated samples");
757
770
 
771
+ if ((shots > 1U) && (noise_param > ZERO_R1_F)) {
772
+ throw std::domain_error("Shots > 1 can't be simulated with noise on the Qrack back end! (Likely, you want to set mcm_method=\"one-shot\" on your qnode, with multiple shots.)");
773
+ }
774
+
758
775
  auto &&dev_wires = getDeviceWires(wires);
759
776
 
760
777
  if (shots == 1U) {
@@ -835,6 +852,10 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
835
852
  RT_FAIL_IF(eigvals.size() != numElements || counts.size() != numElements,
836
853
  "Invalid size for the pre-allocated counts");
837
854
 
855
+ if ((shots > 1U) && (noise_param > ZERO_R1_F)) {
856
+ throw std::domain_error("Shots > 1 can't be simulated with noise on the Qrack back end! (Likely, you want to set mcm_method=\"one-shot\" on your qnode, with multiple shots.)");
857
+ }
858
+
838
859
  auto &&dev_wires = getDeviceWires(wires);
839
860
 
840
861
  std::map<bitCapInt, int> q_samples;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pennylane-qrack
3
- Version: 0.15.3
3
+ Version: 0.15.6
4
4
  Summary: PennyLane plugin for Qrack.
5
5
  Home-page: http://github.com/vm6502q
6
6
  Maintainer: vm6502q
@@ -2,14 +2,14 @@ pennylane_qrack/CMakeCache.txt,sha256=ErlfVMPMzV00FGPJSo1MIPIBFIK5bvfQx30Kz1cm8Z
2
2
  pennylane_qrack/Makefile,sha256=Od_33AWv8Jgk8ZWvL7lklT2Awce38c1lIgMyys5-RuE,7584
3
3
  pennylane_qrack/QrackDeviceConfig.toml,sha256=oR9-dIAP6BzP3e2QSLroacaloHZsx7iJiKE6w7LGxUo,5459
4
4
  pennylane_qrack/__init__.py,sha256=_g4NKu07_pXqxvQaxjdAPe769S5tWwYjqyHi3z7YKHc,673
5
- pennylane_qrack/_version.py,sha256=CPo-ygPLp-vSP-oeDRBN8MkJMAVQKSBhu_GJDJvO8Pk,692
5
+ pennylane_qrack/_version.py,sha256=pLBGUrX5QbAdqACTFPBe2O0z4YTiqbBcrToAHhPOKAo,692
6
6
  pennylane_qrack/cmake_install.cmake,sha256=jP3YWPs_F3JYlifubQTLq95RWHkadWyv_BNvMw3MzhU,3521
7
- pennylane_qrack/libqrack_device.so,sha256=tKJdpmYgHNwh5-y7pgYKlLbr0Jk7AJSpJISCgh6B0qA,5571120
8
- pennylane_qrack/qrack_device.cpp,sha256=KmFmugfYT_q2wt_iSvaHkhD3CzUe5UrlT_OYdNlVEgo,36953
7
+ pennylane_qrack/libqrack_device.so,sha256=7Yp6IEoXX4rn4CJJ2rEMDAb52OsSaj_nOf2ZgYGrHG4,5571120
8
+ pennylane_qrack/qrack_device.cpp,sha256=0Dbey1g3DQeWYrzS9622Y7QDhizISuII49XLuv9xFIY,38115
9
9
  pennylane_qrack/qrack_device.py,sha256=DEiYy1eJQumWRIiNgxRWqc4YOYS1f85O2Jio7lWPuV8,27883
10
- pennylane_qrack-0.15.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
- pennylane_qrack-0.15.3.dist-info/METADATA,sha256=2ikT7iRIE38--sWHp6eSEja58CPvfi23A0Jqo23bGvE,5719
12
- pennylane_qrack-0.15.3.dist-info/WHEEL,sha256=31CfkK4NnMz4Yk9n2YTrEvRpWZgEQV_ngE0dT6YRbQ8,110
13
- pennylane_qrack-0.15.3.dist-info/entry_points.txt,sha256=V6f1sN6IZZZaEvxrI47A3K_kksp8fDUWjLWD0Met7Ww,79
14
- pennylane_qrack-0.15.3.dist-info/top_level.txt,sha256=5NFMNHqCHtVLwNkLg66xz846uUJAlnOJ5VGa6ulW1ow,16
15
- pennylane_qrack-0.15.3.dist-info/RECORD,,
10
+ pennylane_qrack-0.15.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
11
+ pennylane_qrack-0.15.6.dist-info/METADATA,sha256=GfREwD5XsKvd1X6odDI1MyTIYe554l2oKd0kY33T5t8,5719
12
+ pennylane_qrack-0.15.6.dist-info/WHEEL,sha256=31CfkK4NnMz4Yk9n2YTrEvRpWZgEQV_ngE0dT6YRbQ8,110
13
+ pennylane_qrack-0.15.6.dist-info/entry_points.txt,sha256=V6f1sN6IZZZaEvxrI47A3K_kksp8fDUWjLWD0Met7Ww,79
14
+ pennylane_qrack-0.15.6.dist-info/top_level.txt,sha256=5NFMNHqCHtVLwNkLg66xz846uUJAlnOJ5VGa6ulW1ow,16
15
+ pennylane_qrack-0.15.6.dist-info/RECORD,,