19
19
import numpy as np
20
20
21
21
from qiskit .exceptions import QiskitError
22
+ from qiskit .utils .deprecation import deprecate_func
22
23
from ..utils import marginal_counts
23
24
from ..counts import Counts
24
25
25
26
logger = logging .getLogger (__name__ )
26
27
27
28
29
+ @deprecate_func (
30
+ since = "1.3" ,
31
+ package_name = "Qiskit" ,
32
+ removal_timeline = "in Qiskit 2.0" ,
33
+ additional_msg = "The `qiskit.result.mitigation` module is deprecated in favor of "
34
+ "the https://github.com/Qiskit/qiskit-addon-mthree package." ,
35
+ )
28
36
def z_diagonal (dim , dtype = float ):
29
37
r"""Return the diagonal for the operator :math:`Z^\otimes n`"""
30
38
parity = np .zeros (dim , dtype = dtype )
@@ -33,6 +41,13 @@ def z_diagonal(dim, dtype=float):
33
41
return (- 1 ) ** np .mod (parity , 2 )
34
42
35
43
44
+ @deprecate_func (
45
+ since = "1.3" ,
46
+ package_name = "Qiskit" ,
47
+ removal_timeline = "in Qiskit 2.0" ,
48
+ additional_msg = "The `qiskit.result.mitigation` module is deprecated in favor of "
49
+ "the https://github.com/Qiskit/qiskit-addon-mthree package." ,
50
+ )
36
51
def expval_with_stddev (coeffs : np .ndarray , probs : np .ndarray , shots : int ) -> Tuple [float , float ]:
37
52
"""Compute expectation value and standard deviation.
38
53
Args:
@@ -60,6 +75,13 @@ def expval_with_stddev(coeffs: np.ndarray, probs: np.ndarray, shots: int) -> Tup
60
75
return [expval , calc_stddev ]
61
76
62
77
78
+ @deprecate_func (
79
+ since = "1.3" ,
80
+ package_name = "Qiskit" ,
81
+ removal_timeline = "in Qiskit 2.0" ,
82
+ additional_msg = "The `qiskit.result.mitigation` module is deprecated in favor of "
83
+ "the https://github.com/Qiskit/qiskit-addon-mthree package." ,
84
+ )
63
85
def stddev (probs , shots ):
64
86
"""Calculate stddev dict"""
65
87
ret = {}
@@ -69,6 +91,13 @@ def stddev(probs, shots):
69
91
return ret
70
92
71
93
94
+ @deprecate_func (
95
+ since = "1.3" ,
96
+ package_name = "Qiskit" ,
97
+ removal_timeline = "in Qiskit 2.0" ,
98
+ additional_msg = "The `qiskit.result.mitigation` module is deprecated in favor of "
99
+ "the https://github.com/Qiskit/qiskit-addon-mthree package." ,
100
+ )
72
101
def str2diag (string ):
73
102
"""Transform diagonal from a string to a numpy array"""
74
103
chars = {
@@ -85,6 +114,13 @@ def str2diag(string):
85
114
return ret
86
115
87
116
117
+ @deprecate_func (
118
+ since = "1.3" ,
119
+ package_name = "Qiskit" ,
120
+ removal_timeline = "in Qiskit 2.0" ,
121
+ additional_msg = "The `qiskit.result.mitigation` module is deprecated in favor of "
122
+ "the https://github.com/Qiskit/qiskit-addon-mthree package." ,
123
+ )
88
124
def counts_to_vector (counts : Counts , num_qubits : int ) -> Tuple [np .ndarray , int ]:
89
125
"""Transforms Counts to a probability vector"""
90
126
vec = np .zeros (2 ** num_qubits , dtype = float )
@@ -96,6 +132,13 @@ def counts_to_vector(counts: Counts, num_qubits: int) -> Tuple[np.ndarray, int]:
96
132
return vec , shots
97
133
98
134
135
+ @deprecate_func (
136
+ since = "1.3" ,
137
+ package_name = "Qiskit" ,
138
+ removal_timeline = "in Qiskit 2.0" ,
139
+ additional_msg = "The `qiskit.result.mitigation` module is deprecated in favor of "
140
+ "the https://github.com/Qiskit/qiskit-addon-mthree package." ,
141
+ )
99
142
def remap_qubits (
100
143
vec : np .ndarray , num_qubits : int , qubits : Optional [List [int ]] = None
101
144
) -> np .ndarray :
@@ -108,6 +151,13 @@ def remap_qubits(
108
151
return vec
109
152
110
153
154
+ @deprecate_func (
155
+ since = "1.3" ,
156
+ package_name = "Qiskit" ,
157
+ removal_timeline = "in Qiskit 2.0" ,
158
+ additional_msg = "The `qiskit.result.mitigation` module is deprecated in favor of "
159
+ "the https://github.com/Qiskit/qiskit-addon-mthree package." ,
160
+ )
111
161
def marganalize_counts (
112
162
counts : Counts ,
113
163
qubit_index : Dict [int , int ],
@@ -129,6 +179,13 @@ def marganalize_counts(
129
179
return counts
130
180
131
181
182
+ @deprecate_func (
183
+ since = "1.3" ,
184
+ package_name = "Qiskit" ,
185
+ removal_timeline = "in Qiskit 2.0" ,
186
+ additional_msg = "The `qiskit.result.mitigation` module is deprecated in favor of "
187
+ "the https://github.com/Qiskit/qiskit-addon-mthree package." ,
188
+ )
132
189
def counts_probability_vector (
133
190
counts : Counts ,
134
191
qubit_index : Dict [int , int ],
0 commit comments