Skip to content

Commit

Permalink
Update qiskit_addon_sqd/fermion.py
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin J. Sung <kevjsung@umich.edu>
  • Loading branch information
caleb-johnson and kevinsung authored Jan 30, 2025
1 parent 8d373f1 commit 819c19f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions qiskit_addon_sqd/fermion.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ def optimize_orbitals(
- Average orbital occupancy
"""
k_dim = int((1 + np.sqrt(1 + 8 * len(k_flat))) // 2) # quadratic formula
num_orbitals = hcore.shape[0]
if k_dim != num_orbitals:
num_params = (num_orbitals**2 - num_orbitals) // 2
if len(k_flat) != num_params:
raise ValueError(
f"k_flat must specify the upper triangle of the transform matrix. k_flat length is {len(k_flat)}. "
f"Expected {(num_orbitals**2 - num_orbitals) // 2}."
f"Expected {num_params}."
)
if isinstance(bitstring_matrix, tuple):
warnings.warn(
Expand Down

0 comments on commit 819c19f

Please sign in to comment.