Skip to content
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

Deprecate determinant addresses as input to fermionic solver functions #29

Merged
merged 9 commits into from
Sep 18, 2024

Conversation

caleb-johnson
Copy link
Collaborator

@caleb-johnson caleb-johnson commented Sep 16, 2024

solve_fermion and optimize_orbitals should take a bitstring_matrix as input to define the subspace onto which to project/diagonalize the Hamiltonian, same as solve_qubit. Users should not have to convert to determinant addresses before using those functions, as this is an unnecessary step and can be error prone, especially if not using the helper functions.

@caleb-johnson
Copy link
Collaborator Author

@garrison would you mind glancing at the changes in the fermion module and tell me whether you agree that this is a clean way to deprecate (it was your idea ;) ).

I believe there is a breaking change here for users who previously specified all their positional args as kwargs, as we now require the first arg to be positional. I suppose I could update the release note to reflect this

@kevinsung
Copy link
Collaborator

kevinsung commented Sep 16, 2024

I'm not sure I agree with this change. The PySCF SCI solver takes strings as input, so it seems more user-friendly for solve_fermion, which has a similar functionality, to take the same kind of input. If I'm not mistaken, the motivation for this change is that postselect_and_subsample returns a bitstring matrix instead of strings. Can we instead modify that function to return strings?

@garrison garrison mentioned this pull request Sep 16, 2024
@caleb-johnson
Copy link
Collaborator Author

I'm not sure I agree with this change. The PySCF SCI solver takes strings as input, so it seems more user-friendly for solve_fermion, which has a similar functionality, to take the same kind of input. If I'm not mistaken, the motivation for this change is that postselect_and_subsample returns a bitstring matrix instead of strings. Can we instead modify that function to return strings?

The motivation is that solve_qubit takes the bitstring_matrix, and we want this technique to extend beyond chemistry. So by making this change, the solvers can have a more similar interface. I find creation of addresses, and the possibility for errors at that step, to be unnecessary in the workflow

@caleb-johnson
Copy link
Collaborator Author

If I'm not mistaken, the motivation for this change is that postselect_and_subsample returns a bitstring matrix instead of strings. Can we instead modify that function to return strings?

Post-selection and subsampling is a part of the more general technique, so we don't want to have any chemistry lingo in there. I think that interface should stay as-is. I'd really just like to remove an unnecessary step in the workflow that doesn't really add any understanding or information (addresses and bitstring_matrix contain the same info).

@kevinsung
Copy link
Collaborator

I see, that makes sense. I'm fine with this change then.

qiskit_addon_sqd/fermion.py Show resolved Hide resolved
qiskit_addon_sqd/fermion.py Outdated Show resolved Hide resolved
@caleb-johnson caleb-johnson merged commit c115ea2 into main Sep 18, 2024
9 checks passed
@caleb-johnson caleb-johnson deleted the solve-ferm-matrix branch September 18, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants