pennylane-qrack 0.9.8__tar.gz → 0.10.1__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.

Potentially problematic release.


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

Files changed (29) hide show
  1. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/Makefile +1 -1
  2. {pennylane_qrack-0.9.8/pennylane_qrack.egg-info → pennylane-qrack-0.10.1}/PKG-INFO +1 -4
  3. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack/QrackDeviceConfig.toml +2 -2
  4. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack/_version.py +1 -1
  5. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack/qrack_device.cpp +7 -2
  6. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack/qrack_device.py +5 -5
  7. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1/pennylane_qrack.egg-info}/PKG-INFO +1 -4
  8. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack.egg-info/SOURCES.txt +1 -9
  9. pennylane_qrack-0.9.8/catalyst/runtime/include/DataView.hpp +0 -147
  10. pennylane_qrack-0.9.8/catalyst/runtime/include/Exception.hpp +0 -87
  11. pennylane_qrack-0.9.8/catalyst/runtime/include/QuantumDevice.hpp +0 -319
  12. pennylane_qrack-0.9.8/catalyst/runtime/include/RuntimeCAPI.h +0 -109
  13. pennylane_qrack-0.9.8/catalyst/runtime/include/Types.h +0 -156
  14. pennylane_qrack-0.9.8/tests/test_apply.py +0 -662
  15. pennylane_qrack-0.9.8/tests/test_integration.py +0 -87
  16. pennylane_qrack-0.9.8/tests/test_units.py +0 -81
  17. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/CHANGELOG.md +0 -0
  18. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/CMakeLists.txt +0 -0
  19. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/LICENSE +0 -0
  20. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/MANIFEST.in +0 -0
  21. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/README.rst +0 -0
  22. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack/__init__.py +0 -0
  23. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack.egg-info/dependency_links.txt +0 -0
  24. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack.egg-info/entry_points.txt +0 -0
  25. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack.egg-info/requires.txt +1 -1
  26. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/pennylane_qrack.egg-info/top_level.txt +0 -0
  27. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/requirements.txt +0 -0
  28. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/setup.cfg +0 -0
  29. {pennylane_qrack-0.9.8 → pennylane-qrack-0.10.1}/setup.py +0 -0
@@ -24,7 +24,7 @@ help:
24
24
  build-deps:
25
25
  ifneq ($(OS),Windows_NT)
26
26
  ifeq ($(QRACK_PRESENT),)
27
- git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 4e42ae5d0780ad70e86669f01bf0b134f2c8da06; cd ..
27
+ git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 7b661264a7494f4055504888126d66960e0c26e4; cd ..
28
28
  endif
29
29
  mkdir -p qrack/build
30
30
  ifeq ($(UNAME_S),Linux)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pennylane-qrack
3
- Version: 0.9.8
3
+ Version: 0.10.1
4
4
  Summary: PennyLane plugin for Qrack.
5
5
  Home-page: http://github.com/vm6502q
6
6
  Maintainer: vm6502q
@@ -26,9 +26,6 @@ Classifier: Topic :: Scientific/Engineering :: Physics
26
26
  Provides: pennylane_qrack
27
27
  Description-Content-Type: text/x-rst
28
28
  License-File: LICENSE
29
- Requires-Dist: pennylane>=0.32
30
- Requires-Dist: pyqrack>=1.30.0
31
- Requires-Dist: numpy>=1.16
32
29
 
33
30
  PennyLane-Qrack Plugin
34
31
  #######################
@@ -142,8 +142,8 @@ is_qbdd = "isBinaryDecisionTree"
142
142
  is_gpu = "isOpenCL"
143
143
  # Allocate GPU buffer from general host heap? (Default is "false"; "true" might improve performance or reliability in certain cases, like if using an Intel HD as accelerator)
144
144
  is_host_pointer = "isHostPointer"
145
- # Use noisy simulation? (Default is "false"; depolarizing noise intensity can be controlled by "QRACK_GATE_DEPOLARIZATION" environment variable)
146
- is_noisy = "isNoisy"
145
+ # Noise parameter. (Default is "0"; depolarizing noise intensity can also be controlled by "QRACK_GATE_DEPOLARIZATION" environment variable)
146
+ noise = "noise"
147
147
 
148
148
  # In the above example, a dictionary will be constructed at run time.
149
149
  # The dictionary will contain the string key "option_key" and its value
@@ -16,4 +16,4 @@
16
16
  Version number (major.minor.patch[-label])
17
17
  """
18
18
 
19
- __version__ = "0.9.8"
19
+ __version__ = "0.10.1"
@@ -406,9 +406,10 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
406
406
  keyMap["'is_qbdd'"] = 5;
407
407
  keyMap["'is_gpu'"] = 6;
408
408
  keyMap["'is_host_pointer'"] =7;
409
- keyMap["'is_noisy'"] = 8;
409
+ keyMap["'noise'"] = 8;
410
410
 
411
411
  size_t pos;
412
+ Qrack::real1_f noiseParam = 0;
412
413
  while ((pos = kwargs.find(":")) != std::string::npos) {
413
414
  std::string key = trim(kwargs.substr(0, pos));
414
415
  kwargs.erase(0, pos + 1U);
@@ -439,7 +440,8 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
439
440
  hp = val;
440
441
  break;
441
442
  case 8:
442
- nw = val;
443
+ noiseParam = std::stof(value);
444
+ nw = noiseParam > ZERO_R1;
443
445
  break;
444
446
  default:
445
447
  break;
@@ -447,6 +449,9 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
447
449
  }
448
450
 
449
451
  qsim = QSIM_CONFIG(0U);
452
+ if (noiseParam > ZERO_R1) {
453
+ qsim->SetNoiseParameter(noiseParam);
454
+ }
450
455
  }
451
456
 
452
457
  QrackDevice &operator=(const QuantumDevice &) = delete;
@@ -158,8 +158,8 @@ class QrackDevice(QubitDevice):
158
158
  isOpenCL = True
159
159
  # Allocate GPU buffer from general host heap? (Default is "false"; "true" might improve performance or reliability in certain cases, like if using an Intel HD as accelerator)
160
160
  isHostPointer = False
161
- # Use noisy simulation? (Default is "false"; depolarizing noise intensity can be controlled by "QRACK_GATE_DEPOLARIZATION" environment variable)
162
- isNoisy = False
161
+ # Noise parameter. (Default is "0"; depolarizing noise intensity can also be controlled by "QRACK_GATE_DEPOLARIZATION" environment variable)
162
+ noise = 0
163
163
 
164
164
  @staticmethod
165
165
  def get_c_interface():
@@ -187,8 +187,8 @@ class QrackDevice(QubitDevice):
187
187
  self.isOpenCL = options['isOpenCL']
188
188
  if 'isHostPointer' in options:
189
189
  self.isHostPointer = options['isHostPointer']
190
- if 'isNoisy' in options:
191
- self.isNoisy = options['isNoisy']
190
+ if 'noise' in options:
191
+ self.noise = options['noise']
192
192
  super().__init__(wires=wires, shots=shots)
193
193
  self._state = QrackSimulator(
194
194
  self.num_wires,
@@ -198,7 +198,7 @@ class QrackDevice(QubitDevice):
198
198
  isBinaryDecisionTree=self.isBinaryDecisionTree,
199
199
  isOpenCL=self.isOpenCL,
200
200
  isHostPointer=self.isHostPointer,
201
- isNoisy=self.isNoisy
201
+ noise = self.noise
202
202
  )
203
203
 
204
204
  def _reverse_state(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pennylane-qrack
3
- Version: 0.9.8
3
+ Version: 0.10.1
4
4
  Summary: PennyLane plugin for Qrack.
5
5
  Home-page: http://github.com/vm6502q
6
6
  Maintainer: vm6502q
@@ -26,9 +26,6 @@ Classifier: Topic :: Scientific/Engineering :: Physics
26
26
  Provides: pennylane_qrack
27
27
  Description-Content-Type: text/x-rst
28
28
  License-File: LICENSE
29
- Requires-Dist: pennylane>=0.32
30
- Requires-Dist: pyqrack>=1.30.0
31
- Requires-Dist: numpy>=1.16
32
29
 
33
30
  PennyLane-Qrack Plugin
34
31
  #######################
@@ -6,11 +6,6 @@ Makefile
6
6
  README.rst
7
7
  requirements.txt
8
8
  setup.py
9
- catalyst/runtime/include/DataView.hpp
10
- catalyst/runtime/include/Exception.hpp
11
- catalyst/runtime/include/QuantumDevice.hpp
12
- catalyst/runtime/include/RuntimeCAPI.h
13
- catalyst/runtime/include/Types.h
14
9
  pennylane_qrack/QrackDeviceConfig.toml
15
10
  pennylane_qrack/__init__.py
16
11
  pennylane_qrack/_version.py
@@ -21,7 +16,4 @@ pennylane_qrack.egg-info/SOURCES.txt
21
16
  pennylane_qrack.egg-info/dependency_links.txt
22
17
  pennylane_qrack.egg-info/entry_points.txt
23
18
  pennylane_qrack.egg-info/requires.txt
24
- pennylane_qrack.egg-info/top_level.txt
25
- tests/test_apply.py
26
- tests/test_integration.py
27
- tests/test_units.py
19
+ pennylane_qrack.egg-info/top_level.txt
@@ -1,147 +0,0 @@
1
- // Copyright 2023 Xanadu Quantum Technologies Inc.
2
-
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
-
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- #pragma once
16
-
17
- #include <Exception.hpp>
18
-
19
- /**
20
- * A multi-dimensional view for MemRef-like and std::vector<T> types.
21
- *
22
- * @tparam T The underlying data type
23
- * @tparam R The Rank (R > 0)
24
- *
25
- * @note A forward iterator is implemented in this view for traversing over the entire
26
- * elements of MemRef types rank-by-rank starting from the last dimension (R-1). For example,
27
- * The DataView iterator for MemRef<T, 2> starts from index (0, 0) and traverses elements
28
- * in the following order:
29
- * (0, 0), ..., (0, sizes[1]-1), (1, 0), ..., (1, sizes[1]-1), ... (sizes[0]-1, sizes[1]-1).
30
- */
31
- template <typename T, size_t R> class DataView {
32
- private:
33
- T *data_aligned;
34
- size_t offset;
35
- size_t sizes[R] = {0};
36
- size_t strides[R] = {0};
37
-
38
- public:
39
- class iterator {
40
- private:
41
- const DataView<T, R> &view;
42
-
43
- int64_t loc; // physical index
44
- size_t indices[R] = {0};
45
-
46
- public:
47
- using iterator_category = std::forward_iterator_tag; // LCOV_EXCL_LINE
48
- using value_type = T; // LCOV_EXCL_LINE
49
- using difference_type = std::ptrdiff_t; // LCOV_EXCL_LINE
50
- using pointer = T *; // LCOV_EXCL_LINE
51
- using reference = T &; // LCOV_EXCL_LINE
52
-
53
- iterator(const DataView<T, R> &_view, int64_t begin_idx) : view(_view), loc(begin_idx) {}
54
- pointer operator->() const { return &view.data_aligned[loc]; }
55
- reference operator*() const { return view.data_aligned[loc]; }
56
- iterator &operator++()
57
- {
58
- int64_t next_axis = -1;
59
- int64_t idx;
60
- for (int64_t i = R; i > 0; --i) {
61
- idx = i - 1;
62
- if (indices[idx]++ < view.sizes[idx] - 1) {
63
- next_axis = idx;
64
- break;
65
- }
66
- indices[idx] = 0;
67
- loc -= (view.sizes[idx] - 1) * view.strides[idx];
68
- }
69
-
70
- loc = next_axis == -1 ? -1 : loc + view.strides[next_axis];
71
- return *this;
72
- }
73
- iterator operator++(int)
74
- {
75
- auto tmp = *this;
76
- int64_t next_axis = -1;
77
- int64_t idx;
78
- for (int64_t i = R; i > 0; --i) {
79
- idx = i - 1;
80
- if (indices[idx]++ < view.sizes[idx] - 1) {
81
- next_axis = idx;
82
- break;
83
- }
84
- indices[idx] = 0;
85
- loc -= (view.sizes[idx] - 1) * view.strides[idx];
86
- }
87
-
88
- loc = next_axis == -1 ? -1 : loc + view.strides[next_axis];
89
- return tmp;
90
- }
91
- bool operator==(const iterator &other) const
92
- {
93
- return (loc == other.loc && view.data_aligned == other.view.data_aligned);
94
- }
95
- bool operator!=(const iterator &other) const { return !(*this == other); }
96
- };
97
-
98
- explicit DataView(std::vector<T> &buffer) : data_aligned(buffer.data()), offset(0)
99
- {
100
- static_assert(R == 1, "[Class: DataView] Assertion: R == 1");
101
- sizes[0] = buffer.size();
102
- strides[0] = 1;
103
- }
104
-
105
- explicit DataView(T *_data_aligned, size_t _offset, size_t *_sizes, size_t *_strides)
106
- : data_aligned(_data_aligned), offset(_offset)
107
- {
108
- static_assert(R > 0, "[Class: DataView] Assertion: R > 0");
109
- if (_sizes && _strides) {
110
- for (size_t i = 0; i < R; i++) {
111
- sizes[i] = _sizes[i];
112
- strides[i] = _strides[i];
113
- }
114
- } // else sizes = {0}, strides = {0}
115
- }
116
-
117
- [[nodiscard]] auto size() const -> size_t
118
- {
119
- if (!data_aligned) {
120
- return 0;
121
- }
122
-
123
- size_t tsize = 1;
124
- for (size_t i = 0; i < R; i++) {
125
- tsize *= sizes[i];
126
- }
127
- return tsize;
128
- }
129
-
130
- template <typename... I> T &operator()(I... idxs) const
131
- {
132
- static_assert(sizeof...(idxs) == R,
133
- "[Class: DataView] Error in Catalyst Runtime: Wrong number of indices");
134
- size_t indices[] = {static_cast<size_t>(idxs)...};
135
-
136
- size_t loc = offset;
137
- for (size_t axis = 0; axis < R; axis++) {
138
- RT_ASSERT(indices[axis] < sizes[axis]);
139
- loc += indices[axis] * strides[axis];
140
- }
141
- return data_aligned[loc];
142
- }
143
-
144
- iterator begin() { return iterator{*this, static_cast<int64_t>(offset)}; }
145
-
146
- iterator end() { return iterator{*this, -1}; }
147
- };
@@ -1,87 +0,0 @@
1
- // Copyright 2023 Xanadu Quantum Technologies Inc.
2
-
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
-
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- #pragma once
16
-
17
- #include <exception>
18
- #include <iostream>
19
-
20
- #include <sstream>
21
- #include <string>
22
- #include <type_traits>
23
- #include <utility>
24
-
25
- /**
26
- * @brief Macro that throws `RuntimeException` with given message.
27
- */
28
- #define RT_FAIL(message) Catalyst::Runtime::_abort((message), __FILE__, __LINE__, __func__)
29
-
30
- /**
31
- * @brief Macro that throws `RuntimeException` if expression evaluates
32
- * to true.
33
- */
34
- #define RT_FAIL_IF(expression, message) \
35
- if ((expression)) { \
36
- RT_FAIL(message); \
37
- }
38
-
39
- /**
40
- * @brief Macro that throws `RuntimeException` with the given expression
41
- * and source location if expression evaluates to false.
42
- */
43
- #define RT_ASSERT(expression) RT_FAIL_IF(!(expression), "Assertion: " #expression)
44
-
45
- namespace Catalyst::Runtime {
46
-
47
- /**
48
- * @brief This is the general exception thrown by Catalyst for runtime errors
49
- * that is derived from `std::exception`.
50
- */
51
- class RuntimeException : public std::exception {
52
- private:
53
- const std::string err_msg;
54
-
55
- public:
56
- explicit RuntimeException(std::string msg) noexcept
57
- : err_msg{std::move(msg)} {} // LCOV_EXCL_LINE
58
- ~RuntimeException() override = default; // LCOV_EXCL_LINE
59
-
60
- RuntimeException(const RuntimeException &) = default;
61
- RuntimeException(RuntimeException &&) noexcept = default;
62
-
63
- RuntimeException &operator=(const RuntimeException &) = delete;
64
- RuntimeException &operator=(RuntimeException &&) = delete;
65
-
66
- [[nodiscard]] auto what() const noexcept -> const char * override
67
- {
68
- return err_msg.c_str();
69
- } // LCOV_EXCL_LINE
70
- };
71
-
72
- /**
73
- * @brief Throws a `RuntimeException` with the given error message.
74
- *
75
- * @note This is not supposed to be called directly.
76
- */
77
- [[noreturn]] inline void _abort(const char *message, const char *file_name, size_t line,
78
- const char *function_name)
79
- {
80
- std::stringstream sstream;
81
- sstream << "[" << file_name << "][Line:" << line << "][Function:" << function_name
82
- << "] Error in Catalyst Runtime: " << message;
83
-
84
- throw RuntimeException(sstream.str());
85
- } // LCOV_EXCL_LINE
86
-
87
- } // namespace Catalyst::Runtime