Skip to content

Commit 57d21b9

Browse files
woodsp-ibmElePT
andauthored
Remove numpy 1.25 constraint (#83)
Co-authored-by: Elena Peña Tapia <[email protected]>
1 parent 6ca1e09 commit 57d21b9

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

constraints.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
# Numpy 1.25 deprecated some behaviours that we used, and caused the isometry
2-
# tests to flake. See https://github.com/Qiskit/qiskit-terra/issues/10305,
3-
# remove pin when resolving that.
4-
numpy<1.25
1+
# Constraints may be listed here
52

qiskit_algorithms/optimizers/snobfit.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ def __init__(
5757
See https://github.com/scikit-quant/scikit-quant/issues/24 for more details.
5858
"""
5959
# check version
60-
version = tuple(map(int, np.__version__.split(".")))
61-
if version >= (1, 24, 0):
60+
if tuple(map(int, np.__version__.split(".")[:2])) >= (1, 24):
6261
raise AlgorithmError(
6362
"SnobFit is incompatible with NumPy 1.24.0 or above, please "
6463
"install a previous version. See also scikit-quant/scikit-quant#24."

qiskit_algorithms/optimizers/spsa.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ def minimize(
629629
logger.info("SPSA: Finished in %s", time() - start)
630630

631631
if self.last_avg > 1:
632-
x = np.mean(last_steps, axis=0) # type: ignore[call-overload]
632+
x = np.mean(np.asarray(last_steps), axis=0)
633633

634634
result = OptimizerResult()
635635
result.x = x

0 commit comments

Comments
 (0)