Commit 7601ed2
Improve reliability and tests for map_particle_hole_dm_to_one_pdm (#1241)
This change addresses a potential ZeroDivisionError in
`map_particle_hole_dm_to_one_pdm` by raising a `ValueError` when the
denominator is zero. It also adds a unit test to verify this behavior
and ensure edge cases are handled correctly.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>1 parent 6338095 commit 7601ed2
File tree
2 files changed
+10
-0
lines changed- src/openfermion/utils
2 files changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| 205 | + | |
| 206 | + | |
205 | 207 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
174 | 182 | | |
175 | 183 | | |
176 | 184 | | |
| |||
0 commit comments