LOW_RANK / low_rank_two_body_decomposition silently drops the Hubbard U term from get_interaction_operator
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- quantum-computing
Hướng nghiên cứu
Start with get_chemist_two_body_coefficients in src/openfermion/circuits/low_rank.py:57-91 and trace how low_rank_two_body_decomposition extracts the spatial block. Reproduce with get_interaction_operator(fermi_hubbard(...)), then check that the decomposition preserves the Hubbard U term and raises ValueError for unsupported tensors. The report suggests rebuilding the tensor and comparing it with the input, including the spin-exchange case from #1105.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the problem
low_rank_two_body_decomposition (and therefore simulate_trotter(..., algorithm=LOW_RANK)) silently drops the on-site interaction of a Fermi-Hubbard Hamiltonian built with get_interaction_operator.
With spin_basis=True, get_chemist_two_body_coefficients (src/openfermion/circuits/low_rank.py:57-91) transposes the tensor to chemist order and keeps only the αα→ββ block chemist[α, α, β, β], assuming the operator is stored there. But the same operator can be stored under other index orders. get_interaction_operator(fermi_hubbard(...)) stores the U term as h[1, 0, 1, 0], i.e. a†_{1↓} a†_{0↑} a_{1↓} a_{0↑}, which lands outside the extracted block. The block is then all zeros. The spin-symmetry check added in #1296 passes trivially on a zero block, so no ValueError is raised, although the LOW_RANK docs say unsupported Hamiltonians should raise.
Explain how to reproduce the issue
import numpy as np, scipy.linalg, cirq
import openfermion as of
H = of.fermi_hubbard(2, 1, tunneling=1.0, coulomb=4.0, periodic=False) # 2 sites, 4 spin-orbitals
io = of.get_interaction_operator(H)
lam, g, corr, _ = of.low_rank_two_body_decomposition(io.two_body_tensor) # no error
print(lam) # [0.]
qubits = cirq.LineQubit.range(4)
t = 0.7
psi0 = np.zeros(16, complex); psi0[0b1100] = 1
circ = cirq.Circuit(of.simulate_trotter(qubits, io, time=t, n_steps=50, algorithm=of.LOW_RANK))
psi = circ.final_state_vector(initial_state=psi0, qubit_order=qubits)
exact = scipy.linalg.expm(-1j * t * of.get_sparse_operator(io).toarray()) @ psi0
hop_only = scipy.linalg.expm(-1j * t * of.get_sparse_operator(
of.fermi_hubbard(2, 1, 1.0, 0.0, periodic=False), n_qubits=4).toarray()) @ psi0
print(abs(np.vdot(exact, psi)) ** 2) # 0.4377
print(abs(np.vdot(hop_only, psi)) ** 2) # 1.0000 -> the circuit evolves under hopping only
To check the decomposition directly, I rebuilt the two-body operator from (lam, g, corr) and compared its sparse matrix with that of the input operator. Every Hubbard lattice I tried was silently wrong, with a maximum matrix error equal to the full interaction scale (up to 16): 2x1, 3x1 and 2x2 lattices, with U = 1 and with U = 4. So were 20 of 20 random spin-symmetric extended-Hubbard Hamiltonians built through get_interaction_operator. Molecular Hamiltonians from MolecularData / spinorb_from_spatial are fine (error about 1e-14), which is presumably why the tests do not catch this.
A possible fix is to bring the tensor into a canonical form before extracting the spatial block, for example by symmetrizing over the equivalent index orders of the same operator. Then validate by rebuilding the tensor and raising ValueError if it does not reproduce the input operator. That last check would also cover the spin-exchange case of #1105.
What version of OpenFermion are you using?
OpenFermion 1.8.2.dev0 (main @ 34adf31), cirq 1.7.0, Python 3.12, Windows.
- Ngôn ngữ chính
- Python
- Star
- 1.7k
- Fork
- 438
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của quantumlib/OpenFermion
-
PhaseFitEstimator cannot fit the signal from its own reduced sampling gridCó thể đã có người làm @madcpf đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quantumlib/OpenFermion#1479 ·
-
Switch to Pyrefly for type checking instead of mypyCó thể đã có người làm @rosspeili đã nhận 133 ngày trước. Đang mởa: health a: python e: experienced
quantumlib/OpenFermion#1399 · 6 bình luận · 1 người được giao ·
-
Add a CODEOWNERS fileCó thể làm lại được @mhucka đã nhận 159 ngày trước và không có pull request nào đang mở. Đang mởa: devops e: maintainer
quantumlib/OpenFermion#1337 · 3 bình luận · 1 người được giao ·
-
Add workflow to run create-env-files.sh when Dependabot changes dependenciesCó thể đã có người làm @rosspeili đã nhận 142 ngày trước. Đang mởa: devops e: experienced
quantumlib/OpenFermion#1332 · 4 bình luận · 1 người được giao ·
-
Remove global random seed used for testingCó thể đã có người làm @SripriyaDevarapalli đã nhận 54 ngày trước. Đang mởa: performance a: python e: experienced no QC knowledge needed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
quantumlib/OpenFermion#1060 · 6 bình luận ·
Tất cả issue của quantumlib/OpenFermion
Issue tương tự
-
Relatório de erro do LinuxToysĐang mởauto-reported bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
backend bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
nolte/kamerplanter#3193 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwiseCó thể đã có người làm @abdulwaarith0 đã nhận hôm nay. Đang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
MakazhanAlpamys/Soup#3690 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày