emu-base 1.2.6__py3-none-any.whl → 2.0.0__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 +3 -33
- emu_base/aggregators.py +158 -0
- emu_base/lindblad_operators.py +4 -1
- emu_base/pulser_adapter.py +36 -23
- {emu_base-1.2.6.dist-info → emu_base-2.0.0.dist-info}/METADATA +2 -2
- emu_base-2.0.0.dist-info/RECORD +12 -0
- emu_base/base_classes/__init__.py +0 -31
- emu_base/base_classes/aggregators.py +0 -59
- emu_base/base_classes/backend.py +0 -48
- emu_base/base_classes/callback.py +0 -90
- emu_base/base_classes/config.py +0 -106
- emu_base/base_classes/default_callbacks.py +0 -300
- emu_base/base_classes/operator.py +0 -126
- emu_base/base_classes/results.py +0 -174
- emu_base/base_classes/state.py +0 -97
- emu_base-1.2.6.dist-info/RECORD +0 -20
- {emu_base-1.2.6.dist-info → emu_base-2.0.0.dist-info}/WHEEL +0 -0
emu_base/base_classes/state.py
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
from typing import Any, Iterable
|
|
3
|
-
from abc import ABC, abstractmethod
|
|
4
|
-
from collections import Counter
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class State(ABC):
|
|
8
|
-
"""
|
|
9
|
-
Base class enforcing an API for quantum states.
|
|
10
|
-
Each backend will implement its own type of state, and the
|
|
11
|
-
below methods.
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
@abstractmethod
|
|
15
|
-
def inner(self, other: State) -> float | complex:
|
|
16
|
-
"""
|
|
17
|
-
Compute the inner product between this state and other.
|
|
18
|
-
Note that self is the left state in the inner product,
|
|
19
|
-
so this function is linear in other, and anti-linear in self
|
|
20
|
-
|
|
21
|
-
Args:
|
|
22
|
-
other: the other state
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
inner product
|
|
26
|
-
"""
|
|
27
|
-
pass
|
|
28
|
-
|
|
29
|
-
@abstractmethod
|
|
30
|
-
def sample(
|
|
31
|
-
self, num_shots: int, p_false_pos: float = 0.0, p_false_neg: float = 0.0
|
|
32
|
-
) -> Counter[str]:
|
|
33
|
-
"""
|
|
34
|
-
Sample bitstrings from the state, taking into account error rates.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
num_shots: how many bitstrings to sample
|
|
38
|
-
p_false_pos: the rate at which a 0 is read as a 1
|
|
39
|
-
p_false_neg: the rate at which a 1 is read as a 0
|
|
40
|
-
|
|
41
|
-
Returns:
|
|
42
|
-
the measured bitstrings, by count
|
|
43
|
-
"""
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
@abstractmethod
|
|
47
|
-
def __add__(self, other: State) -> State:
|
|
48
|
-
"""
|
|
49
|
-
Computes the sum of two states.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
other: the other state
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
the summed state
|
|
56
|
-
"""
|
|
57
|
-
pass
|
|
58
|
-
|
|
59
|
-
@abstractmethod
|
|
60
|
-
def __rmul__(self, scalar: complex) -> State:
|
|
61
|
-
"""
|
|
62
|
-
Scale the state by a scale factor.
|
|
63
|
-
|
|
64
|
-
Args:
|
|
65
|
-
scalar: the scale factor
|
|
66
|
-
|
|
67
|
-
Returns:
|
|
68
|
-
the scaled state
|
|
69
|
-
"""
|
|
70
|
-
pass
|
|
71
|
-
|
|
72
|
-
@staticmethod
|
|
73
|
-
@abstractmethod
|
|
74
|
-
def from_state_string(
|
|
75
|
-
*, basis: Iterable[str], nqubits: int, strings: dict[str, complex], **kwargs: Any
|
|
76
|
-
) -> State:
|
|
77
|
-
"""
|
|
78
|
-
Construct a state from the pulser abstract representation
|
|
79
|
-
<https://www.notion.so/pasqal/Abstract-State-and-Operator-Definition>
|
|
80
|
-
For a list of existing bases, see
|
|
81
|
-
<https://pulser.readthedocs.io/en/stable/conventions.html>
|
|
82
|
-
|
|
83
|
-
Args:
|
|
84
|
-
basis: A tuple containing the basis states.
|
|
85
|
-
nqubits: the number of qubits.
|
|
86
|
-
strings: A dictionary mapping state strings to complex or floats amplitudes
|
|
87
|
-
|
|
88
|
-
Returns:
|
|
89
|
-
the state in whatever format the backend provides.
|
|
90
|
-
|
|
91
|
-
Examples:
|
|
92
|
-
>>> afm_string_state = {"rrr": 1.0 / math.sqrt(2), "ggg": 1.0 / math.sqrt(2)}
|
|
93
|
-
>>> afm_state = State.from_state_string(
|
|
94
|
-
>>> basis=("r", "g"), nqubits=3, strings=afm_string_state
|
|
95
|
-
>>> )
|
|
96
|
-
"""
|
|
97
|
-
pass
|
emu_base-1.2.6.dist-info/RECORD
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
emu_base/__init__.py,sha256=YDB_UjuJJoFfzL3gG_z09ieMTU7RvE5UAGn7POqiYbE,1186
|
|
2
|
-
emu_base/constants.py,sha256=41LYkKLUCz-oxPbd-j7nUDZuhIbUrnez6prT0uR0jcE,56
|
|
3
|
-
emu_base/lindblad_operators.py,sha256=eXkXsLt_fV7jhF31EkxzYFU04rOJV3uWXsl6t1aTAqs,1562
|
|
4
|
-
emu_base/pulser_adapter.py,sha256=Doi24xNQp09UhyrvNkS_ydXiRV4XNinoziALo6Gil2U,10456
|
|
5
|
-
emu_base/utils.py,sha256=RM8O0qfPAJfcdqqAojwEEKV7I3ZfVDklnTisTGhUg5k,233
|
|
6
|
-
emu_base/base_classes/__init__.py,sha256=Su6fHtjCyg0fw-7y7e7nbMfDASppNRQs8iGaAOkO3c4,570
|
|
7
|
-
emu_base/base_classes/aggregators.py,sha256=bcvoGfZCkPKv-CI29gTma6HBphGh7bjBq2Ome77eRJM,1840
|
|
8
|
-
emu_base/base_classes/backend.py,sha256=7tnwb9MnRbwRN1_JTqliYftjqExuOE-Rrwz9AU2Pc4c,1645
|
|
9
|
-
emu_base/base_classes/callback.py,sha256=JXah_ZDNM8iyPWy7IOwW481qRFyqVvlSM-0OkjBzV0A,3055
|
|
10
|
-
emu_base/base_classes/config.py,sha256=Dg2CwC9sc5HYwszQAJSVjkSd3wuQrv6aEZGYBRnFl48,4098
|
|
11
|
-
emu_base/base_classes/default_callbacks.py,sha256=F44kkuwWdVcvMGZ9vJ2q7ug-_P8IQyJv-SVxSVWHW_w,9940
|
|
12
|
-
emu_base/base_classes/operator.py,sha256=MJjuDUTwJLbaSJzSNCKDWGvmGCGAEIEWISLoPSSzNsU,3501
|
|
13
|
-
emu_base/base_classes/results.py,sha256=7-Mz3jmFy19hd3PIA5idK610mC3b5jOf3EKBmV14Jv4,5569
|
|
14
|
-
emu_base/base_classes/state.py,sha256=7iIyZmBqqJ6G4SyYZ3kyylWjAqiYIx0aW5B0T74EPZI,2707
|
|
15
|
-
emu_base/math/__init__.py,sha256=6BbIytYV5uC-e5jLMtIErkcUl_PvfSNnhmVFY9Il8uQ,97
|
|
16
|
-
emu_base/math/brents_root_finding.py,sha256=AVx6L1Il6rpPJWrLJ7cn6oNmJyZOPRgEaaZaubC9lsU,3711
|
|
17
|
-
emu_base/math/krylov_exp.py,sha256=UCFNeq-j2ukgBsOPC9_Jiv1aqpy88SrslDLiCxIGBwk,3840
|
|
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,,
|
|
File without changes
|