-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added optional subspace to diagonalization #146
base: main
Are you sure you want to change the base?
Conversation
qiskit_addon_sqd/fermion.py
Outdated
@@ -79,6 +82,10 @@ def solve_fermion( | |||
spin_sq: float | None = None, | |||
max_davidson: int = 100, | |||
verbose: int | None = None, | |||
subspace: bool = False, | |||
subspace_orb: Optional[int] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subspace_orb: Optional[int] = None, | |
subspace_orb: int | None = None, |
and similarly elsewhere
qiskit_addon_sqd/fermion.py
Outdated
@@ -79,6 +82,10 @@ def solve_fermion( | |||
spin_sq: float | None = None, | |||
max_davidson: int = 100, | |||
verbose: int | None = None, | |||
subspace: bool = False, | |||
subspace_orb: Optional[int] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to document these arguments in the docstring.
qiskit_addon_sqd/fermion.py
Outdated
@@ -593,3 +610,17 @@ def _transition_str_to_bool(string_rep: np.ndarray) -> tuple[np.ndarray, np.ndar | |||
annihilate = np.logical_or(string_rep == "-", string_rep == "n") | |||
|
|||
return diag, create, annihilate | |||
|
|||
def generate_bitstrings(norb, neleca,nelecb, n_orb, n_alpha, n_beta): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write a docstring for this function. If it's meant to be a private function, prefix it with an underscore _
. Also, please add type annotations to the function arguments.
qiskit_addon_sqd/fermion.py
Outdated
alpha_strings = get_strings(n_orb, n_alpha) | ||
beta_strings = get_strings(n_orb, n_beta) | ||
d_orb = neleca+nelecb - n_alpha - n_beta | ||
doubly_occ = [''.join(seq) for seq in itertools.product('1', repeat=int(d_orb/2))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is equivalent to
double_occ = ['1' * int(d_orb / 2)]
Is this what you meant to write? I'm having a bit of trouble following the logic.
Fixes #137
subspace = True allows one to always have configurations spanning a user-defined smaller subspace (norbsmall, nelecsmall) in the diagonalization, regardless of samples collected from experiments. Optional arguments include subspace_norb, subspace_alpha, and subspace beta.