Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove numpy 1.25 constraint #83

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Numpy 1.25 deprecated some behaviours that we used, and caused the isometry
# tests to flake. See https://github.com/Qiskit/qiskit-terra/issues/10305,
# remove pin when resolving that.
numpy<1.25
# Constraints may be listed here

3 changes: 1 addition & 2 deletions qiskit_algorithms/optimizers/snobfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def __init__(
See https://github.com/scikit-quant/scikit-quant/issues/24 for more details.
"""
# check version
version = tuple(map(int, np.__version__.split(".")))
if version >= (1, 24, 0):
if tuple(map(int, np.__version__.split(".")[:2])) >= (1, 24):
raise AlgorithmError(
"SnobFit is incompatible with NumPy 1.24.0 or above, please "
"install a previous version. See also scikit-quant/scikit-quant#24."
Expand Down
2 changes: 1 addition & 1 deletion qiskit_algorithms/optimizers/spsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def minimize(
logger.info("SPSA: Finished in %s", time() - start)

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

result = OptimizerResult()
result.x = x
Expand Down