Skip to content

Partly fix #1008 and #1024: adjust files to support NumPy 2#1057

Merged
mhucka merged 8 commits intomasterfrom
mh-np2-compat
Jun 4, 2025
Merged

Partly fix #1008 and #1024: adjust files to support NumPy 2#1057
mhucka merged 8 commits intomasterfrom
mh-np2-compat

Conversation

@mhucka
Copy link
Copy Markdown
Contributor

@mhucka mhucka commented Jun 2, 2025

Update some files to use constructs compatible with NumPy 2.

A separate PR (#1055) updates the requirements files & dependencies for NumPy 2.

Update some files to use constructs compatible with NumPy 2.
Comment thread src/openfermion/chem/molecular_data.py Outdated
Comment thread src/openfermion/chem/molecular_data.py Outdated
Comment thread src/openfermion/ops/operators/binary_code.py Outdated
@mhucka mhucka requested a review from dstrain115 June 2, 2025 23:16
@JerryChen97
Copy link
Copy Markdown

Finally we are going to have OpenFermion compatible with NumPy >= 2.0 🥳

@mhucka mhucka changed the title Adjust files for NumPy 2 Fix #1008: adjust files to support NumPy 2 Jun 3, 2025
@mhucka mhucka changed the title Fix #1008: adjust files to support NumPy 2 Partly fix #1008: adjust files to support NumPy 2 Jun 3, 2025
mhucka added 5 commits June 3, 2025 13:32
SciPy 1.15 warns that the `kron` method is going away and that people
should use the NumPy version of `kron`.
In function `get_tensors_from_integrals`, the call to `numpy.zeros`
didn't supply data type information. This resulted in the type
defaulting to a float type, which then led to warnings about losing
precision in the multiplications later in the method. The solution is to
match the types of the values in the call to `zeros` to the types of
other arrays.
@mhucka mhucka changed the title Partly fix #1008: adjust files to support NumPy 2 Partly fix #1008 and #1024: adjust files to support NumPy 2 Jun 3, 2025
@mhucka mhucka added this pull request to the merge queue Jun 4, 2025
Merged via the queue into master with commit 614bbdc Jun 4, 2025
29 checks passed
@mhucka mhucka deleted the mh-np2-compat branch June 4, 2025 17:39
mhucka added a commit to mhucka/OpenFermion that referenced this pull request Sep 25, 2025
…rt NumPy 2 (quantumlib#1057)

Update some files to use constructs compatible with NumPy 2.

A separate PR (quantumlib#1055) updates the requirements files & dependencies for
NumPy 2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants