ffsim 0.0.78__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.
- {ffsim-0.0.78 → ffsim-0.0.80}/CONTRIBUTING.md +3 -8
- {ffsim-0.0.78 → ffsim-0.0.80}/PKG-INFO +13 -9
- {ffsim-0.0.78 → ffsim-0.0.80}/README.md +12 -8
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/_templates/autosummary/class.rst +21 -10
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/conf.py +0 -1
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/qiskit-circuits-sim.ipynb +6 -6
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/install.md +6 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/pyproject.toml +26 -25
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/fermion_operator.py +2 -2
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/hamiltonians/diagonal_coulomb_hamiltonian.py +5 -8
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/hamiltonians/double_factorized_hamiltonian.py +6 -8
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/hamiltonians/molecular_hamiltonian.py +6 -9
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/hamiltonians/single_factorized_hamiltonian.py +4 -5
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/linalg/__init__.py +1 -6
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/linalg/givens.py +0 -44
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/molecular_data.py +30 -39
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/operators/common_operators.py +9 -9
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/protocols/linear_operator_protocol.py +5 -5
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/diag_coulomb_trotter_split_op.py +12 -2
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/double_factorized_trotter.py +12 -2
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/ucj.py +47 -18
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/random/random.py +4 -4
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/rdm.py +3 -6
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/states.py +6 -9
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/trotter/qdrift.py +6 -8
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/givens.py +5 -9
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/hopgate.py +5 -8
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/num_num.py +3 -6
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/uccsd.py +22 -36
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/ucj_spin_balanced.py +8 -12
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/ucj_spin_unbalanced.py +14 -19
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/ucj_spinless.py +7 -8
- {ffsim-0.0.78 → ffsim-0.0.80}/src/fermion_operator.rs +2 -2
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/_slow/contract/diag_coulomb_test.py +14 -14
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/_slow/contract/num_op_sum_test.py +6 -5
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/_slow/gates/diag_coulomb_test.py +17 -18
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/_slow/gates/num_op_sum_test.py +6 -5
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/_slow/gates/orbital_rotation_test.py +7 -6
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/contract/diag_coulomb_test.py +15 -18
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/contract/num_op_sum_test.py +12 -12
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/gates/basic_gates_test.py +29 -43
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/gates/diag_coulomb_test.py +22 -25
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/gates/num_op_sum_test.py +9 -10
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/gates/orbital_rotation_test.py +22 -28
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/hamiltonians/single_factorized_hamiltonian_test.py +13 -19
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/linalg/givens_test.py +6 -8
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/linalg/linalg_test.py +5 -5
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/molecular_data_test.py +39 -2
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/operators/fermion_operator_test.py +6 -7
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/optimize/linear_method_test.py +4 -3
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/diag_coulomb_test.py +20 -21
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/diag_coulomb_trotter_split_op_test.py +23 -3
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/double_factorized_trotter_test.py +26 -3
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/givens_ansatz_test.py +10 -10
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/num_num_ansatz_test.py +5 -4
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/num_op_sum_test.py +19 -20
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/orbital_rotation_test.py +21 -26
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/slater_determinant_test.py +7 -9
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/ucj_test.py +51 -9
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/jordan_wigner_test.py +26 -12
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/sampler_test.py +50 -64
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/sim_test.py +62 -70
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/transpiler_passes/merge_orbital_rotations_test.py +25 -41
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/util_test.py +3 -2
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/random_test.py +20 -20
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/states/bitstring_test.py +4 -4
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/states/sample_slater_test.py +13 -15
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/states/slater_test.py +19 -33
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/states/wick_test.py +8 -10
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/testing_test.py +4 -3
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/trotter/diag_coulomb_split_op_test.py +8 -10
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/trotter/double_factorized_test.py +6 -6
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/trotter/qdrift_test.py +58 -42
- {ffsim-0.0.78 → ffsim-0.0.80}/uv.lock +13 -9
- {ffsim-0.0.78 → ffsim-0.0.80}/.cargo/config.toml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.dockerignore +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.github/workflows/build-and-release.yml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.github/workflows/check.yml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.github/workflows/docker.yml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.github/workflows/docs-dev.yml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.github/workflows/docs-release.yml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.github/workflows/test-latest-versions.yml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.github/workflows/test-minimum-versions.yml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.gitignore +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/.pre-commit-config.yaml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/Cargo.lock +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/Cargo.toml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/Dockerfile +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/LICENSE +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/compose.yaml +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/_static/logo-dark.svg +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/_static/logo.svg +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/diag-coulomb-hamiltonian.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/double-factorized.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/fermion-operator.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/hamiltonians.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/index.md +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/lucj.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/orbital-rotation.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/protocols.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/qubit-gate-decompositions.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/state-vectors-and-gates.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/explanations/variational-ansatzes.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/generate_api_docs.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/compute-expectation-values.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/entanglement-forging.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/index.md +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/qiskit-lucj.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/qiskit-merge-orbital-rotations.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/qiskit-trotter.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/sample-from-state-vectors.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/sample-slater.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/simulate-trotter-hubbard.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/simulate-trotter-mol-ham.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/how-to-guides/simulate-vqe.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/index.md +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/tutorials/double-factorized-trotter.ipynb +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/docs/tutorials/index.md +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_cistring.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_lib.pyi +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/contract/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/contract/diag_coulomb.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/contract/num_op_sum.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/gates/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/gates/diag_coulomb.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/gates/num_op_sum.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/_slow/gates/orbital_rotation.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/contract/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/contract/diag_coulomb.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/contract/num_op_sum.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/contract/one_body.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/contract/two_body.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/gates/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/gates/basic_gates.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/gates/diag_coulomb.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/gates/num_op_sum.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/gates/orbital_rotation.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/gates/quad_ham.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/hamiltonians/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/init_cache.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/linalg/double_factorized_decomposition.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/linalg/linalg.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/linalg/predicates.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/linalg/util.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/operators/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/operators/coupled_cluster.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/operators/fermi_hubbard.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/operators/fermion_action.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/operators/fermion_operator.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/optimize/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/optimize/_util.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/optimize/linear_method.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/protocols/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/protocols/apply_unitary_protocol.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/protocols/approximate_equality_protocol.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/protocols/diagonal_protocol.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/protocols/fermion_operator_protocol.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/protocols/trace_protocol.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/py.typed +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/diag_coulomb.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/givens_ansatz.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/num_num_ansatz.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/num_op_sum.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/orbital_rotation.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/gates/slater_determinant.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/jordan_wigner.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/lucj_pass_manager.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/sampler.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/sim.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/transpiler_passes/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/transpiler_passes/drop_negligible.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/transpiler_passes/merge_orbital_rotations.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/transpiler_stages.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/qiskit/util.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/random/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/bitstring.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/dimensions.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/product_state_sum.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/sample_slater.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/slater.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/spin.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/states/wick.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/testing/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/testing/testing.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/trotter/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/trotter/_util.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/trotter/diagonal_coulomb_split_op.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/trotter/double_factorized.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/multireference.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/orbital_optimization.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/ucj_angles_spin_balanced.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/python/ffsim/variational/util.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/contract/diag_coulomb.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/contract/mod.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/contract/num_op_sum.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/gates/diag_coulomb.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/gates/mod.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/gates/num_op_sum.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/gates/orbital_rotation.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/gates/phase_shift.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/jordan_wigner.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/lib.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/linalg/givens.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/src/linalg/mod.rs +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/_slow/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/_slow/contract/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/_slow/gates/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/contract/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/contract/two_body_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/gates/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/gates/quad_ham_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/hamiltonians/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/hamiltonians/diagonal_coulomb_hamiltonian_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/hamiltonians/double_factorized_hamiltonian_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/hamiltonians/molecular_hamiltonian_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/linalg/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/linalg/double_factorized_decomposition_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/linalg/util_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/operators/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/operators/common_operators_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/operators/coupled_cluster_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/operators/fermi_hubbard_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/operators/fermion_action_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/optimize/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/protocols/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/protocols/trace_protocol_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/gates/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/lucj_pass_manager_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/transpiler_passes/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/qiskit/transpiler_passes/drop_negligible_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/states/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/states/rdm_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/states/states_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/test_data/orbital_rotation-0.npy +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/test_no_warnings.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/trotter/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/__init__.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/givens_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/hopgate_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/multireference_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/num_num_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/orbital_optimization_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/uccsd_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/ucj_angles_spin_balanced_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/ucj_spin_balanced_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/ucj_spin_unbalanced_test.py +0 -0
- {ffsim-0.0.78 → ffsim-0.0.80}/tests/python/variational/ucj_spinless_test.py +0 -0
|
@@ -7,7 +7,7 @@ The instructions on this page won't work natively on Windows. For ffsim developm
|
|
|
7
7
|
To set up ffsim for development, install it from source in editable mode along with the development requirements:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
pip install -e
|
|
10
|
+
pip install -e . --group dev
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
To install the git pre-commit hooks, run
|
|
@@ -57,10 +57,7 @@ substituting `<environment name>` with the name of the tox environment for the c
|
|
|
57
57
|
|
|
58
58
|
## Run code checks directly
|
|
59
59
|
|
|
60
|
-
Running the code checks directly using the corresponding software tool
|
|
61
|
-
|
|
62
|
-
- Automatically fix lint and formatting errors.
|
|
63
|
-
- Build the documentation without deleting cached files.
|
|
60
|
+
Running the code checks directly using the corresponding software tool gives you more flexibility and allows you to automatically fix lint and formatting errors.
|
|
64
61
|
|
|
65
62
|
### Run tests
|
|
66
63
|
|
|
@@ -101,6 +98,4 @@ sphinx-build -b html -W docs/ docs/_build/html
|
|
|
101
98
|
|
|
102
99
|
## View locally built documentation
|
|
103
100
|
|
|
104
|
-
After building the
|
|
105
|
-
Building the documentation can consume significant CPU because the tutorial notebooks are executed.
|
|
106
|
-
The tox command deletes cached files so it will execute all the notebooks every time, while the sphinx command only executes notebooks if they were modified from the previous run.
|
|
101
|
+
After building the documentation, open the file `docs/_build/html/index.html` in your web browser.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ffsim
|
|
3
|
-
Version: 0.0.
|
|
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,25 +32,25 @@ 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
|
|
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
|
|
|
45
45
|
<!-- start installation -->
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
On Linux and macOS, you can install ffsim using pip:
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
pip install ffsim
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
See the [installation instructions](https://qiskit-community.github.io/ffsim/install.html) for information about using ffsim on Windows, as well as instructions for installing from source and running ffsim in a container.
|
|
54
54
|
|
|
55
55
|
<!-- end installation -->
|
|
56
56
|
|
|
@@ -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{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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,25 +2,25 @@
|
|
|
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
|
|
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
|
|
|
15
15
|
<!-- start installation -->
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
On Linux and macOS, you can install ffsim using pip:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
pip install ffsim
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
See the [installation instructions](https://qiskit-community.github.io/ffsim/install.html) for information about using ffsim on Windows, as well as instructions for installing from source and running ffsim in a container.
|
|
24
24
|
|
|
25
25
|
<!-- end installation -->
|
|
26
26
|
|
|
@@ -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{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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,20 +41,15 @@
|
|
|
25
41
|
{%- for item in ns.protocol_methods if item not in inherited_members %}
|
|
26
42
|
~{{ name }}.{{ item }}
|
|
27
43
|
{%- endfor %}
|
|
28
|
-
|
|
29
|
-
{%- for item in
|
|
44
|
+
|
|
45
|
+
{%- for item in methods if item not in inherited_members and item != '__init__' %}
|
|
30
46
|
|
|
31
47
|
.. automethod:: {{ item }}
|
|
32
48
|
{%- endfor %}
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
{% block attributes %}
|
|
36
|
-
{% if attributes %}
|
|
37
|
-
.. rubric:: {{ _('Attributes') }}
|
|
49
|
+
{%- for item in ns.protocol_methods %}
|
|
38
50
|
|
|
39
|
-
..
|
|
40
|
-
{% for item in attributes if item not in inherited_members %}
|
|
41
|
-
~{{ name }}.{{ item }}
|
|
51
|
+
.. automethod:: {{ item }}
|
|
42
52
|
{%- endfor %}
|
|
43
53
|
{% endif %}
|
|
44
54
|
{% endblock %}
|
|
55
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"cell_type": "markdown",
|
|
5
5
|
"metadata": {},
|
|
6
6
|
"source": [
|
|
7
|
-
"# Simulate
|
|
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
|
|
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
|
|
280
|
+
"## Circuits with spin *z* symmetry\n",
|
|
281
281
|
"\n",
|
|
282
|
-
"In addition to being excitation-preserving, circuits with so-called spin
|
|
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.
|
|
378
|
+
"version": "3.13.12"
|
|
379
379
|
}
|
|
380
380
|
},
|
|
381
381
|
"nbformat": 4,
|
|
@@ -15,6 +15,8 @@ ffsim is available on [PyPI](https://pypi.org/project/ffsim/). You can install i
|
|
|
15
15
|
pip install ffsim
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
For improved performance on [x86](https://en.wikipedia.org/wiki/X86) systems, considering [installing from source](#install-from-source).
|
|
19
|
+
|
|
18
20
|
## Install from source
|
|
19
21
|
|
|
20
22
|
You can use pip to install ffsim from source. For example:
|
|
@@ -25,6 +27,10 @@ cd ffsim
|
|
|
25
27
|
pip install .
|
|
26
28
|
```
|
|
27
29
|
|
|
30
|
+
Installing from source may improve performance on x86 systems because the Rust extensions in the PyPI wheels are compiled with `-C target-cpu=x86-64`, which targets the baseline x86-64 instruction set for broad compatibility. When you build from source, ffsim is configured to compile its Rust extensions with `-C target-cpu=native`, so the Rust compiler can emit optimized instructions (e.g., AVX2, AVX-512) for your specific CPU.
|
|
31
|
+
|
|
32
|
+
Similarly, you can install [PySCF](https://pyscf.org/) from source with `-DBUILD_MARCH_NATIVE=ON` to enable CPU-specific optimizations in PySCF's C extensions. See [PySCF's installation instructions](https://pyscf.org/user/install.html#build-from-source) for details.
|
|
33
|
+
|
|
28
34
|
## Use within Docker
|
|
29
35
|
|
|
30
36
|
We provide a [Dockerfile](https://github.com/qiskit-community/ffsim/blob/main/Dockerfile) and a [compose.yaml](https://github.com/qiskit-community/ffsim/blob/main/compose.yaml) file, which you can use to build a [Docker](https://www.docker.com/) image with just a few simple commands:
|
|
@@ -5,7 +5,7 @@ build-backend = "maturin"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ffsim"
|
|
7
7
|
requires-python = ">=3.10"
|
|
8
|
-
version = "0.0.
|
|
8
|
+
version = "0.0.80"
|
|
9
9
|
description = "Faster simulation of fermionic quantum circuits."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
license = { file = "LICENSE" }
|
|
@@ -45,17 +45,19 @@ dev = [
|
|
|
45
45
|
"coverage",
|
|
46
46
|
"maturin",
|
|
47
47
|
"mypy",
|
|
48
|
+
"pre-commit",
|
|
49
|
+
"pytest",
|
|
50
|
+
"ruff",
|
|
51
|
+
"typos",
|
|
52
|
+
]
|
|
53
|
+
docs = [
|
|
48
54
|
"myst-parser",
|
|
49
55
|
"nbmake",
|
|
50
56
|
"nbsphinx",
|
|
51
|
-
"pre-commit",
|
|
52
|
-
"pytest",
|
|
53
57
|
"qiskit[visualization]",
|
|
54
58
|
"qiskit-sphinx-theme",
|
|
55
|
-
"ruff",
|
|
56
59
|
"sphinx",
|
|
57
60
|
"sphinx-autodoc-typehints",
|
|
58
|
-
"typos",
|
|
59
61
|
]
|
|
60
62
|
|
|
61
63
|
[tool.maturin]
|
|
@@ -140,7 +142,7 @@ commands = [["pytest"]]
|
|
|
140
142
|
|
|
141
143
|
[tool.tox.env.coverage]
|
|
142
144
|
description = "check test coverage"
|
|
143
|
-
|
|
145
|
+
deps = ["coverage", "pytest"]
|
|
144
146
|
commands = [
|
|
145
147
|
[
|
|
146
148
|
"coverage",
|
|
@@ -157,48 +159,43 @@ commands = [
|
|
|
157
159
|
],
|
|
158
160
|
]
|
|
159
161
|
|
|
160
|
-
[tool.tox.env.
|
|
161
|
-
description = "
|
|
162
|
-
dependency_groups = ["dev"]
|
|
163
|
-
commands = [["mypy"]]
|
|
164
|
-
|
|
165
|
-
[tool.tox.env.lint]
|
|
166
|
-
description = "check for lint"
|
|
162
|
+
[tool.tox.env.format]
|
|
163
|
+
description = "check formatting"
|
|
167
164
|
skip_install = true
|
|
168
165
|
deps = ["ruff"]
|
|
169
166
|
allowlist_externals = ["cargo"]
|
|
170
167
|
commands = [
|
|
171
168
|
[
|
|
172
169
|
"ruff",
|
|
173
|
-
"
|
|
170
|
+
"format",
|
|
171
|
+
"--check",
|
|
174
172
|
],
|
|
175
173
|
[
|
|
176
174
|
"cargo",
|
|
177
|
-
"
|
|
175
|
+
"fmt",
|
|
178
176
|
"--all",
|
|
179
177
|
"--",
|
|
180
|
-
"
|
|
181
|
-
"warnings",
|
|
178
|
+
"--check",
|
|
182
179
|
],
|
|
183
180
|
]
|
|
184
181
|
|
|
185
|
-
[tool.tox.env.
|
|
186
|
-
description = "check
|
|
182
|
+
[tool.tox.env.lint]
|
|
183
|
+
description = "check for lint"
|
|
187
184
|
skip_install = true
|
|
188
185
|
deps = ["ruff"]
|
|
189
186
|
allowlist_externals = ["cargo"]
|
|
190
187
|
commands = [
|
|
191
188
|
[
|
|
192
189
|
"ruff",
|
|
193
|
-
"
|
|
194
|
-
"--check",
|
|
190
|
+
"check",
|
|
195
191
|
],
|
|
196
192
|
[
|
|
197
193
|
"cargo",
|
|
198
|
-
"
|
|
194
|
+
"clippy",
|
|
199
195
|
"--all",
|
|
200
196
|
"--",
|
|
201
|
-
"
|
|
197
|
+
"-D",
|
|
198
|
+
"warnings",
|
|
202
199
|
],
|
|
203
200
|
]
|
|
204
201
|
|
|
@@ -208,10 +205,14 @@ skip_install = true
|
|
|
208
205
|
deps = ["typos"]
|
|
209
206
|
commands = [["typos"]]
|
|
210
207
|
|
|
208
|
+
[tool.tox.env.type]
|
|
209
|
+
description = "run type check"
|
|
210
|
+
deps = ["mypy"]
|
|
211
|
+
commands = [["mypy"]]
|
|
212
|
+
|
|
211
213
|
[tool.tox.env.docs]
|
|
212
214
|
description = "build docs"
|
|
213
|
-
dependency_groups = ["
|
|
214
|
-
set_env = { SPHINX_APIDOC_OPTIONS = "members,show-inheritance" }
|
|
215
|
+
dependency_groups = ["docs"]
|
|
215
216
|
commands = [
|
|
216
217
|
[
|
|
217
218
|
"python",
|
|
@@ -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
|
|
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
|
|
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:
|
|
@@ -16,11 +16,7 @@ from ffsim.linalg.double_factorized_decomposition import (
|
|
|
16
16
|
double_factorized_t2_alpha_beta,
|
|
17
17
|
modified_cholesky,
|
|
18
18
|
)
|
|
19
|
-
from ffsim.linalg.givens import
|
|
20
|
-
GivensRotation,
|
|
21
|
-
apply_matrix_to_slices,
|
|
22
|
-
givens_decomposition,
|
|
23
|
-
)
|
|
19
|
+
from ffsim.linalg.givens import apply_matrix_to_slices, givens_decomposition
|
|
24
20
|
from ffsim.linalg.linalg import (
|
|
25
21
|
expm_multiply_taylor,
|
|
26
22
|
lup,
|
|
@@ -38,7 +34,6 @@ from ffsim.linalg.predicates import (
|
|
|
38
34
|
)
|
|
39
35
|
|
|
40
36
|
__all__ = [
|
|
41
|
-
"GivensRotation",
|
|
42
37
|
"apply_matrix_to_slices",
|
|
43
38
|
"double_factorized",
|
|
44
39
|
"double_factorized_t2",
|
|
@@ -12,37 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
|
-
import cmath
|
|
16
|
-
from typing import NamedTuple
|
|
17
|
-
|
|
18
15
|
import numpy as np
|
|
19
|
-
from scipy.linalg.blas import zrotg as zrotg_
|
|
20
16
|
|
|
21
17
|
from ffsim import _lib
|
|
22
18
|
|
|
23
19
|
|
|
24
|
-
class GivensRotation(NamedTuple):
|
|
25
|
-
r"""A Givens rotation.
|
|
26
|
-
|
|
27
|
-
A Givens rotation acts on the two-dimensional subspace spanned by the :math:`i`-th
|
|
28
|
-
and :math:`j`-th basis vectors as
|
|
29
|
-
|
|
30
|
-
.. math::
|
|
31
|
-
|
|
32
|
-
\begin{pmatrix}
|
|
33
|
-
c & s \\
|
|
34
|
-
-s^* & c \\
|
|
35
|
-
\end{pmatrix}
|
|
36
|
-
|
|
37
|
-
where :math:`c` is a real number and :math:`s` is a complex number.
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
c: float
|
|
41
|
-
s: complex
|
|
42
|
-
i: int
|
|
43
|
-
j: int
|
|
44
|
-
|
|
45
|
-
|
|
46
20
|
def apply_matrix_to_slices(
|
|
47
21
|
target: np.ndarray,
|
|
48
22
|
mat: np.ndarray,
|
|
@@ -73,24 +47,6 @@ def apply_matrix_to_slices(
|
|
|
73
47
|
return out
|
|
74
48
|
|
|
75
49
|
|
|
76
|
-
def zrotg(a: complex, b: complex, tol=1e-12) -> tuple[float, complex]:
|
|
77
|
-
r"""Safe version of the zrotg BLAS function.
|
|
78
|
-
|
|
79
|
-
The BLAS implementation of zrotg can return NaN values if either a or b is very
|
|
80
|
-
close to zero. This function detects if either a or b is close to zero up to the
|
|
81
|
-
specified tolerance, in which case it behaves as if it were exactly zero.
|
|
82
|
-
|
|
83
|
-
Note that in contrast to ``scipy.linalg.blas.zrotg``, this function returns c as a
|
|
84
|
-
float rather than a complex.
|
|
85
|
-
"""
|
|
86
|
-
if cmath.isclose(b, 0.0, abs_tol=tol):
|
|
87
|
-
return 1.0, 0j
|
|
88
|
-
if cmath.isclose(a, 0.0, abs_tol=tol):
|
|
89
|
-
return 0.0, 1 + 0j
|
|
90
|
-
c, s = zrotg_(a, b)
|
|
91
|
-
return c.real, s
|
|
92
|
-
|
|
93
|
-
|
|
94
50
|
def givens_decomposition(
|
|
95
51
|
mat: np.ndarray, tol: float = 1e-12
|
|
96
52
|
) -> tuple[list[tuple[float, complex, int, int]], np.ndarray]:
|