ffsim 0.0.79__tar.gz → 0.0.80__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. {ffsim-0.0.79 → ffsim-0.0.80}/PKG-INFO +11 -7
  2. {ffsim-0.0.79 → ffsim-0.0.80}/README.md +10 -6
  3. {ffsim-0.0.79 → ffsim-0.0.80}/docs/_templates/autosummary/class.rst +18 -11
  4. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/qiskit-circuits-sim.ipynb +6 -6
  5. {ffsim-0.0.79 → ffsim-0.0.80}/pyproject.toml +1 -1
  6. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/fermion_operator.py +2 -2
  7. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/hamiltonians/diagonal_coulomb_hamiltonian.py +5 -8
  8. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/hamiltonians/double_factorized_hamiltonian.py +6 -8
  9. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/hamiltonians/molecular_hamiltonian.py +6 -9
  10. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/hamiltonians/single_factorized_hamiltonian.py +4 -5
  11. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/molecular_data.py +30 -39
  12. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/operators/common_operators.py +9 -9
  13. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/protocols/linear_operator_protocol.py +5 -5
  14. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/random/random.py +4 -4
  15. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/rdm.py +3 -6
  16. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/states.py +6 -9
  17. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/givens.py +5 -9
  18. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/hopgate.py +5 -8
  19. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/num_num.py +3 -6
  20. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/uccsd.py +22 -36
  21. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/ucj_spin_balanced.py +8 -12
  22. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/ucj_spin_unbalanced.py +12 -19
  23. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/ucj_spinless.py +5 -8
  24. {ffsim-0.0.79 → ffsim-0.0.80}/src/fermion_operator.rs +2 -2
  25. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/molecular_data_test.py +39 -2
  26. {ffsim-0.0.79 → ffsim-0.0.80}/uv.lock +1 -1
  27. {ffsim-0.0.79 → ffsim-0.0.80}/.cargo/config.toml +0 -0
  28. {ffsim-0.0.79 → ffsim-0.0.80}/.dockerignore +0 -0
  29. {ffsim-0.0.79 → ffsim-0.0.80}/.github/workflows/build-and-release.yml +0 -0
  30. {ffsim-0.0.79 → ffsim-0.0.80}/.github/workflows/check.yml +0 -0
  31. {ffsim-0.0.79 → ffsim-0.0.80}/.github/workflows/docker.yml +0 -0
  32. {ffsim-0.0.79 → ffsim-0.0.80}/.github/workflows/docs-dev.yml +0 -0
  33. {ffsim-0.0.79 → ffsim-0.0.80}/.github/workflows/docs-release.yml +0 -0
  34. {ffsim-0.0.79 → ffsim-0.0.80}/.github/workflows/test-latest-versions.yml +0 -0
  35. {ffsim-0.0.79 → ffsim-0.0.80}/.github/workflows/test-minimum-versions.yml +0 -0
  36. {ffsim-0.0.79 → ffsim-0.0.80}/.gitignore +0 -0
  37. {ffsim-0.0.79 → ffsim-0.0.80}/.pre-commit-config.yaml +0 -0
  38. {ffsim-0.0.79 → ffsim-0.0.80}/CONTRIBUTING.md +0 -0
  39. {ffsim-0.0.79 → ffsim-0.0.80}/Cargo.lock +0 -0
  40. {ffsim-0.0.79 → ffsim-0.0.80}/Cargo.toml +0 -0
  41. {ffsim-0.0.79 → ffsim-0.0.80}/Dockerfile +0 -0
  42. {ffsim-0.0.79 → ffsim-0.0.80}/LICENSE +0 -0
  43. {ffsim-0.0.79 → ffsim-0.0.80}/compose.yaml +0 -0
  44. {ffsim-0.0.79 → ffsim-0.0.80}/docs/_static/logo-dark.svg +0 -0
  45. {ffsim-0.0.79 → ffsim-0.0.80}/docs/_static/logo.svg +0 -0
  46. {ffsim-0.0.79 → ffsim-0.0.80}/docs/conf.py +0 -0
  47. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/diag-coulomb-hamiltonian.ipynb +0 -0
  48. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/double-factorized.ipynb +0 -0
  49. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/fermion-operator.ipynb +0 -0
  50. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/hamiltonians.ipynb +0 -0
  51. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/index.md +0 -0
  52. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/lucj.ipynb +0 -0
  53. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/orbital-rotation.ipynb +0 -0
  54. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/protocols.ipynb +0 -0
  55. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/qubit-gate-decompositions.ipynb +0 -0
  56. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/state-vectors-and-gates.ipynb +0 -0
  57. {ffsim-0.0.79 → ffsim-0.0.80}/docs/explanations/variational-ansatzes.ipynb +0 -0
  58. {ffsim-0.0.79 → ffsim-0.0.80}/docs/generate_api_docs.py +0 -0
  59. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/compute-expectation-values.ipynb +0 -0
  60. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/entanglement-forging.ipynb +0 -0
  61. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/index.md +0 -0
  62. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/qiskit-lucj.ipynb +0 -0
  63. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/qiskit-merge-orbital-rotations.ipynb +0 -0
  64. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/qiskit-trotter.ipynb +0 -0
  65. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/sample-from-state-vectors.ipynb +0 -0
  66. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/sample-slater.ipynb +0 -0
  67. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/simulate-trotter-hubbard.ipynb +0 -0
  68. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/simulate-trotter-mol-ham.ipynb +0 -0
  69. {ffsim-0.0.79 → ffsim-0.0.80}/docs/how-to-guides/simulate-vqe.ipynb +0 -0
  70. {ffsim-0.0.79 → ffsim-0.0.80}/docs/index.md +0 -0
  71. {ffsim-0.0.79 → ffsim-0.0.80}/docs/install.md +0 -0
  72. {ffsim-0.0.79 → ffsim-0.0.80}/docs/tutorials/double-factorized-trotter.ipynb +0 -0
  73. {ffsim-0.0.79 → ffsim-0.0.80}/docs/tutorials/index.md +0 -0
  74. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/__init__.py +0 -0
  75. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_cistring.py +0 -0
  76. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_lib.pyi +0 -0
  77. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/__init__.py +0 -0
  78. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/contract/__init__.py +0 -0
  79. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/contract/diag_coulomb.py +0 -0
  80. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/contract/num_op_sum.py +0 -0
  81. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/gates/__init__.py +0 -0
  82. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/gates/diag_coulomb.py +0 -0
  83. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/gates/num_op_sum.py +0 -0
  84. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/_slow/gates/orbital_rotation.py +0 -0
  85. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/contract/__init__.py +0 -0
  86. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/contract/diag_coulomb.py +0 -0
  87. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/contract/num_op_sum.py +0 -0
  88. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/contract/one_body.py +0 -0
  89. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/contract/two_body.py +0 -0
  90. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/gates/__init__.py +0 -0
  91. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/gates/basic_gates.py +0 -0
  92. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/gates/diag_coulomb.py +0 -0
  93. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/gates/num_op_sum.py +0 -0
  94. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/gates/orbital_rotation.py +0 -0
  95. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/gates/quad_ham.py +0 -0
  96. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/hamiltonians/__init__.py +0 -0
  97. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/init_cache.py +0 -0
  98. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/linalg/__init__.py +0 -0
  99. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/linalg/double_factorized_decomposition.py +0 -0
  100. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/linalg/givens.py +0 -0
  101. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/linalg/linalg.py +0 -0
  102. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/linalg/predicates.py +0 -0
  103. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/linalg/util.py +0 -0
  104. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/operators/__init__.py +0 -0
  105. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/operators/coupled_cluster.py +0 -0
  106. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/operators/fermi_hubbard.py +0 -0
  107. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/operators/fermion_action.py +0 -0
  108. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/operators/fermion_operator.py +0 -0
  109. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/optimize/__init__.py +0 -0
  110. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/optimize/_util.py +0 -0
  111. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/optimize/linear_method.py +0 -0
  112. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/protocols/__init__.py +0 -0
  113. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/protocols/apply_unitary_protocol.py +0 -0
  114. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/protocols/approximate_equality_protocol.py +0 -0
  115. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/protocols/diagonal_protocol.py +0 -0
  116. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/protocols/fermion_operator_protocol.py +0 -0
  117. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/protocols/trace_protocol.py +0 -0
  118. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/py.typed +0 -0
  119. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/__init__.py +0 -0
  120. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/__init__.py +0 -0
  121. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/diag_coulomb.py +0 -0
  122. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/diag_coulomb_trotter_split_op.py +0 -0
  123. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/double_factorized_trotter.py +0 -0
  124. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/givens_ansatz.py +0 -0
  125. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/num_num_ansatz.py +0 -0
  126. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/num_op_sum.py +0 -0
  127. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/orbital_rotation.py +0 -0
  128. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/slater_determinant.py +0 -0
  129. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/gates/ucj.py +0 -0
  130. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/jordan_wigner.py +0 -0
  131. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/lucj_pass_manager.py +0 -0
  132. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/sampler.py +0 -0
  133. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/sim.py +0 -0
  134. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/transpiler_passes/__init__.py +0 -0
  135. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/transpiler_passes/drop_negligible.py +0 -0
  136. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/transpiler_passes/merge_orbital_rotations.py +0 -0
  137. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/transpiler_stages.py +0 -0
  138. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/qiskit/util.py +0 -0
  139. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/random/__init__.py +0 -0
  140. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/__init__.py +0 -0
  141. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/bitstring.py +0 -0
  142. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/dimensions.py +0 -0
  143. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/product_state_sum.py +0 -0
  144. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/sample_slater.py +0 -0
  145. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/slater.py +0 -0
  146. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/spin.py +0 -0
  147. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/states/wick.py +0 -0
  148. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/testing/__init__.py +0 -0
  149. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/testing/testing.py +0 -0
  150. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/trotter/__init__.py +0 -0
  151. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/trotter/_util.py +0 -0
  152. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/trotter/diagonal_coulomb_split_op.py +0 -0
  153. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/trotter/double_factorized.py +0 -0
  154. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/trotter/qdrift.py +0 -0
  155. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/__init__.py +0 -0
  156. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/multireference.py +0 -0
  157. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/orbital_optimization.py +0 -0
  158. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/ucj_angles_spin_balanced.py +0 -0
  159. {ffsim-0.0.79 → ffsim-0.0.80}/python/ffsim/variational/util.py +0 -0
  160. {ffsim-0.0.79 → ffsim-0.0.80}/src/contract/diag_coulomb.rs +0 -0
  161. {ffsim-0.0.79 → ffsim-0.0.80}/src/contract/mod.rs +0 -0
  162. {ffsim-0.0.79 → ffsim-0.0.80}/src/contract/num_op_sum.rs +0 -0
  163. {ffsim-0.0.79 → ffsim-0.0.80}/src/gates/diag_coulomb.rs +0 -0
  164. {ffsim-0.0.79 → ffsim-0.0.80}/src/gates/mod.rs +0 -0
  165. {ffsim-0.0.79 → ffsim-0.0.80}/src/gates/num_op_sum.rs +0 -0
  166. {ffsim-0.0.79 → ffsim-0.0.80}/src/gates/orbital_rotation.rs +0 -0
  167. {ffsim-0.0.79 → ffsim-0.0.80}/src/gates/phase_shift.rs +0 -0
  168. {ffsim-0.0.79 → ffsim-0.0.80}/src/jordan_wigner.rs +0 -0
  169. {ffsim-0.0.79 → ffsim-0.0.80}/src/lib.rs +0 -0
  170. {ffsim-0.0.79 → ffsim-0.0.80}/src/linalg/givens.rs +0 -0
  171. {ffsim-0.0.79 → ffsim-0.0.80}/src/linalg/mod.rs +0 -0
  172. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/__init__.py +0 -0
  173. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/_slow/__init__.py +0 -0
  174. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/_slow/contract/__init__.py +0 -0
  175. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/_slow/contract/diag_coulomb_test.py +0 -0
  176. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/_slow/contract/num_op_sum_test.py +0 -0
  177. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/_slow/gates/__init__.py +0 -0
  178. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/_slow/gates/diag_coulomb_test.py +0 -0
  179. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/_slow/gates/num_op_sum_test.py +0 -0
  180. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/_slow/gates/orbital_rotation_test.py +0 -0
  181. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/contract/__init__.py +0 -0
  182. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/contract/diag_coulomb_test.py +0 -0
  183. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/contract/num_op_sum_test.py +0 -0
  184. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/contract/two_body_test.py +0 -0
  185. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/gates/__init__.py +0 -0
  186. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/gates/basic_gates_test.py +0 -0
  187. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/gates/diag_coulomb_test.py +0 -0
  188. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/gates/num_op_sum_test.py +0 -0
  189. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/gates/orbital_rotation_test.py +0 -0
  190. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/gates/quad_ham_test.py +0 -0
  191. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/hamiltonians/__init__.py +0 -0
  192. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/hamiltonians/diagonal_coulomb_hamiltonian_test.py +0 -0
  193. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/hamiltonians/double_factorized_hamiltonian_test.py +0 -0
  194. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/hamiltonians/molecular_hamiltonian_test.py +0 -0
  195. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/hamiltonians/single_factorized_hamiltonian_test.py +0 -0
  196. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/linalg/__init__.py +0 -0
  197. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/linalg/double_factorized_decomposition_test.py +0 -0
  198. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/linalg/givens_test.py +0 -0
  199. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/linalg/linalg_test.py +0 -0
  200. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/linalg/util_test.py +0 -0
  201. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/operators/__init__.py +0 -0
  202. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/operators/common_operators_test.py +0 -0
  203. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/operators/coupled_cluster_test.py +0 -0
  204. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/operators/fermi_hubbard_test.py +0 -0
  205. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/operators/fermion_action_test.py +0 -0
  206. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/operators/fermion_operator_test.py +0 -0
  207. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/optimize/__init__.py +0 -0
  208. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/optimize/linear_method_test.py +0 -0
  209. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/protocols/__init__.py +0 -0
  210. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/protocols/trace_protocol_test.py +0 -0
  211. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/__init__.py +0 -0
  212. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/__init__.py +0 -0
  213. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/diag_coulomb_test.py +0 -0
  214. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/diag_coulomb_trotter_split_op_test.py +0 -0
  215. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/double_factorized_trotter_test.py +0 -0
  216. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/givens_ansatz_test.py +0 -0
  217. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/num_num_ansatz_test.py +0 -0
  218. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/num_op_sum_test.py +0 -0
  219. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/orbital_rotation_test.py +0 -0
  220. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/slater_determinant_test.py +0 -0
  221. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/gates/ucj_test.py +0 -0
  222. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/jordan_wigner_test.py +0 -0
  223. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/lucj_pass_manager_test.py +0 -0
  224. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/sampler_test.py +0 -0
  225. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/sim_test.py +0 -0
  226. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/transpiler_passes/__init__.py +0 -0
  227. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/transpiler_passes/drop_negligible_test.py +0 -0
  228. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/transpiler_passes/merge_orbital_rotations_test.py +0 -0
  229. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/qiskit/util_test.py +0 -0
  230. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/random_test.py +0 -0
  231. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/states/__init__.py +0 -0
  232. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/states/bitstring_test.py +0 -0
  233. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/states/rdm_test.py +0 -0
  234. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/states/sample_slater_test.py +0 -0
  235. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/states/slater_test.py +0 -0
  236. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/states/states_test.py +0 -0
  237. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/states/wick_test.py +0 -0
  238. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/test_data/orbital_rotation-0.npy +0 -0
  239. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/test_no_warnings.py +0 -0
  240. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/testing_test.py +0 -0
  241. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/trotter/__init__.py +0 -0
  242. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/trotter/diag_coulomb_split_op_test.py +0 -0
  243. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/trotter/double_factorized_test.py +0 -0
  244. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/trotter/qdrift_test.py +0 -0
  245. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/__init__.py +0 -0
  246. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/givens_test.py +0 -0
  247. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/hopgate_test.py +0 -0
  248. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/multireference_test.py +0 -0
  249. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/num_num_test.py +0 -0
  250. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/orbital_optimization_test.py +0 -0
  251. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/uccsd_test.py +0 -0
  252. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/ucj_angles_spin_balanced_test.py +0 -0
  253. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/ucj_spin_balanced_test.py +0 -0
  254. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/ucj_spin_unbalanced_test.py +0 -0
  255. {ffsim-0.0.79 → ffsim-0.0.80}/tests/python/variational/ucj_spinless_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ffsim
3
- Version: 0.0.79
3
+ Version: 0.0.80
4
4
  Classifier: License :: OSI Approved :: Apache Software License
5
5
  Classifier: Programming Language :: Python
6
6
  Classifier: Programming Language :: Python :: 3 :: Only
@@ -32,13 +32,13 @@ Project-URL: Homepage, https://github.com/qiskit-community/ffsim
32
32
 
33
33
  <!-- start introduction -->
34
34
 
35
- ffsim is a software library for simulating fermionic quantum circuits that conserve particle number and the Z component of spin. This category includes many quantum circuits used for quantum chemistry simulations. By exploiting the symmetries and using specialized algorithms, ffsim can simulate these circuits much faster than a generic quantum circuit simulator.
35
+ ffsim is a software library for simulating fermionic quantum circuits that conserve particle number and the *z* component of spin. This category includes many quantum circuits used for quantum chemistry simulations. By exploiting the symmetries and using specialized algorithms, ffsim can simulate these circuits much faster than a generic quantum circuit simulator.
36
36
 
37
37
  <!-- end introduction -->
38
38
 
39
39
  ## Documentation
40
40
 
41
- Documentation is located at the [project website](https://qiskit-community.github.io/ffsim/).
41
+ Documentation is located at the [project website](https://qiskit-community.github.io/ffsim/). You might also be interested in the [paper about ffsim](https://arxiv.org/abs/2605.03123).
42
42
 
43
43
  ## Installation
44
44
 
@@ -112,10 +112,14 @@ print(energy) # prints -104.17181289596
112
112
  You can cite ffsim using the following BibTeX:
113
113
 
114
114
  ```bibtex
115
- @misc{ffsim,
116
- author = {{The ffsim developers}},
117
- title = {ffsim: Faster simulations of fermionic quantum circuits},
118
- howpublished = {\url{https://github.com/qiskit-community/ffsim}},
115
+ @misc{sung2026ffsim,
116
+ title={ffsim: Faster simulation of fermionic quantum circuits},
117
+ author={Kevin J. Sung and Inho Choi and Mirko Amico and Bartholomew Andrews and Esra Ayantuna and Yukio Kawashima and Wan-Hsuan Lin and David Omanovic and Samuele Piccinelli and Javier Robledo Moreno and Abdullah Ash Saki and James Shee and Soyoung Shin and Minh C. Tran and Kento Ueda and Haimeng Zhang and Mario Motta},
118
+ year={2026},
119
+ eprint={2605.03123},
120
+ archivePrefix={arXiv},
121
+ primaryClass={quant-ph},
122
+ url={https://arxiv.org/abs/2605.03123},
119
123
  }
120
124
  ```
121
125
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  <!-- start introduction -->
4
4
 
5
- ffsim is a software library for simulating fermionic quantum circuits that conserve particle number and the Z component of spin. This category includes many quantum circuits used for quantum chemistry simulations. By exploiting the symmetries and using specialized algorithms, ffsim can simulate these circuits much faster than a generic quantum circuit simulator.
5
+ ffsim is a software library for simulating fermionic quantum circuits that conserve particle number and the *z* component of spin. This category includes many quantum circuits used for quantum chemistry simulations. By exploiting the symmetries and using specialized algorithms, ffsim can simulate these circuits much faster than a generic quantum circuit simulator.
6
6
 
7
7
  <!-- end introduction -->
8
8
 
9
9
  ## Documentation
10
10
 
11
- Documentation is located at the [project website](https://qiskit-community.github.io/ffsim/).
11
+ Documentation is located at the [project website](https://qiskit-community.github.io/ffsim/). You might also be interested in the [paper about ffsim](https://arxiv.org/abs/2605.03123).
12
12
 
13
13
  ## Installation
14
14
 
@@ -82,10 +82,14 @@ print(energy) # prints -104.17181289596
82
82
  You can cite ffsim using the following BibTeX:
83
83
 
84
84
  ```bibtex
85
- @misc{ffsim,
86
- author = {{The ffsim developers}},
87
- title = {ffsim: Faster simulations of fermionic quantum circuits},
88
- howpublished = {\url{https://github.com/qiskit-community/ffsim}},
85
+ @misc{sung2026ffsim,
86
+ title={ffsim: Faster simulation of fermionic quantum circuits},
87
+ author={Kevin J. Sung and Inho Choi and Mirko Amico and Bartholomew Andrews and Esra Ayantuna and Yukio Kawashima and Wan-Hsuan Lin and David Omanovic and Samuele Piccinelli and Javier Robledo Moreno and Abdullah Ash Saki and James Shee and Soyoung Shin and Minh C. Tran and Kento Ueda and Haimeng Zhang and Mario Motta},
88
+ year={2026},
89
+ eprint={2605.03123},
90
+ archivePrefix={arXiv},
91
+ primaryClass={quant-ph},
92
+ url={https://arxiv.org/abs/2605.03123},
89
93
  }
90
94
  ```
91
95
 
@@ -5,6 +5,22 @@
5
5
  .. autoclass:: {{ objname }}
6
6
  :show-inheritance:
7
7
 
8
+ {% block attributes %}
9
+ {% if attributes %}
10
+ .. rubric:: {{ _('Attributes') }}
11
+
12
+ .. autosummary::
13
+ {% for item in attributes if item not in inherited_members %}
14
+ ~{{ name }}.{{ item }}
15
+ {%- endfor %}
16
+
17
+ {%- for item in attributes if item not in inherited_members %}
18
+
19
+ .. autoattribute:: {{ item }}
20
+ {%- endfor %}
21
+ {% endif %}
22
+ {% endblock %}
23
+
8
24
  {% block methods %}
9
25
  {%- set is_protocol = '__protocol_attrs__' in members and '__protocol_attrs__' not in inherited_members %}
10
26
  {%- set ns = namespace(protocol_methods=[]) %}
@@ -25,7 +41,7 @@
25
41
  {%- for item in ns.protocol_methods if item not in inherited_members %}
26
42
  ~{{ name }}.{{ item }}
27
43
  {%- endfor %}
28
- {% endif %}
44
+
29
45
  {%- for item in methods if item not in inherited_members and item != '__init__' %}
30
46
 
31
47
  .. automethod:: {{ item }}
@@ -34,15 +50,6 @@
34
50
 
35
51
  .. automethod:: {{ item }}
36
52
  {%- endfor %}
37
- {% endblock %}
38
-
39
- {% block attributes %}
40
- {% if attributes %}
41
- .. rubric:: {{ _('Attributes') }}
42
-
43
- .. autosummary::
44
- {% for item in attributes if item not in inherited_members %}
45
- ~{{ name }}.{{ item }}
46
- {%- endfor %}
47
53
  {% endif %}
48
54
  {% endblock %}
55
+
@@ -4,7 +4,7 @@
4
4
  "cell_type": "markdown",
5
5
  "metadata": {},
6
6
  "source": [
7
- "# Simulate excitation-preserving Qiskit circuits\n",
7
+ "# Simulate Hamming weight-preserving Qiskit circuits\n",
8
8
  "\n",
9
9
  "ffsim supports the simulation of a restricted class of Qiskit circuits built from gates in the Qiskit circuit library. The simulation is accomplished by mapping the qubits to fermions. The circuits that can be simulated are those whose gates, except for state preparation and measurement, are \"excitation-preserving,\" that is, they do not alter the Hamming weight of computational basis states. Concretely, the circuit should have the following structure:\n",
10
10
  "\n",
@@ -25,6 +25,7 @@
25
25
  "- GlobalPhaseGate\n",
26
26
  "- IGate\n",
27
27
  "- InnerProductGate\n",
28
+ "- iSwapGate\n",
28
29
  "- MCPhaseGate\n",
29
30
  "- PermutationGate\n",
30
31
  "- PhaseGate\n",
@@ -39,9 +40,8 @@
39
40
  "- UCRZGate\n",
40
41
  "- XXPlusYYGate\n",
41
42
  "- ZGate\n",
42
- "- iSwapGate\n",
43
43
  "\n",
44
- "Currently, simulations are limited to 63 qubits (or 126 qubits for circuits with \"spin Z symmetry,\" see [below](#circuits-with-spin-z-symmetry)).\n",
44
+ "Currently, simulations are limited to 63 qubits (or 126 qubits for circuits with \"spin *z* symmetry,\" see [below](#circuits-with-spin-z-symmetry)).\n",
45
45
  "\n",
46
46
  "The following code cell constructs an example of a 63-qubit circuit that would be difficult for a generic quantum circuit simulator, but is easy for ffsim because it only contains 2 excitations."
47
47
  ]
@@ -277,9 +277,9 @@
277
277
  "cell_type": "markdown",
278
278
  "metadata": {},
279
279
  "source": [
280
- "## Circuits with spin Z symmetry\n",
280
+ "## Circuits with spin *z* symmetry\n",
281
281
  "\n",
282
- "In addition to being excitation-preserving, circuits with so-called spin Z symmetry have an even number of qubits, and excitations do not pass between the first half of the qubits and the second half. Such circuits arise naturally in many fermionic systems, where the first half of the qubits represent spin-up orbitals and the second half of the qubits represent spin-down orbitals. For example, the spinful variants of the [local unitary cluster Jastrow (LUCJ) ansatz](../explanations/lucj.ipynb) have this symmetry.\n",
282
+ "In addition to being excitation-preserving, circuits with so-called spin *z* symmetry have an even number of qubits, and excitations do not pass between the first half of the qubits and the second half. Such circuits arise naturally in many fermionic systems, where the first half of the qubits represent spin-up orbitals and the second half of the qubits represent spin-down orbitals. For example, the spinful variants of the [local unitary cluster Jastrow (LUCJ) ansatz](../explanations/lucj.ipynb) have this symmetry.\n",
283
283
  "\n",
284
284
  "The following code cell constructs a 126-qubit LUCJ circuit with 2 electrons in each spin sector. While the number of qubits in this circuit is well beyond the capabilities of a generic state vector simulator, ffsim can easily simulate it by taking advantage of both the particle number conservation and spin Z symmetries."
285
285
  ]
@@ -375,7 +375,7 @@
375
375
  "name": "python",
376
376
  "nbconvert_exporter": "python",
377
377
  "pygments_lexer": "ipython3",
378
- "version": "3.13.7"
378
+ "version": "3.13.12"
379
379
  }
380
380
  },
381
381
  "nbformat": 4,
@@ -5,7 +5,7 @@ build-backend = "maturin"
5
5
  [project]
6
6
  name = "ffsim"
7
7
  requires-python = ">=3.10"
8
- version = "0.0.79"
8
+ version = "0.0.80"
9
9
  description = "Faster simulation of fermionic quantum circuits."
10
10
  readme = "README.md"
11
11
  license = { file = "LICENSE" }
@@ -176,10 +176,10 @@ class FermionOperator(MutableMapping):
176
176
  if not (self.conserves_particle_number() and self.conserves_spin_z()):
177
177
  raise ValueError(
178
178
  "The given FermionOperator could not be converted to a LinearOperator "
179
- "because it does not conserve particle number and the Z component "
179
+ "because it does not conserve particle number and the z component "
180
180
  "of spin. "
181
181
  f"Conserves particle number: {self.conserves_particle_number()} "
182
- f"Conserves spin Z: {self.conserves_spin_z()}"
182
+ f"Conserves spin z: {self.conserves_spin_z()}"
183
183
  )
184
184
 
185
185
  dim_ = dim(norb, nelec)
@@ -49,19 +49,16 @@ class DiagonalCoulombHamiltonian(
49
49
  :math:`J^{\alpha\alpha}=J^{\beta\beta}` and
50
50
  :math:`J^{\alpha\beta}=J^{\beta\alpha}`, so only two matrices are needed to describe
51
51
  the Hamiltonian.
52
-
53
- Attributes:
54
- one_body_tensor (np.ndarray): The one-body tensor :math:`h`.
55
- diag_coulomb_mats (np.ndarray): The diagonal Coulomb matrices
56
- :math:`J^{\alpha\alpha}` and :math:`J^{\alpha\beta}`, given as a pair
57
- of Numpy arrays specifying independent coefficients for alpha-alpha and
58
- alpha-beta interactions (in that order).
59
- constant (float): The constant.
60
52
  """
61
53
 
62
54
  one_body_tensor: np.ndarray
55
+ r"""The one-body tensor :math:`h`."""
63
56
  diag_coulomb_mats: np.ndarray
57
+ r"""The diagonal Coulomb matrices :math:`J^{\alpha\alpha}` and
58
+ :math:`J^{\alpha\beta}`, given as a pair of Numpy arrays specifying independent
59
+ coefficients for alpha-alpha and alpha-beta interactions (in that order)."""
64
60
  constant: float = 0.0
61
+ """The constant."""
65
62
 
66
63
  @property
67
64
  def norb(self) -> int:
@@ -82,24 +82,22 @@ class DoubleFactorizedHamiltonian(
82
82
  - `Motta et al., "Low rank representations for quantum simulation of electronic structure" (2021)`_
83
83
  - `Cohn, Motta, and Parrish, "Quantum Filter Diagonalization with Double-Factorized Hamiltonians" (2021)`_
84
84
 
85
- Attributes:
86
- one_body_tensor (np.ndarray): The one-body tensor :math:`\kappa`.
87
- diag_coulomb_mats (np.ndarray): The diagonal Coulomb matrices.
88
- orbital_rotations (np.ndarray): The orbital rotations.
89
- constant (float): The constant.
90
- z_representation (bool): Whether the Hamiltonian is in the "Z" representation
91
- rather than the "number" representation.
92
-
93
85
  .. _Motta et al., "Low rank representations for quantum simulation of electronic structure" (2021): https://arxiv.org/abs/1808.02625
94
86
  .. _Cohn, Motta, and Parrish, "Quantum Filter Diagonalization with Double-Factorized Hamiltonians" (2021): https://arxiv.org/abs/2104.08957
95
87
  .. _scipy.optimize.minimize: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html
96
88
  """ # noqa: E501
97
89
 
98
90
  one_body_tensor: np.ndarray
91
+ r"""The one-body tensor :math:`\kappa`."""
99
92
  diag_coulomb_mats: np.ndarray
93
+ """The diagonal Coulomb matrices."""
100
94
  orbital_rotations: np.ndarray
95
+ """The orbital rotations."""
101
96
  constant: float = 0.0
97
+ """The constant."""
102
98
  z_representation: bool = False
99
+ """Whether the Hamiltonian is in the "Z" representation rather than the "number"
100
+ representation."""
103
101
 
104
102
  @property
105
103
  def norb(self) -> int:
@@ -45,16 +45,14 @@ class MolecularHamiltonian(
45
45
 
46
46
  Here :math:`h_{pq}` is called the one-body tensor and :math:`h_{pqrs}` is called
47
47
  the two-body tensor.
48
-
49
- Attributes:
50
- one_body_tensor (np.ndarray): The one-body tensor.
51
- two_body_tensor (np.ndarray): The two-body tensor.
52
- constant (float): The constant.
53
48
  """
54
49
 
55
50
  one_body_tensor: np.ndarray
51
+ """The one-body tensor."""
56
52
  two_body_tensor: np.ndarray
53
+ """The two-body tensor."""
57
54
  constant: float = 0.0
55
+ """The constant."""
58
56
 
59
57
  @property
60
58
  def norb(self) -> int:
@@ -275,15 +273,14 @@ class MolecularHamiltonianSpinless(
275
273
  Here :math:`h_{pq}` is called the one-body tensor and :math:`h_{pqrs}` is called
276
274
  the two-body tensor.
277
275
 
278
- Attributes:
279
- one_body_tensor (np.ndarray): The one-body tensor.
280
- two_body_tensor (np.ndarray): The two-body tensor.
281
- constant (float): The constant.
282
276
  """
283
277
 
284
278
  one_body_tensor: np.ndarray
279
+ """The one-body tensor."""
285
280
  two_body_tensor: np.ndarray
281
+ """The two-body tensor."""
286
282
  constant: float = 0.0
283
+ """The constant."""
287
284
 
288
285
  @property
289
286
  def norb(self) -> int:
@@ -47,16 +47,15 @@ class SingleFactorizedHamiltonian(protocols.SupportsLinearOperator):
47
47
 
48
48
  where each :math:`M^{(t)}` is a Hermitian matrix.
49
49
 
50
- Attributes:
51
- one_body_tensor (np.ndarray): The one-body tensor :math:`\kappa`.
52
- one_body_squares (np.ndarray): The one-body tensors :math:`M^{(t)}` whose
53
- squares are summed in the Hamiltonian.
54
- constant (float): The constant.
55
50
  """
56
51
 
57
52
  one_body_tensor: np.ndarray
53
+ r"""The one-body tensor :math:`\kappa`."""
58
54
  one_body_squares: np.ndarray
55
+ r"""The one-body tensors :math:`M^{(t)}` whose squares are summed in the
56
+ Hamiltonian."""
59
57
  constant: float = 0.0
58
+ """The constant."""
60
59
 
61
60
  @property
62
61
  def norb(self) -> int:
@@ -41,87 +41,78 @@ from ffsim.hamiltonians import MolecularHamiltonian
41
41
 
42
42
  @dataclasses.dataclass(kw_only=True)
43
43
  class MolecularData:
44
- """Class for storing molecular data.
45
-
46
- Attributes:
47
- core_energy (float): The core energy.
48
- one_body_integrals (np.ndarray): The one-body integrals.
49
- two_body_integrals (np.ndarray): The two-body integrals in compressed format.
50
- norb (int): The number of spatial orbitals.
51
- nelec (tuple[int, int]): The number of alpha and beta electrons.
52
- atom (list[tuple[str, list[float]]] | None): The coordinates of the atoms in
53
- the molecule.
54
- basis (str | None): The basis set, e.g. "sto-6g".
55
- spin (int | None): The spin of the molecule.
56
- symmetry (str | None): The symmetry of the molecule.
57
- mo_coeff (np.ndarray | None): Molecular orbital coefficients in the AO basis.
58
- mo_occ (np.ndarray | None): Molecular orbital occupancies.
59
- active_space (list[int] | None): The molecular orbitals included in the active
60
- space.
61
- hf_energy (float | None): The Hartree-Fock energy.
62
- hf_mo_coeff (np.ndarray | None): Hartree-Fock canonical orbital coefficients in
63
- the AO basis.
64
- hf_mo_occ (np.ndarray | None): Hartree-Fock canonical orbital occupancies.
65
- mp2_energy (float | None): The MP2 energy.
66
- mp2_t2 (np.ndarray | tuple[np.ndarray, np.ndarray, np.ndarray] | None): The
67
- MP2 t2 amplitudes.
68
- ccsd_energy (float | None): The CCSD energy.
69
- ccsd_t1 (np.ndarray | tuple[np.ndarray, np.ndarray] | None): The CCSD t1
70
- amplitudes.
71
- ccsd_t2 (np.ndarray | tuple[np.ndarray, np.ndarray, np.ndarray] | None): The
72
- CCSD t2 amplitudes.
73
- cisd_energy (float | None): The CISD energy.
74
- cisd_vec (np.ndarray | None): The CISD state vector.
75
- sci_energy (float | None): The SCI energy.
76
- sci_vec (tuple[np.ndarray, np.ndarray, np.ndarray] | None): The SCI state
77
- vector coefficients, spin alpha strings, and spin beta strings.
78
- fci_energy (float | None): The FCI energy.
79
- fci_vec (np.ndarray | None): The FCI state vector.
80
- dipole_integrals (np.ndarray | None): The dipole integrals.
81
- orbital_symmetries (list[str] | None): The orbital symmetries.
82
- """
44
+ """Class for storing molecular data."""
83
45
 
84
46
  # Molecular integrals
85
47
  core_energy: float
48
+ """The core energy."""
86
49
  one_body_integrals: np.ndarray
50
+ """The one-body integrals."""
87
51
  two_body_integrals: np.ndarray
52
+ """The two-body integrals in compressed format."""
88
53
  # Number of orbitals and numbers of alpha and beta electrons
89
54
  norb: int
55
+ """The number of spatial orbitals."""
90
56
  nelec: tuple[int, int]
57
+ """The numbers of alpha and beta electrons."""
91
58
  # Molecule information corresponding to attributes of pyscf.gto.Mole
92
59
  atom: list[tuple[str, list[float]]] | None = None
60
+ """The coordinates of the atoms in the molecule."""
93
61
  basis: str | None = None
62
+ """The basis set, e.g. ``"sto-6g"``."""
94
63
  spin: int | None = None
64
+ """The spin of the molecule."""
95
65
  symmetry: str | None = None
66
+ """The symmetry of the molecule."""
96
67
  # active space information
97
68
  mo_coeff: np.ndarray | None = None
69
+ """Molecular orbital coefficients in the AO basis."""
98
70
  mo_occ: np.ndarray | None = None
71
+ """Molecular orbital occupancies."""
99
72
  active_space: list[int] | None = None
73
+ """The molecular orbitals included in the active space."""
100
74
  # Hartree-Fock data
101
75
  hf_energy: float | None = None
76
+ """The Hartree-Fock energy."""
102
77
  hf_mo_coeff: np.ndarray | None = None
78
+ """Hartree-Fock canonical orbital coefficients in the AO basis."""
103
79
  hf_mo_occ: np.ndarray | None = None
80
+ """Hartree-Fock canonical orbital occupancies."""
104
81
  # MP2 data
105
82
  mp2_energy: float | None = None
83
+ """The MP2 energy."""
106
84
  mp2_t2: np.ndarray | tuple[np.ndarray, np.ndarray, np.ndarray] | None = None
85
+ """The MP2 t2 amplitudes."""
107
86
  # CCSD data
108
87
  ccsd_energy: float | None = None
88
+ """The CCSD energy."""
109
89
  ccsd_t1: np.ndarray | tuple[np.ndarray, np.ndarray] | None = None
90
+ """The CCSD t1 amplitudes."""
110
91
  ccsd_t2: np.ndarray | tuple[np.ndarray, np.ndarray, np.ndarray] | None = None
92
+ """The CCSD t2 amplitudes."""
111
93
  # CISD data
112
94
  cisd_energy: float | None = None
95
+ """The CISD energy."""
113
96
  cisd_vec: np.ndarray | None = None
97
+ """The CISD state vector."""
114
98
  # SCI data
115
99
  sci_energy: float | None = None
100
+ """The SCI energy."""
116
101
  sci_vec: tuple[np.ndarray, np.ndarray, np.ndarray] | None = None
102
+ """The SCI state vector coefficients, spin alpha strings, and spin beta strings."""
117
103
  # FCI data
118
104
  fci_energy: float | None = None
105
+ """The FCI energy."""
119
106
  fci_vec: np.ndarray | None = None
107
+ """The FCI state vector."""
120
108
  # DMRG data
121
109
  dmrg_energy: float | None = None
110
+ """The DMRG energy."""
122
111
  # other information
123
112
  dipole_integrals: np.ndarray | None = None
113
+ """The dipole integrals."""
124
114
  orbital_symmetries: list[str] | None = None
115
+ """The orbital symmetries."""
125
116
 
126
117
  @cached_property
127
118
  def hamiltonian(self) -> MolecularHamiltonian:
@@ -62,9 +62,9 @@ def s_minus_operator(norb: int) -> FermionOperator:
62
62
 
63
63
 
64
64
  def s_x_operator(norb: int) -> FermionOperator:
65
- r"""Spin X operator.
65
+ r"""Spin :math:`x` operator.
66
66
 
67
- The spin X operator is defined as
67
+ The spin :math:`x` operator is defined as
68
68
 
69
69
  .. math::
70
70
 
@@ -79,7 +79,7 @@ def s_x_operator(norb: int) -> FermionOperator:
79
79
  norb: The number of spatial orbitals.
80
80
 
81
81
  Returns:
82
- The spin X operator.
82
+ The spin :math:`x` operator.
83
83
  """
84
84
  coeffs: dict[tuple[tuple[bool, bool, int], ...], complex] = {}
85
85
  for i in range(norb):
@@ -89,9 +89,9 @@ def s_x_operator(norb: int) -> FermionOperator:
89
89
 
90
90
 
91
91
  def s_y_operator(norb: int) -> FermionOperator:
92
- r"""Spin Y operator.
92
+ r"""Spin :math:`y` operator.
93
93
 
94
- The spin Y operator is defined as
94
+ The spin :math:`y` operator is defined as
95
95
 
96
96
  .. math::
97
97
 
@@ -106,7 +106,7 @@ def s_y_operator(norb: int) -> FermionOperator:
106
106
  norb: The number of spatial orbitals.
107
107
 
108
108
  Returns:
109
- The spin Y operator.
109
+ The spin :math:`y` operator.
110
110
  """
111
111
  coeffs: dict[tuple[tuple[bool, bool, int], ...], complex] = {}
112
112
  for i in range(norb):
@@ -116,9 +116,9 @@ def s_y_operator(norb: int) -> FermionOperator:
116
116
 
117
117
 
118
118
  def s_z_operator(norb: int) -> FermionOperator:
119
- r"""Spin Z operator.
119
+ r"""Spin :math:`z` operator.
120
120
 
121
- The spin Z operator is defined as
121
+ The spin :math:`z` operator is defined as
122
122
 
123
123
  .. math::
124
124
 
@@ -132,7 +132,7 @@ def s_z_operator(norb: int) -> FermionOperator:
132
132
  norb: The number of spatial orbitals.
133
133
 
134
134
  Returns:
135
- The spin Z operator.
135
+ The spin :math:`z` operator.
136
136
  """
137
137
  coeffs: dict[tuple[tuple[bool, bool, int], ...], complex] = {}
138
138
  for i in range(norb):
@@ -68,9 +68,9 @@ def _fermion_operator_to_linear_operator(
68
68
  if not (operator.conserves_particle_number() and operator.conserves_spin_z()):
69
69
  raise ValueError(
70
70
  "The given FermionOperator could not be converted to a LinearOperator "
71
- "because it does not conserve particle number and the Z component of spin. "
71
+ "because it does not conserve particle number and the z component of spin. "
72
72
  f"Conserves particle number: {operator.conserves_particle_number()} "
73
- f"Conserves spin Z: {operator.conserves_spin_z()}"
73
+ f"Conserves spin z: {operator.conserves_spin_z()}"
74
74
  )
75
75
 
76
76
  if isinstance(nelec, int):
@@ -105,9 +105,9 @@ def _apply_fermion_term(
105
105
  """Apply a product of ladder operators to a state vector.
106
106
 
107
107
  Given a state vector and a string of ladder operators that conserves particle number
108
- and total spin Z, return the state vector that results from applying the ladder
109
- operators to the given state vector. The string of ladder operators is represented
110
- as a sequence of (``action``, ``spin``, ``orbital``) tuples, where:
108
+ and the z component of spin, return the state vector that results from applying the
109
+ ladder operators to the given state vector. The string of ladder operators is
110
+ represented as a sequence of (``action``, ``spin``, ``orbital``) tuples, where:
111
111
 
112
112
  - ``action`` is a bool. False indicates a destruction operator and True indicates
113
113
  a creation operator.
@@ -858,9 +858,9 @@ def random_diagonal_coulomb_hamiltonian(
858
858
  one_body_tensor = random_real_symmetric_matrix(norb, seed=rng)
859
859
  else:
860
860
  one_body_tensor = random_hermitian(norb, seed=rng)
861
- diag_coulomb_mat_a = random_real_symmetric_matrix(norb, seed=rng)
862
- diag_coulomb_mat_b = random_real_symmetric_matrix(norb, seed=rng)
863
- diag_coulomb_mats = np.stack([diag_coulomb_mat_a, diag_coulomb_mat_b])
861
+ mat_aa = random_real_symmetric_matrix(norb, seed=rng)
862
+ mat_ab = random_real_symmetric_matrix(norb, seed=rng)
863
+ diag_coulomb_mats = np.stack([mat_aa, mat_ab])
864
864
  constant = rng.standard_normal()
865
865
  return hamiltonians.DiagonalCoulombHamiltonian(
866
866
  one_body_tensor, diag_coulomb_mats, constant=constant
@@ -956,7 +956,7 @@ def random_fermion_hamiltonian(
956
956
  ) -> operators.FermionOperator:
957
957
  """Sample a random fermion Hamiltonian.
958
958
 
959
- A fermion Hamiltonian is hermitian and conserves particle number and spin Z.
959
+ A fermion Hamiltonian is hermitian and conserves particle number and spin :math:`z`.
960
960
 
961
961
  Args:
962
962
  norb: The number of spatial orbitals.
@@ -36,15 +36,12 @@ if TYPE_CHECKING:
36
36
 
37
37
  @dataclasses.dataclass
38
38
  class ReducedDensityMatrix:
39
- r"""Class to store one- and two-body reduced density matrices.
40
-
41
- Attributes:
42
- one_rdm (np.ndarray): The one-body reduced density matrix.
43
- two_rdm (np.ndarray): The two-body reduced density matrix.
44
- """
39
+ """Class to store one- and two-body reduced density matrices."""
45
40
 
46
41
  one_rdm: np.ndarray
42
+ """The one-body reduced density matrix."""
47
43
  two_rdm: np.ndarray
44
+ """The two-body reduced density matrix."""
48
45
 
49
46
  def rotated(self, orbital_rotation: np.ndarray) -> ReducedDensityMatrix:
50
47
  r"""Apply an orbital rotation to the reduced density matrices.
@@ -32,19 +32,16 @@ from ffsim.states.dimensions import dim
32
32
 
33
33
  @dataclass
34
34
  class StateVector:
35
- """A state vector in the FCI representation.
36
-
37
- Attributes:
38
- vec: Array of state vector coefficients.
39
- norb: The number of spatial orbitals.
40
- nelec: Either a single integer representing the number of fermions for a
41
- spinless system, or a pair of integers storing the numbers of spin alpha
42
- and spin beta fermions.
43
- """
35
+ """A state vector in the FCI representation."""
44
36
 
45
37
  vec: np.ndarray
38
+ """Array of state vector coefficients."""
46
39
  norb: int
40
+ """The number of spatial orbitals."""
47
41
  nelec: int | tuple[int, int]
42
+ """Either a single integer representing the number of fermions for a spinless
43
+ system, or a pair of integers storing the numbers of spin alpha and spin beta
44
+ fermions."""
48
45
 
49
46
  def __array__(self, dtype=None, copy=None):
50
47
  # TODO in Numpy 2.0 this can be simplified to
@@ -37,23 +37,19 @@ class GivensAnsatzOp(
37
37
  Note that this ansatz does not implement any interactions between spin alpha and
38
38
  spin beta orbitals.
39
39
 
40
- Attributes:
41
- norb (int): The number of spatial orbitals.
42
- interaction_pairs (list[tuple[int, int]]): The orbital pairs to apply the Givens
43
- rotations to.
44
- thetas (np.ndarray): The angles for the Givens rotations.
45
- phis (np.ndarray | None): The optional phase angles for the Givens rotations.
46
- phase_angles (np.ndarray | None): The optional phase angles for the layer of
47
- single-orbital phase gates.
48
-
49
40
  .. _Givens rotations: ffsim.html#ffsim.apply_givens_rotation
50
41
  """
51
42
 
52
43
  norb: int
44
+ """The number of spatial orbitals."""
53
45
  interaction_pairs: list[tuple[int, int]]
46
+ """The orbital pairs to apply the Givens rotations to."""
54
47
  thetas: np.ndarray
48
+ """The angles for the Givens rotations."""
55
49
  phis: np.ndarray | None
50
+ """The optional phase angles for the Givens rotations."""
56
51
  phase_angles: np.ndarray | None
52
+ """The optional phase angles for the layer of single-orbital phase gates."""
57
53
 
58
54
  def __post_init__(self):
59
55
  if len(self.thetas) != len(self.interaction_pairs):
@@ -35,14 +35,6 @@ class HopGateAnsatzOperator(
35
35
  spin beta orbitals. It was designed to be used with entanglement forging (see
36
36
  the references).
37
37
 
38
- Attributes:
39
- norb (int): The number of spatial orbitals.
40
- interaction_pairs (list[tuple[int, int]]): The orbital pairs to apply the hop
41
- gates to.
42
- thetas (np.ndarray): The rotation angles for the hop gates.
43
- final_orbital_rotation (np.ndarray): An optional final orbital rotation to
44
- append to the ansatz, used to optimize the orbital basis.
45
-
46
38
  References:
47
39
  - `Eddins et al., "Doubling the Size of Quantum Simulators by Entanglement Forging" (2022)`_
48
40
 
@@ -51,9 +43,14 @@ class HopGateAnsatzOperator(
51
43
  """ # noqa: E501
52
44
 
53
45
  norb: int
46
+ """The number of spatial orbitals."""
54
47
  interaction_pairs: list[tuple[int, int]]
48
+ """The orbital pairs to apply the hop gates to."""
55
49
  thetas: np.ndarray
50
+ """The rotation angles for the hop gates."""
56
51
  final_orbital_rotation: np.ndarray | None = None
52
+ """An optional final orbital rotation to append to the ansatz, used to optimize
53
+ the orbital basis."""
57
54
 
58
55
  def _apply_unitary_(
59
56
  self, vec: np.ndarray, norb: int, nelec: int | tuple[int, int], copy: bool