Skip to content

Commit 0e62172

Browse files
committed
Fix shift type and default
1 parent b65601a commit 0e62172

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

qiskit_addon_sqd/fermion.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def solve_fermion(
7575
*,
7676
open_shell: bool = False,
7777
spin_sq: float | None = None,
78-
shift: float | None = None,
78+
shift: float = 0.1,
7979
**kwargs,
8080
) -> tuple[float, SCIState, tuple[np.ndarray, np.ndarray], float]:
8181
"""Approximate the ground state given molecular integrals and a set of electronic configurations.
@@ -111,12 +111,15 @@ def solve_fermion(
111111
- Expectation value of spin-squared
112112
113113
"""
114+
# Format inputs
114115
if isinstance(bitstring_matrix, tuple):
115116
ci_strs = bitstring_matrix
116117
else:
117118
ci_strs = bitstring_matrix_to_ci_strs(bitstring_matrix, open_shell=open_shell)
118119
ci_strs = _check_ci_strs(ci_strs)
120+
shift = np.float64(shift)
119121

122+
# Get hamming weights of each half of the first CI str. All CI strs should share the same hamming weight
120123
num_up = format(ci_strs[0][0], "b").count("1")
121124
num_dn = format(ci_strs[1][0], "b").count("1")
122125

0 commit comments

Comments
 (0)