-
Notifications
You must be signed in to change notification settings - Fork 30
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
Staged controlled time #100
Conversation
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.
Great to see something thats not VQE !
A lot of changes requested here, as I believe that there are a number of old habits in this code (which is many months old, you have grown since then and we have figured out our guidelines more and stuff).
Nevertheless, before requesting a PR review, we should do a reasonable first pass (this took me 4 hours+ I think) as it is easier for the code owner to work through the obvious stuff.
I think it would be useful to talk about how useful evolving different terms in a qubit Hamiltonian is, and the best way to implement it.
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.
1-2 things that I did not see during the first review stand out.
A few minor things otherwise.
self.energies.append(new_energy) | ||
|
||
if abs(new_energy - self.final_energy) < self.min_de and self.iteration > 1: | ||
self.final_energy = new_energy |
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 are doing self.final_energy = new_energy
regardless of your conditional statement: just do it outside first. Clean, clear. You're making the reader (me) making a double take and squinting eyes to understand why you're doing something contrived and if i'm missing something. I believe that if your conditional statement is true, then the assignment is actually done twice in your current code.
The code snippet above is clearer to me, and the current code is unsatisfying... unless I'm missing something.
@@ -37,7 +37,7 @@ jobs: | |||
|
|||
- name: Install backends except qsharp/qdk | |||
run: | | |||
pip install qiskit | |||
pip install qiskit==0.33.1 |
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.
I suggest leaving a short comment here so that users & developers can understand / remember the reason we froze a version number (qiskit moves a lot). Users will wonder why too, or have errors because we're not forcing them to install a particular version number.
A great example: I do not remember why we have a restriction on cirq below. Do you, @JamesB-1qbit @AlexandreF-1qbit ? If yes, leave a comment, or relax this with a recent cirq (e.g cirq >= ....
). Even worse, cirq is installed automatically as a dependency of openfermion in setup.py
so there's a fair chance people who install Tangelo are not even running in the same conditions as our tests suite, and therefore it means we can't rely on this test suite to guarantee things work for our users. Whatever we do, this needs to be consistent.
Ideal case: we realize everything works without this constraint on cirq version number.
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 is a conversation that can happen independently of the PR if its actually non-trivial
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 is due to a failed test due to the new version of Qiskit-aer. I opened an issue on the qiskit-aer GitHub to explain what is happening or revert to the old behaviour.
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.
I am not aware for the cirq versioning. The new Qiskit-aer changed a bunch of things and we should look into it.
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.
Good job !
* Sphinx docs (#76) * Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81) * small fixes to allow initial density matrix for faster noisy sampling with cirq (#84) * Branding (Tangelo, Good Chemistry Company) (#87) * Name change: backendbuddy -> linq (#93) * added multi-controls multi-targets, extra gates (#88) * Add QMF and QCC capabilities and tests (#91) * JKMN mapping implementation (#95) * added inverse function to Circuit (#78) * added pycodestyle tests (#96) * Circuit methods (repetition operator, equality, trim and split methods) (#101) * Staged controlled time (#100) * Support for name attribute in Circuit class (#110) * Derandomized + Adaptive Classical Shadows (#111) * added vsqs ansatz (#109) * Staged richardson (#99) * Majorana pool for ADAPT (#114) * Copy gate data instead of referencing it when instantiation Circuit object (#118) * Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121) * Estimate QPU cost with QEMIST Cloud API. (#120) * Improvements for handling exp data with ClassicalShadow (#124) * Qulacs operator build changed to fix memory leak (#122) Co-authored-by: ValentinS4t1qbit <[email protected]> Co-authored-by: AlexandreF-1qbit <[email protected]> Co-authored-by: James Brown <[email protected]> Co-authored-by: JamesB-1qbit <[email protected]> Co-authored-by: MPCoons <[email protected]> Co-authored-by: elloyd-1qbit <[email protected]> Co-authored-by: KrzysztofB-1qbit <[email protected]> Co-authored-by: Rudi Plesch <[email protected]> Co-authored-by: GitHub Actions <[email protected]>
* v0.3.0 into main (#127) * Sphinx docs (#76) * Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81) * small fixes to allow initial density matrix for faster noisy sampling with cirq (#84) * Branding (Tangelo, Good Chemistry Company) (#87) * Name change: backendbuddy -> linq (#93) * added multi-controls multi-targets, extra gates (#88) * Add QMF and QCC capabilities and tests (#91) * JKMN mapping implementation (#95) * added inverse function to Circuit (#78) * added pycodestyle tests (#96) * Circuit methods (repetition operator, equality, trim and split methods) (#101) * Staged controlled time (#100) * Support for name attribute in Circuit class (#110) * Derandomized + Adaptive Classical Shadows (#111) * added vsqs ansatz (#109) * Staged richardson (#99) * Majorana pool for ADAPT (#114) * Copy gate data instead of referencing it when instantiation Circuit object (#118) * Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121) * Estimate QPU cost with QEMIST Cloud API. (#120) * Improvements for handling exp data with ClassicalShadow (#124) * Qulacs operator build changed to fix memory leak (#122) Co-authored-by: ValentinS4t1qbit <[email protected]> Co-authored-by: AlexandreF-1qbit <[email protected]> Co-authored-by: James Brown <[email protected]> Co-authored-by: JamesB-1qbit <[email protected]> Co-authored-by: MPCoons <[email protected]> Co-authored-by: elloyd-1qbit <[email protected]> Co-authored-by: KrzysztofB-1qbit <[email protected]> Co-authored-by: Rudi Plesch <[email protected]> Co-authored-by: GitHub Actions <[email protected]>
* Bump develop to v0.3.0 (#127) (#128) * v0.3.0 into main (#127) * Sphinx docs (#76) * Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81) * small fixes to allow initial density matrix for faster noisy sampling with cirq (#84) * Branding (Tangelo, Good Chemistry Company) (#87) * Name change: backendbuddy -> linq (#93) * added multi-controls multi-targets, extra gates (#88) * Add QMF and QCC capabilities and tests (#91) * JKMN mapping implementation (#95) * added inverse function to Circuit (#78) * added pycodestyle tests (#96) * Circuit methods (repetition operator, equality, trim and split methods) (#101) * Staged controlled time (#100) * Support for name attribute in Circuit class (#110) * Derandomized + Adaptive Classical Shadows (#111) * added vsqs ansatz (#109) * Staged richardson (#99) * Majorana pool for ADAPT (#114) * Copy gate data instead of referencing it when instantiation Circuit object (#118) * Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121) * Estimate QPU cost with QEMIST Cloud API. (#120) * Improvements for handling exp data with ClassicalShadow (#124) * Qulacs operator build changed to fix memory leak (#122) Co-authored-by: ValentinS4t1qbit <[email protected]> Co-authored-by: AlexandreF-1qbit <[email protected]> Co-authored-by: James Brown <[email protected]> Co-authored-by: JamesB-1qbit <[email protected]> Co-authored-by: MPCoons <[email protected]> Co-authored-by: elloyd-1qbit <[email protected]> Co-authored-by: KrzysztofB-1qbit <[email protected]> Co-authored-by: Rudi Plesch <[email protected]> Co-authored-by: GitHub Actions <[email protected]> * Recomputing MF when working with atom indices in DMET (#130) * Recomputing and testing MF when working with atom indexes. Change Localization import level. * More gates for openqasm translator (#129) * Added CZ, CY, CRz, CP, CSWAP and SWAP to openqasm translator * fixed return for return_phase=False in trotterize (#133) * fixed return for return_phase=False in trotterize * ONIOM problem reformulation (#119) * Updated ONIOM notebook use case * QubitHamiltonian get_operators bug (#131) * Fixed get_operators bug + added a test. * Measurement map (#134) * Measurement map + extending qwc partioning with repetition * Working state, cleaning is wip. * Givens gate (#135) * added givens gate decomposition Co-authored-by: ValentinS4t1qbit <[email protected]> * Notebook classical shadow (#123) Classical shadows notebook. It has been added to tests as well Co-authored-by: ValentinS4t1qbit <[email protected]> * added class to prepare or decompute an arbitrary statevector (#137) * Many small todos (#138) * Add an explanation how Circuit.reindex_qubits method is working. * ClassicalShadows.simulate only unique circuit (massive speedup). * Better management of backend options in VQESolver. * CS notebook update. * Comment fix for new return. * No need of n_electrons with ref_state==zero. * Change method for simulate (noisy?). * Diag coulomb (#136) * diagonalizing circuits implemented and tested * improvements to jkmn leaf->majorana selection (#139) * improvements to jkmn leaf->majorana selection * Use of get_vector function. * Change constructors -> classmethod. * Change interface + working state. * Stage where I have to write tests. * Test for HybridOperator and Z2 tapering. * Conformance tests + typos. * Moved file + typos. * Added tests for matrix manip. * Full path of load_operator in tests. * Permit all active orbitals partially occupied (#146) * ONIOM capping with chemical groups (#141) * Implementation for other chemical groups capping in ONIOM. Tests, docs. * uccgd ansatz (#144) * uccgd ansatz for use in SA-OO-VQE * First round + added spin=\=0 fix. * Support for symmetry, now call pyscf directly (#147) * call pyscf directly, symmetry now supported * Rotosolve implementation as an optimizer for parameterized circuits (#142) * rotosolve implementation and tests * ONIOM multisolvers (#143) * Multisolver support in ONIOM * Added others solvers to ONIOM, added tests and ROHF support (RHF->HF). * sa_vqe_solver from sa-oo-vqe branch * added import to __init__ * fixes for PR * clearer documentation * change statevector jkmn * replaced jkmn_prep_circuit with jkmn_prep_vector * Fixed error message. * Some reviews. * JKMN z2 tapering tests. * Docstrings in tests. * Speed improvement + bitwise operations + moved collapse function. * Passing conformance tests. * added state averaged orbital optimized files * merged molecule symmetry changes * Update test_hybridoperator.py aligning. * Hybrid -> Multiform. * Small fixes. * PR changes * support for reading in xyz files (#151) * support for reading in xyz files * Update z2_tapering.py * Update sa_oo_vqe_solver.py * Ilc ansatz (#132) * Add ILC ansatz class * updates to qmf, qcc, and ilc ansatz classes * enable QMF and ILC classes to read-in and process data from OpenFermion *.hdf5 files and other small fixes. Co-authored-by: ValentinS4t1qbit <[email protected]> * Updating information, and adding Windows install comment (#155) * Quantum deflation (#152) * added deflation * added ref_states as circuit and to VQESolver * added ref_state and deflation to adapt vqe Co-authored-by: ValentinS4t1qbit <[email protected]> * changed default basis to crenbl in pyscf, added ecp option (#156) * changed default basis to crenbl for pyscf to retrieve number of electrons & atoms, added ecp option * Cancel redundant gates (#153) * Functions / methods to remove small rotations, and remove gates that cancel each other * Circuit depth (#159) * Depth method for Circuit class * MI-FNO link (#157) * MI-FNO helper class. Added tests + reconstruction of MI energy, support for building sermonic operators for fragments * Iqcc solver (#154) * iQCC solver, frobenius norm compression method on QubitOperator Co-authored-by: ValentinS4t1qbit <[email protected]> * MIFNO notebook (#161) * MIFNO notebook. Added to tests and sphinx docs Co-authored-by: Valentin Senicourt <[email protected]> Co-authored-by: ValentinS4t1qbit <[email protected]> * Docs fix + tutorials removal from sphinx docs (#162) * Docs: requirements.txt no longer needed. Tutorials removed from generated docs (redundant with Github, issues with latex, looks better on github and will display images once repo is public Co-authored-by: AlexandreF-1qbit <[email protected]> * readme upgrade (#164) * readme upgrade and images, contributions.rst for code of conduct mention * Fixes for docs and readme, files for Pypi (#166) * Docs and readme fixed with feedback. Pypi file removed as it hinders the installation from source process: a guide will be provided to maintainer team for pypi update. Co-authored-by: AlexandreF-1qbit <[email protected]> * Version number and changelogs bumped Co-authored-by: AlexandreF-1qbit <[email protected]> Co-authored-by: James Brown <[email protected]> Co-authored-by: JamesB-1qbit <[email protected]> Co-authored-by: MPCoons <[email protected]> Co-authored-by: elloyd-1qbit <[email protected]> Co-authored-by: KrzysztofB-1qbit <[email protected]> Co-authored-by: Rudi Plesch <[email protected]> Co-authored-by: GitHub Actions <[email protected]>
* v0.3.0 into main (#127) * Sphinx docs (#76) * Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81) * small fixes to allow initial density matrix for faster noisy sampling with cirq (#84) * Branding (Tangelo, Good Chemistry Company) (#87) * Name change: backendbuddy -> linq (#93) * added multi-controls multi-targets, extra gates (#88) * Add QMF and QCC capabilities and tests (#91) * JKMN mapping implementation (#95) * added inverse function to Circuit (#78) * added pycodestyle tests (#96) * Circuit methods (repetition operator, equality, trim and split methods) (#101) * Staged controlled time (#100) * Support for name attribute in Circuit class (#110) * Derandomized + Adaptive Classical Shadows (#111) * added vsqs ansatz (#109) * Staged richardson (#99) * Majorana pool for ADAPT (#114) * Copy gate data instead of referencing it when instantiation Circuit object (#118) * Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121) * Estimate QPU cost with QEMIST Cloud API. (#120) * Improvements for handling exp data with ClassicalShadow (#124) * Qulacs operator build changed to fix memory leak (#122) Co-authored-by: ValentinS4t1qbit <[email protected]> Co-authored-by: AlexandreF-1qbit <[email protected]> Co-authored-by: James Brown <[email protected]> Co-authored-by: JamesB-1qbit <[email protected]> Co-authored-by: MPCoons <[email protected]> Co-authored-by: elloyd-1qbit <[email protected]> Co-authored-by: KrzysztofB-1qbit <[email protected]> Co-authored-by: Rudi Plesch <[email protected]> Co-authored-by: GitHub Actions <[email protected]> * Update _version.py * Update to release/v0.3.1 (#167) * Bump develop to v0.3.0 (#127) (#128) * v0.3.0 into main (#127) * Sphinx docs (#76) * Fixing CCSDSolver.get_rdm() with frozen orbitals and energy from RDMs (#81) * small fixes to allow initial density matrix for faster noisy sampling with cirq (#84) * Branding (Tangelo, Good Chemistry Company) (#87) * Name change: backendbuddy -> linq (#93) * added multi-controls multi-targets, extra gates (#88) * Add QMF and QCC capabilities and tests (#91) * JKMN mapping implementation (#95) * added inverse function to Circuit (#78) * added pycodestyle tests (#96) * Circuit methods (repetition operator, equality, trim and split methods) (#101) * Staged controlled time (#100) * Support for name attribute in Circuit class (#110) * Derandomized + Adaptive Classical Shadows (#111) * added vsqs ansatz (#109) * Staged richardson (#99) * Majorana pool for ADAPT (#114) * Copy gate data instead of referencing it when instantiation Circuit object (#118) * Fixed QEMIST Cloud QPU connection ctrl-c in job_result. (#121) * Estimate QPU cost with QEMIST Cloud API. (#120) * Improvements for handling exp data with ClassicalShadow (#124) * Qulacs operator build changed to fix memory leak (#122) Co-authored-by: ValentinS4t1qbit <[email protected]> Co-authored-by: AlexandreF-1qbit <[email protected]> Co-authored-by: James Brown <[email protected]> Co-authored-by: JamesB-1qbit <[email protected]> Co-authored-by: MPCoons <[email protected]> Co-authored-by: elloyd-1qbit <[email protected]> Co-authored-by: KrzysztofB-1qbit <[email protected]> Co-authored-by: Rudi Plesch <[email protected]> Co-authored-by: GitHub Actions <[email protected]> * Recomputing MF when working with atom indices in DMET (#130) * Recomputing and testing MF when working with atom indexes. Change Localization import level. * More gates for openqasm translator (#129) * Added CZ, CY, CRz, CP, CSWAP and SWAP to openqasm translator * fixed return for return_phase=False in trotterize (#133) * fixed return for return_phase=False in trotterize * ONIOM problem reformulation (#119) * Updated ONIOM notebook use case * QubitHamiltonian get_operators bug (#131) * Fixed get_operators bug + added a test. * Measurement map (#134) * Measurement map + extending qwc partioning with repetition * Working state, cleaning is wip. * Givens gate (#135) * added givens gate decomposition Co-authored-by: ValentinS4t1qbit <[email protected]> * Notebook classical shadow (#123) Classical shadows notebook. It has been added to tests as well Co-authored-by: ValentinS4t1qbit <[email protected]> * added class to prepare or decompute an arbitrary statevector (#137) * Many small todos (#138) * Add an explanation how Circuit.reindex_qubits method is working. * ClassicalShadows.simulate only unique circuit (massive speedup). * Better management of backend options in VQESolver. * CS notebook update. * Comment fix for new return. * No need of n_electrons with ref_state==zero. * Change method for simulate (noisy?). * Diag coulomb (#136) * diagonalizing circuits implemented and tested * improvements to jkmn leaf->majorana selection (#139) * improvements to jkmn leaf->majorana selection * Use of get_vector function. * Change constructors -> classmethod. * Change interface + working state. * Stage where I have to write tests. * Test for HybridOperator and Z2 tapering. * Conformance tests + typos. * Moved file + typos. * Added tests for matrix manip. * Full path of load_operator in tests. * Permit all active orbitals partially occupied (#146) * ONIOM capping with chemical groups (#141) * Implementation for other chemical groups capping in ONIOM. Tests, docs. * uccgd ansatz (#144) * uccgd ansatz for use in SA-OO-VQE * First round + added spin=\=0 fix. * Support for symmetry, now call pyscf directly (#147) * call pyscf directly, symmetry now supported * Rotosolve implementation as an optimizer for parameterized circuits (#142) * rotosolve implementation and tests * ONIOM multisolvers (#143) * Multisolver support in ONIOM * Added others solvers to ONIOM, added tests and ROHF support (RHF->HF). * sa_vqe_solver from sa-oo-vqe branch * added import to __init__ * fixes for PR * clearer documentation * change statevector jkmn * replaced jkmn_prep_circuit with jkmn_prep_vector * Fixed error message. * Some reviews. * JKMN z2 tapering tests. * Docstrings in tests. * Speed improvement + bitwise operations + moved collapse function. * Passing conformance tests. * added state averaged orbital optimized files * merged molecule symmetry changes * Update test_hybridoperator.py aligning. * Hybrid -> Multiform. * Small fixes. * PR changes * support for reading in xyz files (#151) * support for reading in xyz files * Update z2_tapering.py * Update sa_oo_vqe_solver.py * Ilc ansatz (#132) * Add ILC ansatz class * updates to qmf, qcc, and ilc ansatz classes * enable QMF and ILC classes to read-in and process data from OpenFermion *.hdf5 files and other small fixes. Co-authored-by: ValentinS4t1qbit <[email protected]> * Updating information, and adding Windows install comment (#155) * Quantum deflation (#152) * added deflation * added ref_states as circuit and to VQESolver * added ref_state and deflation to adapt vqe Co-authored-by: ValentinS4t1qbit <[email protected]> * changed default basis to crenbl in pyscf, added ecp option (#156) * changed default basis to crenbl for pyscf to retrieve number of electrons & atoms, added ecp option * Cancel redundant gates (#153) * Functions / methods to remove small rotations, and remove gates that cancel each other * Circuit depth (#159) * Depth method for Circuit class * MI-FNO link (#157) * MI-FNO helper class. Added tests + reconstruction of MI energy, support for building sermonic operators for fragments * Iqcc solver (#154) * iQCC solver, frobenius norm compression method on QubitOperator Co-authored-by: ValentinS4t1qbit <[email protected]> * MIFNO notebook (#161) * MIFNO notebook. Added to tests and sphinx docs Co-authored-by: Valentin Senicourt <[email protected]> Co-authored-by: ValentinS4t1qbit <[email protected]> * Docs fix + tutorials removal from sphinx docs (#162) * Docs: requirements.txt no longer needed. Tutorials removed from generated docs (redundant with Github, issues with latex, looks better on github and will display images once repo is public Co-authored-by: AlexandreF-1qbit <[email protected]> * readme upgrade (#164) * readme upgrade and images, contributions.rst for code of conduct mention * Fixes for docs and readme, files for Pypi (#166) * Docs and readme fixed with feedback. Pypi file removed as it hinders the installation from source process: a guide will be provided to maintainer team for pypi update. Co-authored-by: AlexandreF-1qbit <[email protected]> * Version number and changelogs bumped Co-authored-by: AlexandreF-1qbit <[email protected]> Co-authored-by: James Brown <[email protected]> Co-authored-by: JamesB-1qbit <[email protected]> Co-authored-by: MPCoons <[email protected]> Co-authored-by: elloyd-1qbit <[email protected]> Co-authored-by: KrzysztofB-1qbit <[email protected]> Co-authored-by: Rudi Plesch <[email protected]> Co-authored-by: GitHub Actions <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: AlexandreF-1qbit <[email protected]> Co-authored-by: James Brown <[email protected]> Co-authored-by: JamesB-1qbit <[email protected]> Co-authored-by: MPCoons <[email protected]> Co-authored-by: elloyd-1qbit <[email protected]> Co-authored-by: KrzysztofB-1qbit <[email protected]> Co-authored-by: Rudi Plesch <[email protected]> Co-authored-by: GitHub Actions <[email protected]>
This PR includes
If you want me to split it up, let me know. There are not many different files changed. Just a bunch of new code in a few files.