Sample-based quantum diagonalization (SQD) release notes
0.12.0
New Features
-
Added the
max_dimargument to theqiskit_addon_sqd.fermion.diagonalize_fermionic_hamiltonian()function. This argument is used to limit the dimension of the SCI subspace. -
Introduced the
qiskit_addon_sqd.subsampling.postselect_by_hamming_right_and_left()function.
Upgrade Notes
qiskit_addon_sqd.fermion.SCIStatenow takes two additional required arguments,norbandnelec. This is a breaking change.
Deprecation Notes
-
qiskit_addon_sqd.configuration_recovery.post_select_by_hamming_weight()is now deprecated. Instead, useqiskit_addon_sqd.subsampling.postselect_by_hamming_right_and_left(). -
qiskit_addon_sqd.subsampling.postselect_and_subsample()is now deprecated. Instead, useqiskit_addon_sqd.subsampling.postselect_by_hamming_right_and_left()andqiskit_addon_sqd.subsampling.subsample().
Bug Fixes
-
Fixed a bug in
qiskit_addon_sqd.fermion.bitstring_matrix_to_ci_strs()in which the conversion of bitstrings to CI strings could be incorrect when the number of orbitals is greater than 53. -
Fixed a bug in which saving and loading
qiskit_addon_sqd.fermion.SCIStateobjects resulted in an error. -
Added a release note to version 0.11 for a breaking change involving
qiskit_addon_sqd.fermion.SCIState.
0.11.0
New Features
-
Added a new function
qiskit_addon_sqd.fermion.diagonalize_fermionic_hamiltonian()to serve as the main entrypoint to the SQD algorithm. See the updated tutorials for a demonstration of how to use this function. -
qiskit_addon_sqd.fermion.solve_fermion()now accepts ashiftargument used to shift states which have the wrong spin, .
Upgrade Notes
qiskit_addon_sqd.fermion.solve_fermion()andqiskit_addon_sqd.fermion.optimize_orbitals()now accept trailingkwargs, which will be passed directly to pyscf.fci.selected_ci.kernel_fixed_space under the hood to calculate the target state. Themax_davidsonargument should now be passed asmax_cyclein both functions.
Bug Fixes
- Fixed a float to integer type conversion affecting the
qubitmodule
0.10.0
Upgrade Notes
- Removed
qiskit_addon_sqd.fermion.flip_orbital_occupancies(). Users no longer need to flip the orbital occupancies output fromqiskit_addon_sqd.fermion.solve_fermion()andqiskit_addon_sqd.fermion.optimize_orbitals(); they will be output in the order expected byqiskit_addon_sqd.configuration_recovery.recover_configurations():tuple(array([occ_a_0, ..., occ_a_N]), array([occ_b_0, ..., occ_b_N])).
Deprecation Notes
-
The
avg_occupanciesargument toqiskit_addon_sqd.configuration_recovery.recover_configurations()should now be a length-2 tuple containing the spin-up and spin-down occupancies, respectively.Old format:
array([occ_b_N, ..., occ_b_0, occ_a_N, ..., occ_a_0])New format:
tuple(array([occ_a_0, ..., occ_a_N]), array([occ_b_0, ..., occ_b_N]))
Bug Fixes
- Fixed a bug which would cause the energy output from
qiskit_addon_sqd.fermion.solve_fermion()to be incorrect when the inputspin_sqdeviates from the spin^2 of the output wavefunction.
0.9.0
Upgrade Notes
qiskit_addon_sqd.fermion.optimize_orbitals()andqiskit_addon_sqd.fermion.rotate_integrals()now requirek_flatto specify the upper triangle (not including diagonal) of the rotation matrix, rather than the entire matrix.
Bug Fixes
-
Fixed an indexing error in
qiskit_addon_sqd.configuration_recovery()which caused bits in the right half of the bitstring to be flipped with respect to the occupancies of the oritals associated with the left half of the bitstring. -
pyscf is no longer considered a dependency on Windows, where it fails to install. However, Windows remains an unsupported platform.
0.8.0
New Features
-
Added support for Python 3.9.
-
All functions which take a
rand_seedargument now also accept anumpy.random.Generatorinstance as therand_seed.
Upgrade Notes
- The ground state returned by
qiskit_addon_sqd.fermion.solve_fermion()will now be an instance ofqiskit_addon_sqd.fermion.SCIState, rather than a PySCFSCIVectorinstance.
0.7.0
Bug Fixes
-
Fixed a bug in
qiskit_addon_sqd.fermion.solve_fermion()andqiskit_addon_sqd.fermion.optimize_orbitals()which causes the determinants for spin-up and spin-down to be incorrectly flipped before solving. -
Fixed a bug in open-shell workflows which would cause
qiskit_addon_sqd.fermion.optimize_orbitals()to crash with amallocerror.
0.6.0
Upgrade Notes
-
Specifying
addressesas a keyword argument toqiskit_addon_sqd.fermion.solve_fermion()andqiskit_addon_sqd.fermion.optimize_orbitals()is no longer supported. Users may still passaddressesas the first positional argument; however, this usage is deprecated. Users are encouraged to pass the bitstring matrix defining the subspace as the first positional arguments to these functions, as shown below.To upgrade, change this code
# DEPRECATED CODE from qiskit_addon_sqd.fermion import ( bitstring_matrix_to_sorted_addresses, solve_fermion, optimize_orbitals, ) bitstring_matrix = ... addresses = bitstring_matrix_to_sorted_addresses(bitstring_matrix, open_shell=open_shell) energy, coeffs, occs, spin = solve_fermion( addresses=addresses, hcore=hcore, eri=eri, ) ... e_oo, rotation, occs_oo = optimize_orbitals( addresses=addresses, hcore=hcore, eri=eri, ) ### SHOULD BECOME ### # NEW CODE from qiskit_addon_sqd.fermion import solve_fermion, optimize_orbitals bitstring_matrix = ... energy, coeffs, occs, spin = solve_fermion( bitstring_matrix, hcore=hcore, eri=eri, ) ... e_oo, rotation, occs_oo = optimize_orbitals( bitstring_matrix, hcore=hcore, eri=eri, )
Deprecation Notes
-
The
qiskit_addon_sqd.fermion.bitstring_matrix_to_sorted_addresses()function has been deprecated in favor ofqiskit_addon_sqd.fermion.bitstring_matrix_to_ci_strs(). These two functions behave the same with one key exception –qiskit_addon_sqd.fermion.bitstring_matrix_to_sorted_addresses()returns the configurations astuple(spin_dn, spin_up); whereas,qiskit_addon_sqd.fermion.bitstring_matrix_to_ci_strs()returns the configurations astuple(spin_up, spin_dn).To migrate
from qiskit_addon_sqd.fermion import ( bitstring_matrix_to_sorted_addresses, bitstring_matrix_to_ci_strs, ) # DEPRECATED CODE bs_matrix = ... addr_dn, addr_up = bitstring_matrix_to_sorted_addresses(bs_matrix, open_shell=True) ### SHOULD BECOME ### # NEW CODE bs_matrix = ... ci_strs_up, ci_strs_dn = bitstring_matrix_to_ci_strs(bs_matrix, open_shell=True) -
The
addressesargument toqiskit_addon_sqd.fermion.solve_fermion()andqiskit_addon_sqd.fermion.optimize_orbitals()has been deprecated in favor ofbitstring_matrix. Users are no longer required to convert their configurations to integers; instead, they should now pass in the bitstring matrix specifying the subspace onto which to project and diagonalize the Hamiltonian. The conversion to the integer representation of determinants will be done internally.
Bug Fixes
-
Fixed a bug in
qiskit_addon_sqd.configuration_recovery.recover_configurations()which would sometimes cause a divide-by-zero error when calculating individual bit-flip probability. -
Fixes a bug that caused configuration recovery to fail on bitstrings of length greater than 72.
0.5.0
Upgrade Notes
-
The
qiskit_addon_sqd.counts.generate_counts_bipartite_hamming(),qiskit_addon_sqd.subsampling.postselect_and_subsample(), andqiskit_addon_sqd.configuration_recovery.post_select_by_hamming_weight()now require thehamming_rightandhamming_leftarguments to be specified as keyword arguments. Additionally, thesamples_per_batchandn_batchesarguments toqiskit_addon_sqd.subsampling.postselect_and_subsample()should now be passed as keyword arguments.To upgrade
from qiskit_addon_sqd.configuration_recovery import post_select_by_hamming_weight from qiskit_addon_sqd.subsampling import postselect_and_subsample from qiskit_addon_sqd.counts import generate_counts_bipartite_hamming counts = generate_counts_bipartite_hamming(num_samples, num_bits, num_elec_a, num_elec_b) ... bs_mat = post_select_by_hamming_weight(bs_mat_full, num_elec_a, num_elec_b) ... batches = postselect_and_subsample( bs_mat, probs_arr, num_elec_a, num_elec_b, samples_per_batch, num_batches, )should be changed to
from qiskit_addon_sqd.configuration_recovery import post_select_by_hamming_weight from qiskit_addon_sqd.subsampling import postselect_and_subsample from qiskit_addon_sqd.counts import generate_counts_bipartite_hamming counts = generate_counts_bipartite_hamming(num_samples, num_bits, hamming_right=num_elec_a, hamming_left=num_elec_b) ... bs_mat = post_select_by_hamming_weight(bs_mat_full, hamming_right=num_elec_a, hamming_left=num_elec_b) ... batches = postselect_and_subsample( bs_mat, probs_arr, hamming_right=num_elec_a, hamming_left=num_elec_b, samples_per_batch=samples_per_batch, num_batches=num_batches, )
0.4.0
Prelude
This is a minor release which introduces a couple of small, but important, breaking changes to to the API. These changes allow for a more consistent pattern in specifying the number of alpha and beta electrons throughout both the chemistry and non-chemistry functions in the API.
Upgrade Notes
-
The
qiskit_addon_sqd.counts.generate_counts_bipartite_hamming(),qiskit_addon_sqd.subsampling.postselect_and_subsample(), andqiskit_addon_sqd.configuration_recovery.post_select_by_hamming_weight()now take thehamming_rightpositional argument before thehamming_leftargument to better match the rest of the workflow.To upgrade
from qiskit_addon_sqd.configuration_recovery import post_select_by_hamming_weight from qiskit_addon_sqd.subsampling import postselect_and_subsample from qiskit_addon_sqd.counts import generate_counts_bipartite_hamming counts = generate_counts_bipartite_hamming(num_samples, num_bits, num_elec_b, num_elec_a) ... bs_mat = post_select_by_hamming_weight(bs_mat_full, num_elec_b, num_elec_a) ... batches = postselect_and_subsample( bs_mat, probs_arr, num_elec_b, num_elec_a, samples_per_batch, n_batches, )should be changed to
from qiskit_addon_sqd.configuration_recovery import post_select_by_hamming_weight from qiskit_addon_sqd.subsampling import postselect_and_subsample from qiskit_addon_sqd.counts import generate_counts_bipartite_hamming counts = generate_counts_bipartite_hamming(num_samples, num_bits, num_elec_a, num_elec_b) bs_mat = post_select_by_hamming_weight(bs_mat_full, num_elec_a, num_elec_b) ... batches = postselect_and_subsample( bs_mat, probs_arr, num_elec_a, num_elec_b, samples_per_batch, n_batches, )