emu-base 1.2.5__py3-none-any.whl → 1.2.6__py3-none-any.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.
emu_base/__init__.py CHANGED
@@ -15,6 +15,7 @@ from .base_classes.default_callbacks import (
15
15
  StateResult,
16
16
  SecondMomentOfEnergy,
17
17
  )
18
+ from .constants import DEVICE_COUNT
18
19
  from .pulser_adapter import PulserData, HamiltonianType
19
20
  from .math.brents_root_finding import find_root_brents
20
21
  from .math.krylov_exp import krylov_exp, DEFAULT_MAX_KRYLOV_DIM
@@ -42,6 +43,7 @@ __all__ = [
42
43
  "krylov_exp",
43
44
  "HamiltonianType",
44
45
  "DEFAULT_MAX_KRYLOV_DIM",
46
+ "DEVICE_COUNT",
45
47
  ]
46
48
 
47
- __version__ = "1.2.5"
49
+ __version__ = "1.2.6"
emu_base/constants.py ADDED
@@ -0,0 +1,4 @@
1
+ import torch
2
+
3
+
4
+ DEVICE_COUNT = torch.cuda.device_count()
@@ -159,23 +159,44 @@ def _extract_omega_delta_phi(
159
159
 
160
160
  step = 0
161
161
  t = (step + 1 / 2) * dt
162
+ omega_1 = torch.zeros_like(omega[0])
163
+ omega_2 = torch.zeros_like(omega[0])
162
164
 
163
165
  while t < max_duration:
164
- for q_pos, q_id in enumerate(sequence.register.qubit_ids):
165
- omega[step, q_pos] = (
166
- locals_a_d_p[q_id]["amp"][math.floor(t)]
167
- + locals_a_d_p[q_id]["amp"][math.ceil(t)]
168
- ) / 2.0
169
- delta[step, q_pos] = (
170
- locals_a_d_p[q_id]["det"][math.floor(t)]
171
- + locals_a_d_p[q_id]["det"][math.ceil(t)]
172
- ) / 2.0
173
- phi[step, q_pos] = (
174
- locals_a_d_p[q_id]["phase"][math.floor(t)]
175
- + locals_a_d_p[q_id]["phase"][math.ceil(t)]
176
- ) / 2.0
177
- if t in global_times:
178
- omega[step] *= waist_factors
166
+ # The sampled values correspond to the start of each interval
167
+ # To maximize the order of the solver, we need the values in the middle
168
+ if math.ceil(t) < max_duration:
169
+ # If we're not the final step, approximate this using linear interpolation
170
+ # Note that for dt even, t1=t2
171
+ for q_pos, q_id in enumerate(sequence.register.qubit_ids):
172
+ t1 = math.floor(t)
173
+ t2 = math.ceil(t)
174
+ omega_1[q_pos] = locals_a_d_p[q_id]["amp"][t1]
175
+ omega_2[q_pos] = locals_a_d_p[q_id]["amp"][t2]
176
+ delta[step, q_pos] = (
177
+ locals_a_d_p[q_id]["det"][t1] + locals_a_d_p[q_id]["det"][t2]
178
+ ) / 2.0
179
+ phi[step, q_pos] = (
180
+ locals_a_d_p[q_id]["phase"][t1] + locals_a_d_p[q_id]["phase"][t2]
181
+ ) / 2.0
182
+ # omegas at different times need to have the laser waist applied independently
183
+ if t1 in global_times:
184
+ omega_1 *= waist_factors
185
+ if t2 in global_times:
186
+ omega_2 *= waist_factors
187
+ omega[step] = 0.5 * (omega_1 + omega_2)
188
+ else:
189
+ # We're in the final step and dt=1, approximate this using linear extrapolation
190
+ # we can reuse omega_1 and omega_2 from before
191
+ for q_pos, q_id in enumerate(sequence.register.qubit_ids):
192
+ delta[step, q_pos] = (
193
+ 3.0 * locals_a_d_p[q_id]["det"][t2] - locals_a_d_p[q_id]["det"][t1]
194
+ ) / 2.0
195
+ phi[step, q_pos] = (
196
+ 3.0 * locals_a_d_p[q_id]["phase"][t2]
197
+ - locals_a_d_p[q_id]["phase"][t1]
198
+ ) / 2.0
199
+ omega[step] = torch.clamp(0.5 * (3 * omega_2 - omega_1).real, min=0.0)
179
200
  step += 1
180
201
  t = (step + 1 / 2) * dt
181
202
 
@@ -250,11 +271,12 @@ class PulserData:
250
271
  ] = 0.0
251
272
  self.masked_interaction_matrix = self.full_interaction_matrix.clone()
252
273
 
253
- slm_targets = sequence._slm_mask_targets
254
274
  self.slm_end_time = (
255
275
  sequence._slm_mask_time[1] if len(sequence._slm_mask_time) > 1 else 0.0
256
276
  )
257
277
 
258
- for target in slm_targets:
278
+ # disable interaction for SLM masked qubits
279
+ slm_targets = list(sequence._slm_mask_targets)
280
+ for target in sequence.register.find_indices(slm_targets):
259
281
  self.masked_interaction_matrix[target] = 0.0
260
282
  self.masked_interaction_matrix[:, target] = 0.0
@@ -1,7 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: emu-base
3
- Version: 1.2.5
3
+ Version: 1.2.6
4
4
  Summary: Pasqal base classes for emulators
5
+ Project-URL: Documentation, https://pasqal-io.github.io/emulators/
6
+ Project-URL: Repository, https://github.com/pasqal-io/emulators
7
+ Project-URL: Issues, https://github.com/pasqal-io/emulators/issues
5
8
  Author-email: Anton Quelle <anton.quelle@pasqal.com>, Mauro Mendizabal <mauro.mendizabal-pico@pasqal.com>, Stefano Grava <stefano.grava@pasqal.com>, Pablo Le Henaff <pablo.le-henaff@pasqal.com>
6
9
  License: PASQAL OPEN-SOURCE SOFTWARE LICENSE AGREEMENT (MIT-derived)
7
10
 
@@ -28,75 +31,8 @@ Description-Content-Type: text/markdown
28
31
 
29
32
  <div align="center">
30
33
  <img src="docs/logos/LogoTaglineSoftGreen.svg">
31
-
32
- # Emu-MPS
33
34
  </div>
34
35
 
35
- **Emu-mps** is a backend for the [Pulser low-level Quantum Programming toolkit](https://pulser.readthedocs.io) that lets you run Quantum Algorithms on a simulated device, using GPU acceleration if available. More in depth, emu-mps is designed to **emu**late the dynamics of programmable arrays of neutral atoms, with matrix product states (**mps**). While benchmarking is incomplete as of this writing, early results suggest that this design makes emu-mps faster and more memory-efficient than previous generations of quantum emulators at running simulations with large numbers of qubits.
36
-
37
- As of this writing, Emu-MPS is provided for Linux and macOS but will not work under Windows.
38
-
39
- ## Installation
40
-
41
- **Warning:** installing emu-mps will update pulser-core
42
-
43
- ### Using `hatch`, `uv` or any pyproject-compatible Python manager
44
-
45
- To add `emu-mps` to your project, edit your `pyproject.toml` to add the line
46
-
47
- ```toml
48
- "emu-mps"
49
- ```
50
-
51
- to the list of `dependencies`.
52
-
53
-
54
- ### Using `pip` or `pipx`
55
- To install the `pipy` package using `pip` or `pipx`
56
-
57
- 1. Create a `venv` if that's not done yet
58
-
59
- ```sh
60
- $ python -m venv venv
61
-
62
- ```
63
-
64
- 2. Enter the venv
65
-
66
- If you're running Unix:
67
-
68
- ```sh
69
- $ . venv/bin/activate
70
- ```
71
-
72
- If you're running Windows:
73
-
74
- ```sh
75
- C:\> /path/to/new/virtual/environment/Scripts/activate
76
- ```
77
-
78
- 3. Install the package
79
-
80
- ```sh
81
- $ pip install emu-mps
82
- # or
83
- $ pipx install emu-mps
84
- ```
85
-
86
-
87
- Join us on [Slack](https://pasqalworkspace.slack.com/archives/C07MUV5K7EU) or by [e-mail](mailto:emulation@pasqal.com) to give us feedback about how you plan to use Emu-MPS or if you require specific feature-upgrades.
88
-
89
- ## Usage
90
-
91
- For the time being, the easiest way to learn how to use this package is to look
92
- at the [examples](examples/emu_mps_examples) and [notebooks](https://pasqal-io.github.io/emulators/latest/).
93
-
94
- See also the [full documentation](https://github.com/pasqal-io/emulators/blob/main/docs/index.md) for
95
- the API, information about contributing, benchmarks, etc.
96
-
97
-
98
- ## Getting in touch
36
+ # Welcome to the Pasqal analog emulators
99
37
 
100
- - [Pasqal Community Portal](https://community.pasqal.com/) (forums, chat, tutorials, examples, code library).
101
- - [GitHub Repository](https://github.com/pasqal-io/quantum-evolution-kernel) (source code, issue tracker).
102
- - [Professional Support](https://www.pasqal.com/contact-us/) (if you need tech support, custom licenses, a variant of this library optimized for your workload, your own QPU, remote access to a QPU, ...)
38
+ Welcome, and please see the [GitHub pages](https://pasqal-io.github.io/emulators/) for a landing page to this repo.
@@ -1,6 +1,7 @@
1
- emu_base/__init__.py,sha256=5X57qf5fo0zv8vmeaDbrW9ThsAEIjy5HPsCpQEIL8iI,1130
1
+ emu_base/__init__.py,sha256=YDB_UjuJJoFfzL3gG_z09ieMTU7RvE5UAGn7POqiYbE,1186
2
+ emu_base/constants.py,sha256=41LYkKLUCz-oxPbd-j7nUDZuhIbUrnez6prT0uR0jcE,56
2
3
  emu_base/lindblad_operators.py,sha256=eXkXsLt_fV7jhF31EkxzYFU04rOJV3uWXsl6t1aTAqs,1562
3
- emu_base/pulser_adapter.py,sha256=vnIiOpjJBXEwMmuWqOdRIlHmkkYnvvPmsSfRNPzBi2k,9118
4
+ emu_base/pulser_adapter.py,sha256=Doi24xNQp09UhyrvNkS_ydXiRV4XNinoziALo6Gil2U,10456
4
5
  emu_base/utils.py,sha256=RM8O0qfPAJfcdqqAojwEEKV7I3ZfVDklnTisTGhUg5k,233
5
6
  emu_base/base_classes/__init__.py,sha256=Su6fHtjCyg0fw-7y7e7nbMfDASppNRQs8iGaAOkO3c4,570
6
7
  emu_base/base_classes/aggregators.py,sha256=bcvoGfZCkPKv-CI29gTma6HBphGh7bjBq2Ome77eRJM,1840
@@ -14,6 +15,6 @@ emu_base/base_classes/state.py,sha256=7iIyZmBqqJ6G4SyYZ3kyylWjAqiYIx0aW5B0T74EPZ
14
15
  emu_base/math/__init__.py,sha256=6BbIytYV5uC-e5jLMtIErkcUl_PvfSNnhmVFY9Il8uQ,97
15
16
  emu_base/math/brents_root_finding.py,sha256=AVx6L1Il6rpPJWrLJ7cn6oNmJyZOPRgEaaZaubC9lsU,3711
16
17
  emu_base/math/krylov_exp.py,sha256=UCFNeq-j2ukgBsOPC9_Jiv1aqpy88SrslDLiCxIGBwk,3840
17
- emu_base-1.2.5.dist-info/METADATA,sha256=wD4pmz4VvisVEZmM3Z44CC_fiwB6SMw-O9fFKPHvb7w,5576
18
- emu_base-1.2.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
- emu_base-1.2.5.dist-info/RECORD,,
18
+ emu_base-1.2.6.dist-info/METADATA,sha256=AKKbxP9g8y0vjIYHix98y-DxKOlAufhKRW8YQy74h_Q,3522
19
+ emu_base-1.2.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
+ emu_base-1.2.6.dist-info/RECORD,,