Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Operator Flow #852

Merged
merged 423 commits into from
Apr 27, 2020
Merged

Conversation

dongreenberg
Copy link
Contributor

@dongreenberg dongreenberg commented Mar 12, 2020

Implements the designs in https://github.com/Qiskit/rfcs/blob/master/0003-Aqua_0.7_operator_redesign.ipynb. The new framework is an open canvas. The flexibility, power, and physical formalism built into the new modules make development ridiculously fast - it took me about 15 minutes to rewrite QAOA and about 20 to implement parameterized operator coefficients - but also many opportunities to misstep in uncharted territories. The code is luckily quite easy to debug in a graphical debugger - stepping through the Operator flow to inspect each change to an Operator tree is trivial. However, there is a lot here, and it will take everyone time to get used to the model and structure.

We will need to iterate on these changes. The CircuitSamplers need to evolve. The lines of (im)mutability are not yet solid. Profiling will reveal what instantiation needs to be slimmed down.

VQE and QAOA have been ported over, and their tests pass as-is (sans one open question about the stddev calculation). There is still much to do (not all by release):

  • Port over NumPyEigensolver
  • IBMQCircuitSampler
  • Many typehints, docstrings, linting, and otherwise
  • Add back a solution for aux_ops
  • Integrate Native Circuits
  • Update docstrings

------------ Not blocking merge but need to be done ------------

  • CVaRMeasurement (based on https://github.com/stefan-woerner/cvar_quantum_optimization)
  • Port over (i)QPE
  • MatrixEvolution
  • MatrixToPauli converter
  • AerPauliExpectation parameterized qobj
  • Tutorial notebook
  • Compute covariance-aware estimator error ("stddev") for grouped paulis.
  • Binding parameters in StateFnCircuits and OpCircuits
  • Supporting and binding parameters in Operator coefficients

------------ Maybe next release ------------

  • Migrating Operator generating classes, e.g. translators, mappings, FermionicOperator+Tapering/Symmetries
  • Performance tests
  • More tests in general
  • Smart evolution over Abelian sums (https://arxiv.org/abs/2003.13599, Ewout already shared his code with me)
  • StateFnStabilizer and OpClifford - both huge opportunities
  • Update PauliOp to use Terra's SparsePauliOp

dongreenberg and others added 2 commits March 12, 2020 02:48
# Conflicts:
#	qiskit/aqua/algorithms/minimum_eigen_solvers/numpy_minimum_eigen_solver.py
#	qiskit/chemistry/algorithms/eigen_solvers/q_eom_ee.py
#	test/aqua/test_iqpe.py
@woodsp-ibm
Copy link
Member

Can we get the changelog updated to add some text for this addition prior to merging this

@dongreenberg
Copy link
Contributor Author

Ok - added to changelog and added DictToCircuitSum tests as well.

dongreenberg and others added 3 commits April 27, 2020 15:14
# Conflicts:
#	.pylintdict
#	CHANGELOG.md
#	qiskit/aqua/algorithms/eigen_solvers/numpy_eigen_solver.py
#	qiskit/aqua/algorithms/minimum_eigen_solvers/qaoa/qaoa.py
#	qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py
#	qiskit/aqua/algorithms/quantum_algorithm.py
#	qiskit/optimization/applications/ising/clique.py
#	test/optimization/test_tsp.py
#	test/optimization/test_vehicle_routing.py
@dongreenberg dongreenberg merged commit f3b552d into qiskit-community:master Apr 27, 2020
manoelmarques added a commit that referenced this pull request May 1, 2020
* Update parameter names

* fix spell and copyright year

* fix docstring method name

* Add target all_chack to makefile

* Update changelog for release 0.6.3 and change travis to check all lint, style etc errors before stopping

* update docstring

* Added time prints of VQE to the log

* compressed log lines

* Fix weighted_pauli_operator for Aer 0.4

Fixes change in the complex format of snapshot values in Aer 0.4 from a list [re, im] to a type complex.

* fix copyright year

* Add refs from former docs to AQGD

* Add names to custom dict for spelling

* Add logging methods to all domains

* add aqua logging unit test

* Additional driver unit testing

* Fix spelling and method

* Fix lint

* Need to skip in case of missing qcmatrixio

* Add chemistry unit test logging

* Need to skip in case of missing qcmatrixio

* Add aer existence check in unit test method

* Use new partial_trace method

* check pyscf existence

* check pyscf existence

* fix deprecated method

* Clean up code to reduce duplication

* Fix spelling in docs

* Test QMolecule save logic

* Gaussian MacOS Python 3.8 driver

* Add Linux Gaussian drivers

* Add Windows Gaussian driver for python 3.8

* change travis to install libgfortran for chemistry

* Change Travis Aer build

* Add Comments

* minor changes in qGAN comments

* comments

* Fix copyright year and docstrings

* Change docstring

* Update algorithm docs

* Cleanup travis config

This commit makes a few small changes to simplify the travis
configuration. The first thing it does is decouple the pypi upload job
from the common test setup config. There is no reason to build aer and
terra from source or install all the dependencies explicitly as part of
the release workflow. Building and sdist and wheel will take care of any
dependencies that need to be installed as part of the build process, run
time dependencies are not needed. Then it changes the pypi job version
to 3.7 while it's being modified just so we don't have to worry about it
later when 3.6 goes EoL in 2021. The last thing done here is that with
the release of stestr 2.6.0 in Decemeber the workaround for
mtreinish/stestr#266 is no longer needed
because the issue has been fixed.

* Update changelog for 0.6.4, add tests in sdist

* Change PyQuante install in travis

* Update algorithm docs

* Update algorithm docs

* Update algorithm docs

* Update algorithm docs

* Update algorithm docs

* Update algorithm docs

* Fix spelling

* Update documentation for components

* Update documentation for eigs components

* Update documentation for feature map components

* Update documentation for feature map components

* Update documentation for initial state components

* Update documentation for initial state components

* Update documentation for iqft and qft components

* Update documentation for multiclass extension components

* Update documentation for neural network components

* Update documentation for local optimizer components

* Update documentation for local optimizer components

* Update documentation for global optimizer components

* Update documentation for global optimizer components

* Update documentation for oracle components

* Update documentation for oracle components

* Update documentation for reciprocal components

* Update documentation for uncertainty models, problems components

* Update documentation for variational form components

* Update documentation for variational form components

* fix boolean logic circuit construction; add a test case

* Fix copyright

* Minor doc updates

* improve handling of logical expr optimization

* remove stale import

* Refactor Multiclass Extensions to set Estimator internally

* fix copyright

* Add PR number to changelog

* modified type hint in docathon

* Replace parameterized library with ddt

* fixed finance ddt unit test

* Check result status to indicate better failure reason

* Fix copyright date

* Pass num.processes to parallel_map call

* Update the heading of the landing API docs page

* algorithms refactoring

* fix lint and copyright

* fix document name

* change algorithm file names

* remove mct, mcu1 and mcr[x,y,z], they moved to Terra

* Update copyright year of boolean_logic_gates

* Rename the landing page to aqua.rst

Since there was a conflict with the names, other file names where also updated

* Change to aqua in docs/index.rst

* update changelog, remove tests

* add PR number to changelog

* Eigen Solver results classes

* Add minimum eigen solver interface

* Update CME and change eigenstate to plural in CE

* Add VQResult to VQAlgorithm and return that instead of dict

* Add MinimumEigensolver imports

* Use properties since they exist

* Add combine method to algo results

* Initial VQE change to MinEigSolver and reuse

* fix spell and lint

* ensure the measurement is the final operation in IQAE

* Update QAOA

* Add result classes to QPE and IQPE

* add safeguard barriers in AE and MLAE

* fix copyright year in one file

* Remove travis copyright check for now

* Enable copyright last year check on travis

* change changelog text

* Add CODEOWNERS

* More vqe tests around reuse

* More vqe tests around reuse

* Fix aux_ops return

* Initial ground state energy application

* Initial ground state energy application

* Update coverage job to use coverage3

* Rename IQPE/QPE

* fix VQEAdaptResult property

* fix copyright

* Refactor classes and file names from classical to numpy

* fix readme and readme unit tests

* fix readme

* Change Quantum Instance docstring for TensorMeasFitter

* Fix spelling

* FCIDump Driver (#859)

* Implement FCIDumpDriver

The FCIDumpDriver provides the means to construct a QMolecule instance
out of a FCIDump file.
It is split into three parts:
  - the `driver` itself which provides the normal run() method
  - a separate `parser` implementation which handles FCIDump reading
  - an additional `dumper` implementation which allows FCIDump writing

* Add FCIDumpDriver unittests

* Fix typo and remove from pylintdict

* Fix copyright year

* Fix copyright year - part 2

* Finally, make copyright correct.

The copyright should include:
  <year of file creation>, <year of last modification>
In the case were these are the same, it is sufficient to state it once.

* Refactor FCIDump parsing unittests

Instead of relying on a hard-coded RHF and UHF testcase for H2, we are
now testing against the FCIDump files for H2, LiH and OH.
For the latter two cases the numpy reference arrays are provided as
compressed archive files.

* Store inactive energy in nuclear repulsion energy instead of HF energy.

* Add FCIDumpDriver unittest for stack integration

* Check for num_atoms in QMolecule.core_orbitals()

In the example of a `freeze_core` Hamiltonian this method is called to
return the list of core orbitals.
When working with the FCIDumpDriver it may be the case that `num_atoms`
is not set. Thus, we check for this case and return in empty list
instead.

Unittests have been added which assert that a warning is logged.

* Add optional num_particles argument

Allow the user to manually specify the number of particles.

* Add optional atoms argument

Allow the user to manually specify the molecule information.
This permits frozen core Hamiltonians to be created from
FCIDumpDriver-generated QMolecule instances.

* Update FCIDumpDriver unittest documentation

* Add MS2, ISYM and ORBSYM optional arguments

* Add unittest for dumping RHF H2 QMolecule instance

* Use MS2 (spin quantum number) properly

Instead of the optional `num_particles` spin quantum number from the
FCIDump (MS2) can be used. This gives the multiplicity directly.

* Update copyright

* Ignore possible MO energy values

This will prevent the parsing from failing if the MO energies are in
fact present.

* Remove too specific pylintdict exceptions

* Improve error messages

* Minor code improvements

* Fix docstrings and type hints.

* Ensure QMolecule.log() works with FCIDumpDriver

Also adds unittests.

* Use typing types instead of builtins

* Fix typo

* Remove Optional type hint where not applicable

* Raise error if required field is missing in FCIDump

* Revert to None as default and check in QMolecule.log()

* Update changelog with 0.6.5 release, remove cvxopt from install (#863)

* Update changelog with 0.6.5 release, remove cvxopt from install

* add cvxopt install to travis

* Fix Travis clone history for copyright check (#864)

* Return Ground State Energy result in Chemistry to replace (lines, dict) (#861)

* Add ground state result for chemistry to replace old dict.

* Update test to use new result object

* Add test for deprecated process algorithm result

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* supporting measurement error mitigation on the same set of qubits but with different orders (#865)

* support diff qubit order in error mitigation, transform the calibration matrix if order is different.

* add test

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Update CONTRIBUTING.md (#866)

* Update CONTRIBUTING file

* Remove old issue template (#867)

* Update tox.ini (#868)

* Chemistry auto Z2 symmetry reduction support (#870)

* Automatic Z2Symmetry reduction support

* Automatic Z2Symmetry reduction support

* Update changelog (#871)

* Add NFT optimizer (#729)

* add NFT optimizer

* Add specific unit test for NFT

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>

* Minor test name change for consistency (#873)

* Add QuantumInstance/Backend to algorithm init (#874)

* Add QuantumInstance/Backend to algorithm init

* make pylintrc the same as terra's

* Add pip check job to travis config (#876)

* Add pip check job to travis config

The new pip depsolver is coming this summer. [1] Until it's ready
this starts running pip check as part of our CI test jobs to make
sure we're not somehow installing conflicting package versions. We
shouldn't be, but if we are better to know and start
preparing/fixing it now.

[1] https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html

* fix job dependency inheritance

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* An Ising Optimization algorithm for solving the 0-1 Knapsack Problem (#878)

* Add the 0-1 Knapsack Problem

* Fix Pauli.numberofqubits deprecation (#881)

* Fix Pauli.numberofqubits deprecation

* Remove backend and PassManager on compiler transpile calls (#882)

* Remove transpile calls and use unroller (#883)

* Show combined deprecation warnings on travis (#886)

* Show combined deprecation warnings on travis

* fix docstring identation

* restrict Sphinx version to < 3.0

* Update config to allow latest Sphinx version (#888)

* Fixed #750 for the DOcplex translator (#887)

* fixed #750 for the DOcplex translator

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* correct travis pipe logic (#889)

* Fix to WeightedPauliOperator (#891)

* Improve the text of an error message in weighted_pauli_operator.py (#892)

* Improve the text of the error message

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Add doctest to travis (#894)

* Add doctest to travis

* Adapt to using the circuit arithmetics library (#895)

* convert comparator to circuit

* move first arithmetic circuits to terra

- fixed value comparator
- linear rotation
- polynomial rotation

* refactor pw linrot and weighted sum op

* fix wrong num of qubits

if ther ancilla register is too long it must be truncated to the required number of ancillas, otherwise circuit.append complains

* name args

* fix renamings to PauliRotations

* fix renaming to integer_comparator

* fix case of too many ancillas

* fix copyright

* add deprecation warning filters on tests

* add note to changelog

* gci to use circuit lib

* european call delta to use circ lib

* pwl objective to use circuit lib + fix lint

* european call to use circuit lib + fix lint

* add rangle and mapsto to pylintdict

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Notify by email when travis fails merge/cron builds (#898)

* Update algorithms docs for Aqua (#900)

* Update algorithm docs for new categories

* Add custom words

* Remove the boolean logic gates (#896)

* deprecate  boolean logic gates

* fix mcmt import

the test relied on the implicit import of mcmt via FixedValueComparator

* add changelog

* completely remove and/or from gates

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Update chemistry documentation (#903)

* Update chemistry documentation

* Include release 0.6.6 on changelog (#904)

* Change conversion from array of strings to array of booleans for numpy 1.18.3 (#907)

* Change conversion from array of strings to array of booleans for numpy 1.18.3

* Wait for previous jobs if limit is reached (#906)

* pace job submit

* spelling

* changelog

* add PR number

* Use the circuit library's QFT (#909)

* use QFT from circuit lib

* make algos accept circuits + QFTs

* deprecate QFT circ and components

* allow QFT to be passed as circuit

* add deprecation warnings if QFT component used

* fix missing import

* fix cyclic import

* remove todos, fixed in Qiskit/qiskit#4209

* filter deprecations warnings from QFT

* add checks on qft size

* only filter warnings locally

* re-enable tests in tearDown to be sure

* Uncertainty models using circuits (#908)

* make variational UMs accept circuits

* test circuit variants

* add deprecation warnings if varform is passed

* fix typo Uni -> Multi

* fix warning filters

* filter deprecation warnings on univ. var. dist

* only filter warnings locally

* Native circuits (#905)

* make compatible with current Terra

means no num_parameters keyword

* use circuit params as var_form_params

and prepare VQC for circuits

* make VQC work with circuits

* overwrite varform params on setter

* move patching to setter

* more tests, don't allow no parameters

if the varform has no parameters it breaks VQE since we divide by the number of parameters

* update docstrings

* add warning if feature dim is 0

* add test for feature dim = 0

* fix unused variable

* use params provided in circuit don't reassign

* begin adding circuit to qsvm

* num_parameters is now circuit attribute

* adjust to new circuit methods

num_parameters and assign_parameters is now available in the circuit base class

* run tests for varform and QC

* remove unused imports

* add VQC tests for circuits

* make QSVM run on circuits

* sort parameters in wine test for reproducibility

* adress Steve's comments

* add changelog, obey PEP and dont use `None or ..`

* remove the op+varform check to construct_circuit

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: Donny Greenberg <dongreenberg2@gmail.com>

* Append pauli.to_instruction to circuit (#914)

* Append pauli.to_instruction to circuit

* prevent travis from installing requirements.txt

* TPBGroupedWeightedPauliOperator multiplication fix (#915)

* Fix TPBGrouped operator multiplication

* Use qiskit.circuit.library AND/OR instead of QuantumCircuit (#917)

* Use qiskit.circuit.library AND/OR instead of QuantumCircuit

* Qiskit Optimization (#877)

* implement first part of steve's comments

* skip some unnecessary varform checks

* Revert "skip some unnecessary varform checks"

* rename OptimizationProblem with QuadraticProgram

* test cplex installation

* fixed decode func for continuous variables

* fixed format and added docstrings for the test

* fix some codes after merge of upstream

* change None for not impl error

* is_compatible returns bool and raises

* adding support for quadratic constraints

* fixing imports

* rename OptimizationProblem with QuadraticProgram in test_converters

* commenting out quad constraints support

* fix typos, add references

* is_compatible for bool, get_incomptability for msg

* incompatibility in admm / cplex optimizer

* rename to compatibility_msg

* == not >

* update cplex optimizer

* update cplex display settings

* update recursive min optimizer docstring

examples should be in class level, not module level
fix class level docstring in general

* (Re)move utils (#67)

* reorganize utils

* add missing init

* fix import in test

* (Re)move results  (#68)

* move results to algo files

* remove solution/qualitymetrics for now

they are safely stored on another branch but are currently not used so there is no reason to have them in this release

* move the results objects to algorithms

* update quadratic program, linear expression, linear constraint, variable and tests

* add quadratic_expression

* add quadratic constraint and tests

* add quadratic objective

* Update quadratic_program.py

* add linear_constraint

* revise constraints

* fix tests and avoid cyclic import

* fix default quadratic constraint name

* Update test_quadratic_program.py

* moving to a new optimization stack

* update constraints handling

* Update constraint.py

* moving to a new optimization stack

* add __getitem__() to linear and quadratic expressions

* make constants upper case

* (wip) substitute_variables

* Alpha version of substitute_variables

Also moved name arg of linear_constraint and quadratic_constraint in the last

* moving to a new optimization stack

* rename "coefficients_as_dict/array" to "to_dict/array" in linear/quadratic expressions

* add read/write functionality to QP

* Update quadratic_program.py

* update cplex_optimizer and tests

* Update quadratic_program.py

* merge grover_optimizer updates

* moving to a new optimization stack

* cleanup

* add a test of substitute_variables

* replace use_index with use_name

* allow integer as lower bound and upper bound of variable

* change qp as well

* update int to bin converter to use new QP interface

* rename converters without "converter" in name

* update qubo to operator + some minor fixes

* moving to a new optimization stack

* ignore trivial constraints (0 == 0) when converting to docplex

* moving to a new optimization stack

* Update quadratic_program.py

* Update quadratic_program_to_qubo.py

* moving to a new optimization stack

* poc

* modified InequalityToEquality converter for new QuadraticProgram APIs

* Fix issues in integer_to_binary

* bug fixes

* removed importing cplex and fixied linting

* update QP and tests

* add __setitem__ to linear/quadratic expression

* update recursive minimum eigen optimizer

* removing 2* from quad objective

* moving to a new optimization stack

* removing 2* from quad objective

* fix in step2

* fix in get_obj_val

* fix in get_obj_val

* fix in get_obj_val

* Use compressed dictionary as the internal of quadratic expression

* minor

* Update optimization_algorithm.py

* fix a type hint

* moving to a new optimization stack

* moving to a new optimization stack

* use the internal Status directly

* linting

* rename penalize equality constraints converter

* converter bug fixes

* minor re-writing get_bet_merit_solution

* minor re-writing get_bet_merit_solution

* Fix unit tests related to quadratic expressions

* Fix the declaration of __init__.py

* Small fixes for pylint

* moving to 'evaluate' in objective cost and constraints

* added operator_to_quadratic_probram for new QP APIs

* Current GroverOptimizer Code, New QP Interface WIP

* GroverOptimizer Uses New QP Interface

* added unittests

* Add more tests of QuadraticProgram

* Update test_quadratic_program_to_negative_value_oracle.py

* formatting, renaming, minor changes

* Update grover_optimizer.py

* Add a missing sample LP file for test_quadratic_program

* small fix of parsing problem name of LP file

* fix a typo

* only test based on exact solver (other redundant)

* fix random seeds

* add remove linear/quadratic constraints

* remove util.py

* Update quadratic_program_to_qubo.py

* fix a factor

* Bump Terra version requirements to 0.14.0

* fix var_form initialization

* check cplex installed on unit tests

* step2 generation based on a copy

* step2 generation based on a copy

* step2 generation based on a copy

* formatting, renaming, minor changes

* fixing converters / compatibility checks of algorithms

* clean grover code (remove debugging lines)

* fix IQFT and random seeds

* Update test_quadratic_program_to_negative_value_oracle.py

* Update operator_to_quadratic_program.py

* Add QuadraticProgram.Status to replace SubstitutionStatus

* add a test of status for clear

* Embed enum data in classes

* minor

* tune

* enable type hint of enums

* supporting equality and quadratic constraints

* more simplifications

* admm tests on  equality and quadratic constraints

* fixes and more testing

* deal with from_docplex corner cases

* more simplifications, linting

* Update quadratic_program.py

use `model.iter_{linear, quadratic}_constraints()` instead of `model.get_constraint_by_index(i)`, since the latter calls CPLEX which is not available in Python 3.8.

* easy part of steve's comments

* part 2 of steve's comments

* add comments

* fix problem with int2bin converter

* enabled int2bin converter

* update problems __init__.py docstring

* rename `HasQuadraticProgram` to `QuadraticProgramElement`

* rename `HasQuadraticProgram` to `QuadraticProgramElement` (2)

* module level docstrings, offset test

* fix spell & test

* leftover fixes

* update changelog and ADMM docstring

* fix write to dir, use new tempfile functionality

* fix docstring

* add changelog

* remove Grover Optimization changelog

* trigger CLA check

* fix qasm string on unit tests

Co-authored-by: Cryoris <jules.gacon@googlemail.com>
Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: Takashi Imamichi <t.imamichi@gmail.com>
Co-authored-by: Anton Dekusar <adekusar@ie.ibm.com>
Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Co-authored-by: Atsushi Matsuo <MATSUOA@jp.ibm.com>
Co-authored-by: Austin Gilliam <austin.gilliam777@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Claudio Gambella <claudio.gambella1@ie.ibm.com>
Co-authored-by: adekusar-drl <62334182+adekusar-drl@users.noreply.github.com>

* Operator Flow (#852)

* Add abelian property to opvecs and AbelianGrouper to operator init.

* Break up PauliCoB big clifford synthesis function into smaller ones.

* Add AbelianGrouper test.

* Add better input checking in primitives and remove unnecessary print.

* Fix coeffs bugs in pauli_cob.py.

* Reorganize pauli_cob. All tests pass, with grouping on and off.

* Change expectation_value backends to work through setters.

* Reorganize local_simulator_sampler.py a bit to use it in a test.

* Grouping Paulis works!! All tests pass.

* Add "compute TPB pauli" function to pauli_cob.

* Add WIP attempt at evolution over Abelian paulis.

* Fix trotter bug.

* Fix some other Trotter bugs.

* Add parameters to OpPaulis and test. Parameterized evolution passes!!!

* Add parameter binding for Op coefficients.

* Add parameter binding, and binding tests. Tests pass.

* Add division to Operators to make normalization convenient.

* Finish merging MinEigenSolver PR. All tests pass.

* Update QAOA, all tests pass!!

* Update some QAOA imports and typehints.

* Add QDrift trotterization method. All tests pass.

* Start migrating QPE, tests fail.

* fix spell

* fix almost all style errors

* fix copyright

* fix import cycles, changed to relative imports when possible

* relative imports

* Add bind_params to state_fn_circuit.py and op_circuit.py, and tests. Add list unrolling for param binding, and tests. Tests pass.

* Add param list handling for all Op types.

* Make OpVec printing nicer.

* Add op_converter to imports for better backwards compatibility.

* Add AerPauliExpectation tests. Tests pass. Issue with Aer though.

* Fix a few AerPauliExpectation bugs

* Start building toward parameterized Qobj.

* fix some lint errors

* fix some lint errors

* fix style

* fix copyright

* set style to defaults, fix aqua unit test loading

* change loading tests qpe/iqpe

* Fix OpPrimitive lint errors.

* Fix operator_base.py lint errors.

* Fix state_fn.py lint errors.

* Fix OpVec lint errors.

* Fix state_fn_circuit.py lint errors.

* Fix state_fn_dict.py lint errors.

* Fix state_fn_operator.py lint errors.

* Fix state_fn_vector.py lint errors. Tests pass.

* Fix QDrift test to deal with first Op in trotterization list being OpCircuit.

* Fix op_circuit.py lint errors.

* Fix op_pauli.py lint errors.

* Fix op_composition.py lint errors.

* Fix op_kron.py lint errors.

* Fix abelian_grouper.py lint errors. Tests pass.

* Fix pauli_cob.py lint errors. Tests pass.

* Fix Expectation lint errors. Tests pass.

* Fix circuit sampler lint errors. Tests pass.

* Fix other expectation lint errors. Tests pass.

* Fix trotterization lint errors. Tests pass.

* Add MatrixEvolution shell, fix evolution lint errors.

* Fix bug in evolution tests after fixing lint errors.

* Fix cyclic import for lint.

* fix pylint cyclic import error

* Make tests pass. Add aux_ops back to VQE, and make VQE and QAOA take old or new ops.

* fix spell and lint

* Fix swapping issue in evolution.

* Fix composition in OpEvolution.

* Fix add OpSum and kron OpKron in OpEvolution.

* Add to_opflow to legacy base_operator

* Clean OpCircuit and StateFnCircuit __str__

* Fix qaoa mixer.

* fix spell,style

* Ok now really all tests pass.

* add to_matrix_op() methods to ops.

* Start migrating NumpyEigensolver for Opflow

* Start removing back from op_primitive eval functions. All tests pass.

* Update eval logic (to be able to remove back) for operator_combos.

* Add to_matrix_op for OpMatrix and StateFnVector, and change some `if back`s to `if back is not None`

* Finish decoupling back args from evals. All tests pass.

* Remove back from eval logic.

* Remove back from eval. All tests pass.

* Change matrix_expectation.py to rely on to_matrix_op.

* Migrate numpy_eigen_solver.py and numpy_minimum_eigen_solver.

* Remove ToMatrixOp converter.

* set VQE _auto_conversion to False for now

* Add sampling and tests. Fix a rounding error in a test. Fix a not none error in numpy_eigen_solver.py.

* Add array methods to OpVec. Fix typo in OpPauli. Allow reverse_endianness in to_opflow for WeightedPauli.

* Make NumpyEigensolver return a StateFn in result.eigenstate.

* Fix flaky optimization tests. Fix OpVec so iterator interface works.

* Fix StateFnVector sampling. Fix sparse NumpyEigensolution. Fix some aux_op stuff. Fix some other things here and there. Please no more breakage.

* Change some sparsity stuff.

* fix spelling

* Typehints.

* More typehints

* fix copyright

* fix spelling

* More typehints, make globals immutable.

* fix style

* Rearrange tests, Add CZ to globals.

* Refactor some names.

* Rename OpEvolution to EvolutionOp. Tests pass.

* Rename primitive ops. All tests pass.

* Finish renamings.

* Test IBMQ Pauli expectation. All tests pass.

* Update spelling.

* Update Pauli to num_qubits.

* Updating some naming.

* Add diag support to fix knapsack issue.

* fix unit test

* fix unit test

* fix travis

* Turn half of Steve's comments.

* Fix some exponentiation things.

* Fix some exponentiation things.

* Add trotterization_factory. All tests pass.

* Add evolution_factory. All tests pass.

* Add circuit_sampler_factory. All tests pass.

* Rename get_primitives to primitive_strings. Turn some of Julien's changes.

* Only allow sample_circuits to accept circuit_ops. Tests pass.

* Turn more review changes

* fix spell, style

* Add matrix_op exp_i() into HamiltonianGate. Tests fail due to CircuitOp decompose() during composition. If commented out (line 158) tests pass.

* Change CircuitOp and StateFnCircuit to rely on QuantumCircuit instead of Instruction. All tests pass. Add to_circuit_op to relevant ops. Solves all the decompose issues.

* Add matrix_evolution and update QAOA to test matrix_op for cost operator. Add logic to update UCCSD to operator flow. Tests pass.

* Delete PauliToInstruction, as it's obsolete.

* Add to_pauli_op and tests. Tests pass.

* Fix composed_op.py eval bug

* Add sig digit rounding. VQE tests fail.

* better precision for sig digit rounding. Tests pass.

* Fix pep8, add comment

* Add to_circuit_op to statefns, making DictToCircuit mostly obsolete. Tests pass.

* fix cyclic imports

* fix numpy boolean to string coercion

* Update repr and a docstring.

* Make ExpectationValues into converters. Test pass.

* Fix bug from merge.

* Fix bugs, make Minus just a CircuitStateFn and not a ComposedOp.

* Uncomment HamiltonianGate

* Update lots of docstrings part I. Tests pass.

* fix docstring

* More docstrings. Change class.rst so docs are generated for some python operator overloads.

* Add navigation structure for docs to init files

* More docs.

* fix doctrings

* 1) Change local_simulator_sampler.py to circuit_sampler.py
2) Set up circuit_samplers directory to be removed.
3) Add IBMQ VQE test.
4) Change AerPauliExpectation and CircuitSampler to handle expval_measurement/snapshots correctly.

Tests pass.

* 1) Delete circuit_samplers.
2) Allow CircuitSampler to attach_results.

* Update Operator init

* Change Operator directory names. Tests pass.

* fix spell, docs

* Turn Expectations purely into converters. Tests pass.

* fix docs

* skip IBMQ test

* Add Converters docs. Tests pass.

* fix spell

* Add Evolutions docs. Tests pass.

* Add Expectation docs. Tests pass.

* fix spell

* Add StateFn docs. Tests pass.

* Fix typo.

* Add ListOp init docs.

* Fix some ordering

* Little docs edits.

* fix spell

* Little docs edits.

* 1) Add to_legacy_op to OperatorBase to allow non-migrated algos to accept new Operators.
2) Allow QPE and iQPE to accept new Operators, migrate tests. Tests pass.

* Fix typehints for minimum_eigen_solvers

* Make sure expectations can handle mixed observables.

* fix spell

* Turn some more of Steve's comments. Tests pass.

* Turn some more of Steve's comments. Fix a buncha parameter stuff, and make sure mixed Pauli evolution works.

* Turn some more of Steve's comments. Tests pass.

* Turn some comments, fix a QAOA bug.

* Try collapsing ListOp to_matrix a bit.

* Turn more comments, fix some bugs.

* Turn more comments, fix some bugs.

* Update ListOp docs.

* Update ListOp docs.

* Update ListOp docs.

* fix docstring

* Update minimum_eigen_solvers setter typehints.

* Add Changelog and tests for DictToCircuitSum.

* Update VQE's construct_circuit and some changelog elements.

* fix spell

* Allow MinEigenOptimizer to accept StateFn result in result.eigenstate.

* fix style

* Update changelog with more detail. Update VQE to call super.

* Typo

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>

* use path.join for better compatibility with windows (#919)

* Performance improvements for opflow (#925)

* Performance improvements:
1) Make CircuitOp composition depend on combine
2) Make cache check in CircuitSampler check id(), not deep equality
3) Make to_circuit with measurement copy and measure, rather than insert into new circuit as instruction.

* 1) Fix bug causing CircuitSampler to retranspile over and over.
2) Throw an error if QuantumCircuit with classical bits passed into CircuitStateFn or CircuitOp.

* Move ClassicalRegister import.

* fix IBMQ unit test imports

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Import standard gates from new location (#924)

* import standard gates from new location

* local import for IBMQ

* Fix statevector deprecation warning. (#930)

* Update Shor to use the circuit library's QFT (#932)

* shor uses cirlib qft

* fix num qubit setting

* add changelog on QFT

* Update Optimization documentation (#922)

* Update Optimization documentation

* fix import cycles

* add imports to code examples

* Update docs

* Fix spelling

* Non functional examples to code block

* fix import cycle on IntegerToBinary

* fix code test

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Naming of QPE and IQPE (#931)

* revert to qpe/iqpe as algo names

* fix spell

Co-authored-by: Donny Greenberg <dongreenberg2@gmail.com>
Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Fix QFT deprecations in HHL test (#934)

* improve IQFT depr warnings, add filters

* fix style

* renaming for IsingToQuadraticProgram and QuadraticProgramToIsing (#936)

Co-authored-by: Julien Gacon <jules.gacon@googlemail.com>

* Fix Change Operator Size in QAOA (#929)

* Fix #928

* trigger CLA check

* Really fix.

* Add test for changing Operator size.

* Fix style

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: Julien Gacon <jules.gacon@googlemail.com>

* Install PySCF for all but Windows (#937)

* Native circuit library (#920)

* remove param comparison

* make ry/ryrz use circlib

* Revert "make ry/ryrz use circlib"

This reverts commit b6d9801.

* deprecate feature maps and varforms (where possible)

* remove swaprz import

* add tests for VQE

* un-deprecate RawFeatureMap / FeatureMap

* test qsvm on circlib

* qsvm to use circlib circuit

* vqe2iqpe test on circuit and lib

* test vqc on circlib

* fix leftover deprecations

* test vqe on circlib and filter warnings

* qoem on circuits, add param dict to results

* use cirlib for tests, fix deprecation warnings

* unused import

* var form based to accept circuits

* num parameters check in varform setter

* update pylint dict, add Zoufal, rm not used ones

* fix deprecated arg: reps instead of depth

* fix spell

* num params check in energy_eval

* data_encoding -> data_preparation

* fix deprecation warnings, remove test_ry as redundant

* move IBMQ to local import?

* update to new circlib names

* update leftover tests to new names

* add changelog note

* fix last 2 deprecation warnings

* update deprecation warnings in feature_map

* fix Äquivalenzverbot typo

* steve's comments

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Naming: "module" over "Qiskit Stack" (#935)

* use Qiskit module over application stack

* update readme

* chem renamings

* finance renamings

* ML renamings

* fix title line length

* Apply suggestions from code review

* found some more "stack"s

* fix copyright

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* HartreeFock and UCCSD num qubit param removal. (#939)

* Update Finance and ML docs (#938)

* Update to Finance and ML docs

* fix copyright

* Fix dead links

Co-authored-by: Manoel Marques <manoel@us.ibm.com>

* Fix .add dep warning. (#940)

* fix conflict

* Qiskit Aqua Release 0.7.0

* fix travis

* fix travis

* add numpy update to chemistry travis

Co-authored-by: Richard Young <richard.young2@ibm.com>
Co-authored-by: Cryoris <jules.gacon@googlemail.com>
Co-authored-by: Donny Greenberg <dongreenberg2@gmail.com>
Co-authored-by: yaelbh <yaelbh@il.ibm.com>
Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: Christopher Wood <cjwood@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
Co-authored-by: Richard Young <richard.young00@gmail.com>
Co-authored-by: CZ <ouf@zurich.ibm.com>
Co-authored-by: Zoufalc <40824883+Zoufalc@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Shaohan Hu <shaohan.hu@ibm.com>
Co-authored-by: Atsushi Matsuo <MATSUOA@jp.ibm.com>
Co-authored-by: SooluThomas <soolu.elto@gmail.com>
Co-authored-by: Max Rossmannek <oss@zurich.ibm.com>
Co-authored-by: Richard Chen <chunfuchen@users.noreply.github.com>
Co-authored-by: Ken Nakanishi <ikyhn1.ken.n@gmail.com>
Co-authored-by: Sorin Bolos <sorin.bolos@uipath.com>
Co-authored-by: a-matsuo <47442626+a-matsuo@users.noreply.github.com>
Co-authored-by: Hayk Sargsyan <52532457+hay-k@users.noreply.github.com>
Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
Co-authored-by: Stefan Woerner <41292468+stefan-woerner@users.noreply.github.com>
Co-authored-by: Takashi Imamichi <t.imamichi@gmail.com>
Co-authored-by: Anton Dekusar <adekusar@ie.ibm.com>
Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Co-authored-by: Austin Gilliam <austin.gilliam777@gmail.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Claudio Gambella <claudio.gambella1@ie.ibm.com>
Co-authored-by: adekusar-drl <62334182+adekusar-drl@users.noreply.github.com>
@danlkv
Copy link

danlkv commented Sep 8, 2020

@dongreenberg Previous version of QAOA gives different solution energies than the new, improved version.
My test: https://github.com/DaniloZZZ/QTensor/blob/master/qensor/tests/qiskit_qaoa_energy.py

How did you check for correctness?

mtreinish pushed a commit to mtreinish/qiskit-core that referenced this pull request Nov 20, 2020
* Add abelian property to opvecs and AbelianGrouper to operator init.

* Break up PauliCoB big clifford synthesis function into smaller ones.

* Add AbelianGrouper test.

* Add better input checking in primitives and remove unnecessary print.

* Fix coeffs bugs in pauli_cob.py.

* Reorganize pauli_cob. All tests pass, with grouping on and off.

* Change expectation_value backends to work through setters.

* Reorganize local_simulator_sampler.py a bit to use it in a test.

* Grouping Paulis works!! All tests pass.

* Add "compute TPB pauli" function to pauli_cob.

* Add WIP attempt at evolution over Abelian paulis.

* Fix trotter bug.

* Fix some other Trotter bugs.

* Add parameters to OpPaulis and test. Parameterized evolution passes!!!

* Add parameter binding for Op coefficients.

* Add parameter binding, and binding tests. Tests pass.

* Add division to Operators to make normalization convenient.

* Finish merging MinEigenSolver PR. All tests pass.

* Update QAOA, all tests pass!!

* Update some QAOA imports and typehints.

* Add QDrift trotterization method. All tests pass.

* Start migrating QPE, tests fail.

* fix spell

* fix almost all style errors

* fix copyright

* fix import cycles, changed to relative imports when possible

* relative imports

* Add bind_params to state_fn_circuit.py and op_circuit.py, and tests. Add list unrolling for param binding, and tests. Tests pass.

* Add param list handling for all Op types.

* Make OpVec printing nicer.

* Add op_converter to imports for better backwards compatibility.

* Add AerPauliExpectation tests. Tests pass. Issue with Aer though.

* Fix a few AerPauliExpectation bugs

* Start building toward parameterized Qobj.

* fix some lint errors

* fix some lint errors

* fix style

* fix copyright

* set style to defaults, fix aqua unit test loading

* change loading tests qpe/iqpe

* Fix OpPrimitive lint errors.

* Fix operator_base.py lint errors.

* Fix state_fn.py lint errors.

* Fix OpVec lint errors.

* Fix state_fn_circuit.py lint errors.

* Fix state_fn_dict.py lint errors.

* Fix state_fn_operator.py lint errors.

* Fix state_fn_vector.py lint errors. Tests pass.

* Fix QDrift test to deal with first Op in trotterization list being OpCircuit.

* Fix op_circuit.py lint errors.

* Fix op_pauli.py lint errors.

* Fix op_composition.py lint errors.

* Fix op_kron.py lint errors.

* Fix abelian_grouper.py lint errors. Tests pass.

* Fix pauli_cob.py lint errors. Tests pass.

* Fix Expectation lint errors. Tests pass.

* Fix circuit sampler lint errors. Tests pass.

* Fix other expectation lint errors. Tests pass.

* Fix trotterization lint errors. Tests pass.

* Add MatrixEvolution shell, fix evolution lint errors.

* Fix bug in evolution tests after fixing lint errors.

* Fix cyclic import for lint.

* fix pylint cyclic import error

* Make tests pass. Add aux_ops back to VQE, and make VQE and QAOA take old or new ops.

* fix spell and lint

* Fix swapping issue in evolution.

* Fix composition in OpEvolution.

* Fix add OpSum and kron OpKron in OpEvolution.

* Add to_opflow to legacy base_operator

* Clean OpCircuit and StateFnCircuit __str__

* Fix qaoa mixer.

* fix spell,style

* Ok now really all tests pass.

* add to_matrix_op() methods to ops.

* Start migrating NumpyEigensolver for Opflow

* Start removing back from op_primitive eval functions. All tests pass.

* Update eval logic (to be able to remove back) for operator_combos.

* Add to_matrix_op for OpMatrix and StateFnVector, and change some `if back`s to `if back is not None`

* Finish decoupling back args from evals. All tests pass.

* Remove back from eval logic.

* Remove back from eval. All tests pass.

* Change matrix_expectation.py to rely on to_matrix_op.

* Migrate numpy_eigen_solver.py and numpy_minimum_eigen_solver.

* Remove ToMatrixOp converter.

* set VQE _auto_conversion to False for now

* Add sampling and tests. Fix a rounding error in a test. Fix a not none error in numpy_eigen_solver.py.

* Add array methods to OpVec. Fix typo in OpPauli. Allow reverse_endianness in to_opflow for WeightedPauli.

* Make NumpyEigensolver return a StateFn in result.eigenstate.

* Fix flaky optimization tests. Fix OpVec so iterator interface works.

* Fix StateFnVector sampling. Fix sparse NumpyEigensolution. Fix some aux_op stuff. Fix some other things here and there. Please no more breakage.

* Change some sparsity stuff.

* fix spelling

* Typehints.

* More typehints

* fix copyright

* fix spelling

* More typehints, make globals immutable.

* fix style

* Rearrange tests, Add CZ to globals.

* Refactor some names.

* Rename OpEvolution to EvolutionOp. Tests pass.

* Rename primitive ops. All tests pass.

* Finish renamings.

* Test IBMQ Pauli expectation. All tests pass.

* Update spelling.

* Update Pauli to num_qubits.

* Updating some naming.

* Add diag support to fix knapsack issue.

* fix unit test

* fix unit test

* fix travis

* Turn half of Steve's comments.

* Fix some exponentiation things.

* Fix some exponentiation things.

* Add trotterization_factory. All tests pass.

* Add evolution_factory. All tests pass.

* Add circuit_sampler_factory. All tests pass.

* Rename get_primitives to primitive_strings. Turn some of Julien's changes.

* Only allow sample_circuits to accept circuit_ops. Tests pass.

* Turn more review changes

* fix spell, style

* Add matrix_op exp_i() into HamiltonianGate. Tests fail due to CircuitOp decompose() during composition. If commented out (line 158) tests pass.

* Change CircuitOp and StateFnCircuit to rely on QuantumCircuit instead of Instruction. All tests pass. Add to_circuit_op to relevant ops. Solves all the decompose issues.

* Add matrix_evolution and update QAOA to test matrix_op for cost operator. Add logic to update UCCSD to operator flow. Tests pass.

* Delete PauliToInstruction, as it's obsolete.

* Add to_pauli_op and tests. Tests pass.

* Fix composed_op.py eval bug

* Add sig digit rounding. VQE tests fail.

* better precision for sig digit rounding. Tests pass.

* Fix pep8, add comment

* Add to_circuit_op to statefns, making DictToCircuit mostly obsolete. Tests pass.

* fix cyclic imports

* fix numpy boolean to string coercion

* Update repr and a docstring.

* Make ExpectationValues into converters. Test pass.

* Fix bug from merge.

* Fix bugs, make Minus just a CircuitStateFn and not a ComposedOp.

* Uncomment HamiltonianGate

* Update lots of docstrings part I. Tests pass.

* fix docstring

* More docstrings. Change class.rst so docs are generated for some python operator overloads.

* Add navigation structure for docs to init files

* More docs.

* fix doctrings

* 1) Change local_simulator_sampler.py to circuit_sampler.py
2) Set up circuit_samplers directory to be removed.
3) Add IBMQ VQE test.
4) Change AerPauliExpectation and CircuitSampler to handle expval_measurement/snapshots correctly.

Tests pass.

* 1) Delete circuit_samplers.
2) Allow CircuitSampler to attach_results.

* Update Operator init

* Change Operator directory names. Tests pass.

* fix spell, docs

* Turn Expectations purely into converters. Tests pass.

* fix docs

* skip IBMQ test

* Add Converters docs. Tests pass.

* fix spell

* Add Evolutions docs. Tests pass.

* Add Expectation docs. Tests pass.

* fix spell

* Add StateFn docs. Tests pass.

* Fix typo.

* Add ListOp init docs.

* Fix some ordering

* Little docs edits.

* fix spell

* Little docs edits.

* 1) Add to_legacy_op to OperatorBase to allow non-migrated algos to accept new Operators.
2) Allow QPE and iQPE to accept new Operators, migrate tests. Tests pass.

* Fix typehints for minimum_eigen_solvers

* Make sure expectations can handle mixed observables.

* fix spell

* Turn some more of Steve's comments. Tests pass.

* Turn some more of Steve's comments. Fix a buncha parameter stuff, and make sure mixed Pauli evolution works.

* Turn some more of Steve's comments. Tests pass.

* Turn some comments, fix a QAOA bug.

* Try collapsing ListOp to_matrix a bit.

* Turn more comments, fix some bugs.

* Turn more comments, fix some bugs.

* Update ListOp docs.

* Update ListOp docs.

* Update ListOp docs.

* fix docstring

* Update minimum_eigen_solvers setter typehints.

* Add Changelog and tests for DictToCircuitSum.

* Update VQE's construct_circuit and some changelog elements.

* fix spell

* Allow MinEigenOptimizer to accept StateFn result in result.eigenstate.

* fix style

* Update changelog with more detail. Update VQE to call super.

* Typo

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
manoelmarques added a commit to manoelmarques/qiskit-terra that referenced this pull request Nov 23, 2020
* Add abelian property to opvecs and AbelianGrouper to operator init.

* Break up PauliCoB big clifford synthesis function into smaller ones.

* Add AbelianGrouper test.

* Add better input checking in primitives and remove unnecessary print.

* Fix coeffs bugs in pauli_cob.py.

* Reorganize pauli_cob. All tests pass, with grouping on and off.

* Change expectation_value backends to work through setters.

* Reorganize local_simulator_sampler.py a bit to use it in a test.

* Grouping Paulis works!! All tests pass.

* Add "compute TPB pauli" function to pauli_cob.

* Add WIP attempt at evolution over Abelian paulis.

* Fix trotter bug.

* Fix some other Trotter bugs.

* Add parameters to OpPaulis and test. Parameterized evolution passes!!!

* Add parameter binding for Op coefficients.

* Add parameter binding, and binding tests. Tests pass.

* Add division to Operators to make normalization convenient.

* Finish merging MinEigenSolver PR. All tests pass.

* Update QAOA, all tests pass!!

* Update some QAOA imports and typehints.

* Add QDrift trotterization method. All tests pass.

* Start migrating QPE, tests fail.

* fix spell

* fix almost all style errors

* fix copyright

* fix import cycles, changed to relative imports when possible

* relative imports

* Add bind_params to state_fn_circuit.py and op_circuit.py, and tests. Add list unrolling for param binding, and tests. Tests pass.

* Add param list handling for all Op types.

* Make OpVec printing nicer.

* Add op_converter to imports for better backwards compatibility.

* Add AerPauliExpectation tests. Tests pass. Issue with Aer though.

* Fix a few AerPauliExpectation bugs

* Start building toward parameterized Qobj.

* fix some lint errors

* fix some lint errors

* fix style

* fix copyright

* set style to defaults, fix aqua unit test loading

* change loading tests qpe/iqpe

* Fix OpPrimitive lint errors.

* Fix operator_base.py lint errors.

* Fix state_fn.py lint errors.

* Fix OpVec lint errors.

* Fix state_fn_circuit.py lint errors.

* Fix state_fn_dict.py lint errors.

* Fix state_fn_operator.py lint errors.

* Fix state_fn_vector.py lint errors. Tests pass.

* Fix QDrift test to deal with first Op in trotterization list being OpCircuit.

* Fix op_circuit.py lint errors.

* Fix op_pauli.py lint errors.

* Fix op_composition.py lint errors.

* Fix op_kron.py lint errors.

* Fix abelian_grouper.py lint errors. Tests pass.

* Fix pauli_cob.py lint errors. Tests pass.

* Fix Expectation lint errors. Tests pass.

* Fix circuit sampler lint errors. Tests pass.

* Fix other expectation lint errors. Tests pass.

* Fix trotterization lint errors. Tests pass.

* Add MatrixEvolution shell, fix evolution lint errors.

* Fix bug in evolution tests after fixing lint errors.

* Fix cyclic import for lint.

* fix pylint cyclic import error

* Make tests pass. Add aux_ops back to VQE, and make VQE and QAOA take old or new ops.

* fix spell and lint

* Fix swapping issue in evolution.

* Fix composition in OpEvolution.

* Fix add OpSum and kron OpKron in OpEvolution.

* Add to_opflow to legacy base_operator

* Clean OpCircuit and StateFnCircuit __str__

* Fix qaoa mixer.

* fix spell,style

* Ok now really all tests pass.

* add to_matrix_op() methods to ops.

* Start migrating NumpyEigensolver for Opflow

* Start removing back from op_primitive eval functions. All tests pass.

* Update eval logic (to be able to remove back) for operator_combos.

* Add to_matrix_op for OpMatrix and StateFnVector, and change some `if back`s to `if back is not None`

* Finish decoupling back args from evals. All tests pass.

* Remove back from eval logic.

* Remove back from eval. All tests pass.

* Change matrix_expectation.py to rely on to_matrix_op.

* Migrate numpy_eigen_solver.py and numpy_minimum_eigen_solver.

* Remove ToMatrixOp converter.

* set VQE _auto_conversion to False for now

* Add sampling and tests. Fix a rounding error in a test. Fix a not none error in numpy_eigen_solver.py.

* Add array methods to OpVec. Fix typo in OpPauli. Allow reverse_endianness in to_opflow for WeightedPauli.

* Make NumpyEigensolver return a StateFn in result.eigenstate.

* Fix flaky optimization tests. Fix OpVec so iterator interface works.

* Fix StateFnVector sampling. Fix sparse NumpyEigensolution. Fix some aux_op stuff. Fix some other things here and there. Please no more breakage.

* Change some sparsity stuff.

* fix spelling

* Typehints.

* More typehints

* fix copyright

* fix spelling

* More typehints, make globals immutable.

* fix style

* Rearrange tests, Add CZ to globals.

* Refactor some names.

* Rename OpEvolution to EvolutionOp. Tests pass.

* Rename primitive ops. All tests pass.

* Finish renamings.

* Test IBMQ Pauli expectation. All tests pass.

* Update spelling.

* Update Pauli to num_qubits.

* Updating some naming.

* Add diag support to fix knapsack issue.

* fix unit test

* fix unit test

* fix travis

* Turn half of Steve's comments.

* Fix some exponentiation things.

* Fix some exponentiation things.

* Add trotterization_factory. All tests pass.

* Add evolution_factory. All tests pass.

* Add circuit_sampler_factory. All tests pass.

* Rename get_primitives to primitive_strings. Turn some of Julien's changes.

* Only allow sample_circuits to accept circuit_ops. Tests pass.

* Turn more review changes

* fix spell, style

* Add matrix_op exp_i() into HamiltonianGate. Tests fail due to CircuitOp decompose() during composition. If commented out (line 158) tests pass.

* Change CircuitOp and StateFnCircuit to rely on QuantumCircuit instead of Instruction. All tests pass. Add to_circuit_op to relevant ops. Solves all the decompose issues.

* Add matrix_evolution and update QAOA to test matrix_op for cost operator. Add logic to update UCCSD to operator flow. Tests pass.

* Delete PauliToInstruction, as it's obsolete.

* Add to_pauli_op and tests. Tests pass.

* Fix composed_op.py eval bug

* Add sig digit rounding. VQE tests fail.

* better precision for sig digit rounding. Tests pass.

* Fix pep8, add comment

* Add to_circuit_op to statefns, making DictToCircuit mostly obsolete. Tests pass.

* fix cyclic imports

* fix numpy boolean to string coercion

* Update repr and a docstring.

* Make ExpectationValues into converters. Test pass.

* Fix bug from merge.

* Fix bugs, make Minus just a CircuitStateFn and not a ComposedOp.

* Uncomment HamiltonianGate

* Update lots of docstrings part I. Tests pass.

* fix docstring

* More docstrings. Change class.rst so docs are generated for some python operator overloads.

* Add navigation structure for docs to init files

* More docs.

* fix doctrings

* 1) Change local_simulator_sampler.py to circuit_sampler.py
2) Set up circuit_samplers directory to be removed.
3) Add IBMQ VQE test.
4) Change AerPauliExpectation and CircuitSampler to handle expval_measurement/snapshots correctly.

Tests pass.

* 1) Delete circuit_samplers.
2) Allow CircuitSampler to attach_results.

* Update Operator init

* Change Operator directory names. Tests pass.

* fix spell, docs

* Turn Expectations purely into converters. Tests pass.

* fix docs

* skip IBMQ test

* Add Converters docs. Tests pass.

* fix spell

* Add Evolutions docs. Tests pass.

* Add Expectation docs. Tests pass.

* fix spell

* Add StateFn docs. Tests pass.

* Fix typo.

* Add ListOp init docs.

* Fix some ordering

* Little docs edits.

* fix spell

* Little docs edits.

* 1) Add to_legacy_op to OperatorBase to allow non-migrated algos to accept new Operators.
2) Allow QPE and iQPE to accept new Operators, migrate tests. Tests pass.

* Fix typehints for minimum_eigen_solvers

* Make sure expectations can handle mixed observables.

* fix spell

* Turn some more of Steve's comments. Tests pass.

* Turn some more of Steve's comments. Fix a buncha parameter stuff, and make sure mixed Pauli evolution works.

* Turn some more of Steve's comments. Tests pass.

* Turn some comments, fix a QAOA bug.

* Try collapsing ListOp to_matrix a bit.

* Turn more comments, fix some bugs.

* Turn more comments, fix some bugs.

* Update ListOp docs.

* Update ListOp docs.

* Update ListOp docs.

* fix docstring

* Update minimum_eigen_solvers setter typehints.

* Add Changelog and tests for DictToCircuitSum.

* Update VQE's construct_circuit and some changelog elements.

* fix spell

* Allow MinEigenOptimizer to accept StateFn result in result.eigenstate.

* fix style

* Update changelog with more detail. Update VQE to call super.

* Typo

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
manoelmarques added a commit to manoelmarques/qiskit-terra that referenced this pull request Dec 2, 2020
* Add abelian property to opvecs and AbelianGrouper to operator init.

* Break up PauliCoB big clifford synthesis function into smaller ones.

* Add AbelianGrouper test.

* Add better input checking in primitives and remove unnecessary print.

* Fix coeffs bugs in pauli_cob.py.

* Reorganize pauli_cob. All tests pass, with grouping on and off.

* Change expectation_value backends to work through setters.

* Reorganize local_simulator_sampler.py a bit to use it in a test.

* Grouping Paulis works!! All tests pass.

* Add "compute TPB pauli" function to pauli_cob.

* Add WIP attempt at evolution over Abelian paulis.

* Fix trotter bug.

* Fix some other Trotter bugs.

* Add parameters to OpPaulis and test. Parameterized evolution passes!!!

* Add parameter binding for Op coefficients.

* Add parameter binding, and binding tests. Tests pass.

* Add division to Operators to make normalization convenient.

* Finish merging MinEigenSolver PR. All tests pass.

* Update QAOA, all tests pass!!

* Update some QAOA imports and typehints.

* Add QDrift trotterization method. All tests pass.

* Start migrating QPE, tests fail.

* fix spell

* fix almost all style errors

* fix copyright

* fix import cycles, changed to relative imports when possible

* relative imports

* Add bind_params to state_fn_circuit.py and op_circuit.py, and tests. Add list unrolling for param binding, and tests. Tests pass.

* Add param list handling for all Op types.

* Make OpVec printing nicer.

* Add op_converter to imports for better backwards compatibility.

* Add AerPauliExpectation tests. Tests pass. Issue with Aer though.

* Fix a few AerPauliExpectation bugs

* Start building toward parameterized Qobj.

* fix some lint errors

* fix some lint errors

* fix style

* fix copyright

* set style to defaults, fix aqua unit test loading

* change loading tests qpe/iqpe

* Fix OpPrimitive lint errors.

* Fix operator_base.py lint errors.

* Fix state_fn.py lint errors.

* Fix OpVec lint errors.

* Fix state_fn_circuit.py lint errors.

* Fix state_fn_dict.py lint errors.

* Fix state_fn_operator.py lint errors.

* Fix state_fn_vector.py lint errors. Tests pass.

* Fix QDrift test to deal with first Op in trotterization list being OpCircuit.

* Fix op_circuit.py lint errors.

* Fix op_pauli.py lint errors.

* Fix op_composition.py lint errors.

* Fix op_kron.py lint errors.

* Fix abelian_grouper.py lint errors. Tests pass.

* Fix pauli_cob.py lint errors. Tests pass.

* Fix Expectation lint errors. Tests pass.

* Fix circuit sampler lint errors. Tests pass.

* Fix other expectation lint errors. Tests pass.

* Fix trotterization lint errors. Tests pass.

* Add MatrixEvolution shell, fix evolution lint errors.

* Fix bug in evolution tests after fixing lint errors.

* Fix cyclic import for lint.

* fix pylint cyclic import error

* Make tests pass. Add aux_ops back to VQE, and make VQE and QAOA take old or new ops.

* fix spell and lint

* Fix swapping issue in evolution.

* Fix composition in OpEvolution.

* Fix add OpSum and kron OpKron in OpEvolution.

* Add to_opflow to legacy base_operator

* Clean OpCircuit and StateFnCircuit __str__

* Fix qaoa mixer.

* fix spell,style

* Ok now really all tests pass.

* add to_matrix_op() methods to ops.

* Start migrating NumpyEigensolver for Opflow

* Start removing back from op_primitive eval functions. All tests pass.

* Update eval logic (to be able to remove back) for operator_combos.

* Add to_matrix_op for OpMatrix and StateFnVector, and change some `if back`s to `if back is not None`

* Finish decoupling back args from evals. All tests pass.

* Remove back from eval logic.

* Remove back from eval. All tests pass.

* Change matrix_expectation.py to rely on to_matrix_op.

* Migrate numpy_eigen_solver.py and numpy_minimum_eigen_solver.

* Remove ToMatrixOp converter.

* set VQE _auto_conversion to False for now

* Add sampling and tests. Fix a rounding error in a test. Fix a not none error in numpy_eigen_solver.py.

* Add array methods to OpVec. Fix typo in OpPauli. Allow reverse_endianness in to_opflow for WeightedPauli.

* Make NumpyEigensolver return a StateFn in result.eigenstate.

* Fix flaky optimization tests. Fix OpVec so iterator interface works.

* Fix StateFnVector sampling. Fix sparse NumpyEigensolution. Fix some aux_op stuff. Fix some other things here and there. Please no more breakage.

* Change some sparsity stuff.

* fix spelling

* Typehints.

* More typehints

* fix copyright

* fix spelling

* More typehints, make globals immutable.

* fix style

* Rearrange tests, Add CZ to globals.

* Refactor some names.

* Rename OpEvolution to EvolutionOp. Tests pass.

* Rename primitive ops. All tests pass.

* Finish renamings.

* Test IBMQ Pauli expectation. All tests pass.

* Update spelling.

* Update Pauli to num_qubits.

* Updating some naming.

* Add diag support to fix knapsack issue.

* fix unit test

* fix unit test

* fix travis

* Turn half of Steve's comments.

* Fix some exponentiation things.

* Fix some exponentiation things.

* Add trotterization_factory. All tests pass.

* Add evolution_factory. All tests pass.

* Add circuit_sampler_factory. All tests pass.

* Rename get_primitives to primitive_strings. Turn some of Julien's changes.

* Only allow sample_circuits to accept circuit_ops. Tests pass.

* Turn more review changes

* fix spell, style

* Add matrix_op exp_i() into HamiltonianGate. Tests fail due to CircuitOp decompose() during composition. If commented out (line 158) tests pass.

* Change CircuitOp and StateFnCircuit to rely on QuantumCircuit instead of Instruction. All tests pass. Add to_circuit_op to relevant ops. Solves all the decompose issues.

* Add matrix_evolution and update QAOA to test matrix_op for cost operator. Add logic to update UCCSD to operator flow. Tests pass.

* Delete PauliToInstruction, as it's obsolete.

* Add to_pauli_op and tests. Tests pass.

* Fix composed_op.py eval bug

* Add sig digit rounding. VQE tests fail.

* better precision for sig digit rounding. Tests pass.

* Fix pep8, add comment

* Add to_circuit_op to statefns, making DictToCircuit mostly obsolete. Tests pass.

* fix cyclic imports

* fix numpy boolean to string coercion

* Update repr and a docstring.

* Make ExpectationValues into converters. Test pass.

* Fix bug from merge.

* Fix bugs, make Minus just a CircuitStateFn and not a ComposedOp.

* Uncomment HamiltonianGate

* Update lots of docstrings part I. Tests pass.

* fix docstring

* More docstrings. Change class.rst so docs are generated for some python operator overloads.

* Add navigation structure for docs to init files

* More docs.

* fix doctrings

* 1) Change local_simulator_sampler.py to circuit_sampler.py
2) Set up circuit_samplers directory to be removed.
3) Add IBMQ VQE test.
4) Change AerPauliExpectation and CircuitSampler to handle expval_measurement/snapshots correctly.

Tests pass.

* 1) Delete circuit_samplers.
2) Allow CircuitSampler to attach_results.

* Update Operator init

* Change Operator directory names. Tests pass.

* fix spell, docs

* Turn Expectations purely into converters. Tests pass.

* fix docs

* skip IBMQ test

* Add Converters docs. Tests pass.

* fix spell

* Add Evolutions docs. Tests pass.

* Add Expectation docs. Tests pass.

* fix spell

* Add StateFn docs. Tests pass.

* Fix typo.

* Add ListOp init docs.

* Fix some ordering

* Little docs edits.

* fix spell

* Little docs edits.

* 1) Add to_legacy_op to OperatorBase to allow non-migrated algos to accept new Operators.
2) Allow QPE and iQPE to accept new Operators, migrate tests. Tests pass.

* Fix typehints for minimum_eigen_solvers

* Make sure expectations can handle mixed observables.

* fix spell

* Turn some more of Steve's comments. Tests pass.

* Turn some more of Steve's comments. Fix a buncha parameter stuff, and make sure mixed Pauli evolution works.

* Turn some more of Steve's comments. Tests pass.

* Turn some comments, fix a QAOA bug.

* Try collapsing ListOp to_matrix a bit.

* Turn more comments, fix some bugs.

* Turn more comments, fix some bugs.

* Update ListOp docs.

* Update ListOp docs.

* Update ListOp docs.

* fix docstring

* Update minimum_eigen_solvers setter typehints.

* Add Changelog and tests for DictToCircuitSum.

* Update VQE's construct_circuit and some changelog elements.

* fix spell

* Allow MinEigenOptimizer to accept StateFn result in result.eigenstate.

* fix style

* Update changelog with more detail. Update VQE to call super.

* Typo

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
manoelmarques added a commit to manoelmarques/qiskit-terra that referenced this pull request Dec 7, 2020
* Add abelian property to opvecs and AbelianGrouper to operator init.

* Break up PauliCoB big clifford synthesis function into smaller ones.

* Add AbelianGrouper test.

* Add better input checking in primitives and remove unnecessary print.

* Fix coeffs bugs in pauli_cob.py.

* Reorganize pauli_cob. All tests pass, with grouping on and off.

* Change expectation_value backends to work through setters.

* Reorganize local_simulator_sampler.py a bit to use it in a test.

* Grouping Paulis works!! All tests pass.

* Add "compute TPB pauli" function to pauli_cob.

* Add WIP attempt at evolution over Abelian paulis.

* Fix trotter bug.

* Fix some other Trotter bugs.

* Add parameters to OpPaulis and test. Parameterized evolution passes!!!

* Add parameter binding for Op coefficients.

* Add parameter binding, and binding tests. Tests pass.

* Add division to Operators to make normalization convenient.

* Finish merging MinEigenSolver PR. All tests pass.

* Update QAOA, all tests pass!!

* Update some QAOA imports and typehints.

* Add QDrift trotterization method. All tests pass.

* Start migrating QPE, tests fail.

* fix spell

* fix almost all style errors

* fix copyright

* fix import cycles, changed to relative imports when possible

* relative imports

* Add bind_params to state_fn_circuit.py and op_circuit.py, and tests. Add list unrolling for param binding, and tests. Tests pass.

* Add param list handling for all Op types.

* Make OpVec printing nicer.

* Add op_converter to imports for better backwards compatibility.

* Add AerPauliExpectation tests. Tests pass. Issue with Aer though.

* Fix a few AerPauliExpectation bugs

* Start building toward parameterized Qobj.

* fix some lint errors

* fix some lint errors

* fix style

* fix copyright

* set style to defaults, fix aqua unit test loading

* change loading tests qpe/iqpe

* Fix OpPrimitive lint errors.

* Fix operator_base.py lint errors.

* Fix state_fn.py lint errors.

* Fix OpVec lint errors.

* Fix state_fn_circuit.py lint errors.

* Fix state_fn_dict.py lint errors.

* Fix state_fn_operator.py lint errors.

* Fix state_fn_vector.py lint errors. Tests pass.

* Fix QDrift test to deal with first Op in trotterization list being OpCircuit.

* Fix op_circuit.py lint errors.

* Fix op_pauli.py lint errors.

* Fix op_composition.py lint errors.

* Fix op_kron.py lint errors.

* Fix abelian_grouper.py lint errors. Tests pass.

* Fix pauli_cob.py lint errors. Tests pass.

* Fix Expectation lint errors. Tests pass.

* Fix circuit sampler lint errors. Tests pass.

* Fix other expectation lint errors. Tests pass.

* Fix trotterization lint errors. Tests pass.

* Add MatrixEvolution shell, fix evolution lint errors.

* Fix bug in evolution tests after fixing lint errors.

* Fix cyclic import for lint.

* fix pylint cyclic import error

* Make tests pass. Add aux_ops back to VQE, and make VQE and QAOA take old or new ops.

* fix spell and lint

* Fix swapping issue in evolution.

* Fix composition in OpEvolution.

* Fix add OpSum and kron OpKron in OpEvolution.

* Add to_opflow to legacy base_operator

* Clean OpCircuit and StateFnCircuit __str__

* Fix qaoa mixer.

* fix spell,style

* Ok now really all tests pass.

* add to_matrix_op() methods to ops.

* Start migrating NumpyEigensolver for Opflow

* Start removing back from op_primitive eval functions. All tests pass.

* Update eval logic (to be able to remove back) for operator_combos.

* Add to_matrix_op for OpMatrix and StateFnVector, and change some `if back`s to `if back is not None`

* Finish decoupling back args from evals. All tests pass.

* Remove back from eval logic.

* Remove back from eval. All tests pass.

* Change matrix_expectation.py to rely on to_matrix_op.

* Migrate numpy_eigen_solver.py and numpy_minimum_eigen_solver.

* Remove ToMatrixOp converter.

* set VQE _auto_conversion to False for now

* Add sampling and tests. Fix a rounding error in a test. Fix a not none error in numpy_eigen_solver.py.

* Add array methods to OpVec. Fix typo in OpPauli. Allow reverse_endianness in to_opflow for WeightedPauli.

* Make NumpyEigensolver return a StateFn in result.eigenstate.

* Fix flaky optimization tests. Fix OpVec so iterator interface works.

* Fix StateFnVector sampling. Fix sparse NumpyEigensolution. Fix some aux_op stuff. Fix some other things here and there. Please no more breakage.

* Change some sparsity stuff.

* fix spelling

* Typehints.

* More typehints

* fix copyright

* fix spelling

* More typehints, make globals immutable.

* fix style

* Rearrange tests, Add CZ to globals.

* Refactor some names.

* Rename OpEvolution to EvolutionOp. Tests pass.

* Rename primitive ops. All tests pass.

* Finish renamings.

* Test IBMQ Pauli expectation. All tests pass.

* Update spelling.

* Update Pauli to num_qubits.

* Updating some naming.

* Add diag support to fix knapsack issue.

* fix unit test

* fix unit test

* fix travis

* Turn half of Steve's comments.

* Fix some exponentiation things.

* Fix some exponentiation things.

* Add trotterization_factory. All tests pass.

* Add evolution_factory. All tests pass.

* Add circuit_sampler_factory. All tests pass.

* Rename get_primitives to primitive_strings. Turn some of Julien's changes.

* Only allow sample_circuits to accept circuit_ops. Tests pass.

* Turn more review changes

* fix spell, style

* Add matrix_op exp_i() into HamiltonianGate. Tests fail due to CircuitOp decompose() during composition. If commented out (line 158) tests pass.

* Change CircuitOp and StateFnCircuit to rely on QuantumCircuit instead of Instruction. All tests pass. Add to_circuit_op to relevant ops. Solves all the decompose issues.

* Add matrix_evolution and update QAOA to test matrix_op for cost operator. Add logic to update UCCSD to operator flow. Tests pass.

* Delete PauliToInstruction, as it's obsolete.

* Add to_pauli_op and tests. Tests pass.

* Fix composed_op.py eval bug

* Add sig digit rounding. VQE tests fail.

* better precision for sig digit rounding. Tests pass.

* Fix pep8, add comment

* Add to_circuit_op to statefns, making DictToCircuit mostly obsolete. Tests pass.

* fix cyclic imports

* fix numpy boolean to string coercion

* Update repr and a docstring.

* Make ExpectationValues into converters. Test pass.

* Fix bug from merge.

* Fix bugs, make Minus just a CircuitStateFn and not a ComposedOp.

* Uncomment HamiltonianGate

* Update lots of docstrings part I. Tests pass.

* fix docstring

* More docstrings. Change class.rst so docs are generated for some python operator overloads.

* Add navigation structure for docs to init files

* More docs.

* fix doctrings

* 1) Change local_simulator_sampler.py to circuit_sampler.py
2) Set up circuit_samplers directory to be removed.
3) Add IBMQ VQE test.
4) Change AerPauliExpectation and CircuitSampler to handle expval_measurement/snapshots correctly.

Tests pass.

* 1) Delete circuit_samplers.
2) Allow CircuitSampler to attach_results.

* Update Operator init

* Change Operator directory names. Tests pass.

* fix spell, docs

* Turn Expectations purely into converters. Tests pass.

* fix docs

* skip IBMQ test

* Add Converters docs. Tests pass.

* fix spell

* Add Evolutions docs. Tests pass.

* Add Expectation docs. Tests pass.

* fix spell

* Add StateFn docs. Tests pass.

* Fix typo.

* Add ListOp init docs.

* Fix some ordering

* Little docs edits.

* fix spell

* Little docs edits.

* 1) Add to_legacy_op to OperatorBase to allow non-migrated algos to accept new Operators.
2) Allow QPE and iQPE to accept new Operators, migrate tests. Tests pass.

* Fix typehints for minimum_eigen_solvers

* Make sure expectations can handle mixed observables.

* fix spell

* Turn some more of Steve's comments. Tests pass.

* Turn some more of Steve's comments. Fix a buncha parameter stuff, and make sure mixed Pauli evolution works.

* Turn some more of Steve's comments. Tests pass.

* Turn some comments, fix a QAOA bug.

* Try collapsing ListOp to_matrix a bit.

* Turn more comments, fix some bugs.

* Turn more comments, fix some bugs.

* Update ListOp docs.

* Update ListOp docs.

* Update ListOp docs.

* fix docstring

* Update minimum_eigen_solvers setter typehints.

* Add Changelog and tests for DictToCircuitSum.

* Update VQE's construct_circuit and some changelog elements.

* fix spell

* Allow MinEigenOptimizer to accept StateFn result in result.eigenstate.

* fix style

* Update changelog with more detail. Update VQE to call super.

* Typo

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
manoelmarques added a commit to qiskit-community/qiskit-optimization that referenced this pull request Jan 14, 2021
* Add abelian property to opvecs and AbelianGrouper to operator init.

* Break up PauliCoB big clifford synthesis function into smaller ones.

* Add AbelianGrouper test.

* Add better input checking in primitives and remove unnecessary print.

* Fix coeffs bugs in pauli_cob.py.

* Reorganize pauli_cob. All tests pass, with grouping on and off.

* Change expectation_value backends to work through setters.

* Reorganize local_simulator_sampler.py a bit to use it in a test.

* Grouping Paulis works!! All tests pass.

* Add "compute TPB pauli" function to pauli_cob.

* Add WIP attempt at evolution over Abelian paulis.

* Fix trotter bug.

* Fix some other Trotter bugs.

* Add parameters to OpPaulis and test. Parameterized evolution passes!!!

* Add parameter binding for Op coefficients.

* Add parameter binding, and binding tests. Tests pass.

* Add division to Operators to make normalization convenient.

* Finish merging MinEigenSolver PR. All tests pass.

* Update QAOA, all tests pass!!

* Update some QAOA imports and typehints.

* Add QDrift trotterization method. All tests pass.

* Start migrating QPE, tests fail.

* fix spell

* fix almost all style errors

* fix copyright

* fix import cycles, changed to relative imports when possible

* relative imports

* Add bind_params to state_fn_circuit.py and op_circuit.py, and tests. Add list unrolling for param binding, and tests. Tests pass.

* Add param list handling for all Op types.

* Make OpVec printing nicer.

* Add op_converter to imports for better backwards compatibility.

* Add AerPauliExpectation tests. Tests pass. Issue with Aer though.

* Fix a few AerPauliExpectation bugs

* Start building toward parameterized Qobj.

* fix some lint errors

* fix some lint errors

* fix style

* fix copyright

* set style to defaults, fix aqua unit test loading

* change loading tests qpe/iqpe

* Fix OpPrimitive lint errors.

* Fix operator_base.py lint errors.

* Fix state_fn.py lint errors.

* Fix OpVec lint errors.

* Fix state_fn_circuit.py lint errors.

* Fix state_fn_dict.py lint errors.

* Fix state_fn_operator.py lint errors.

* Fix state_fn_vector.py lint errors. Tests pass.

* Fix QDrift test to deal with first Op in trotterization list being OpCircuit.

* Fix op_circuit.py lint errors.

* Fix op_pauli.py lint errors.

* Fix op_composition.py lint errors.

* Fix op_kron.py lint errors.

* Fix abelian_grouper.py lint errors. Tests pass.

* Fix pauli_cob.py lint errors. Tests pass.

* Fix Expectation lint errors. Tests pass.

* Fix circuit sampler lint errors. Tests pass.

* Fix other expectation lint errors. Tests pass.

* Fix trotterization lint errors. Tests pass.

* Add MatrixEvolution shell, fix evolution lint errors.

* Fix bug in evolution tests after fixing lint errors.

* Fix cyclic import for lint.

* fix pylint cyclic import error

* Make tests pass. Add aux_ops back to VQE, and make VQE and QAOA take old or new ops.

* fix spell and lint

* Fix swapping issue in evolution.

* Fix composition in OpEvolution.

* Fix add OpSum and kron OpKron in OpEvolution.

* Add to_opflow to legacy base_operator

* Clean OpCircuit and StateFnCircuit __str__

* Fix qaoa mixer.

* fix spell,style

* Ok now really all tests pass.

* add to_matrix_op() methods to ops.

* Start migrating NumpyEigensolver for Opflow

* Start removing back from op_primitive eval functions. All tests pass.

* Update eval logic (to be able to remove back) for operator_combos.

* Add to_matrix_op for OpMatrix and StateFnVector, and change some `if back`s to `if back is not None`

* Finish decoupling back args from evals. All tests pass.

* Remove back from eval logic.

* Remove back from eval. All tests pass.

* Change matrix_expectation.py to rely on to_matrix_op.

* Migrate numpy_eigen_solver.py and numpy_minimum_eigen_solver.

* Remove ToMatrixOp converter.

* set VQE _auto_conversion to False for now

* Add sampling and tests. Fix a rounding error in a test. Fix a not none error in numpy_eigen_solver.py.

* Add array methods to OpVec. Fix typo in OpPauli. Allow reverse_endianness in to_opflow for WeightedPauli.

* Make NumpyEigensolver return a StateFn in result.eigenstate.

* Fix flaky optimization tests. Fix OpVec so iterator interface works.

* Fix StateFnVector sampling. Fix sparse NumpyEigensolution. Fix some aux_op stuff. Fix some other things here and there. Please no more breakage.

* Change some sparsity stuff.

* fix spelling

* Typehints.

* More typehints

* fix copyright

* fix spelling

* More typehints, make globals immutable.

* fix style

* Rearrange tests, Add CZ to globals.

* Refactor some names.

* Rename OpEvolution to EvolutionOp. Tests pass.

* Rename primitive ops. All tests pass.

* Finish renamings.

* Test IBMQ Pauli expectation. All tests pass.

* Update spelling.

* Update Pauli to num_qubits.

* Updating some naming.

* Add diag support to fix knapsack issue.

* fix unit test

* fix unit test

* fix travis

* Turn half of Steve's comments.

* Fix some exponentiation things.

* Fix some exponentiation things.

* Add trotterization_factory. All tests pass.

* Add evolution_factory. All tests pass.

* Add circuit_sampler_factory. All tests pass.

* Rename get_primitives to primitive_strings. Turn some of Julien's changes.

* Only allow sample_circuits to accept circuit_ops. Tests pass.

* Turn more review changes

* fix spell, style

* Add matrix_op exp_i() into HamiltonianGate. Tests fail due to CircuitOp decompose() during composition. If commented out (line 158) tests pass.

* Change CircuitOp and StateFnCircuit to rely on QuantumCircuit instead of Instruction. All tests pass. Add to_circuit_op to relevant ops. Solves all the decompose issues.

* Add matrix_evolution and update QAOA to test matrix_op for cost operator. Add logic to update UCCSD to operator flow. Tests pass.

* Delete PauliToInstruction, as it's obsolete.

* Add to_pauli_op and tests. Tests pass.

* Fix composed_op.py eval bug

* Add sig digit rounding. VQE tests fail.

* better precision for sig digit rounding. Tests pass.

* Fix pep8, add comment

* Add to_circuit_op to statefns, making DictToCircuit mostly obsolete. Tests pass.

* fix cyclic imports

* fix numpy boolean to string coercion

* Update repr and a docstring.

* Make ExpectationValues into converters. Test pass.

* Fix bug from merge.

* Fix bugs, make Minus just a CircuitStateFn and not a ComposedOp.

* Uncomment HamiltonianGate

* Update lots of docstrings part I. Tests pass.

* fix docstring

* More docstrings. Change class.rst so docs are generated for some python operator overloads.

* Add navigation structure for docs to init files

* More docs.

* fix doctrings

* 1) Change local_simulator_sampler.py to circuit_sampler.py
2) Set up circuit_samplers directory to be removed.
3) Add IBMQ VQE test.
4) Change AerPauliExpectation and CircuitSampler to handle expval_measurement/snapshots correctly.

Tests pass.

* 1) Delete circuit_samplers.
2) Allow CircuitSampler to attach_results.

* Update Operator init

* Change Operator directory names. Tests pass.

* fix spell, docs

* Turn Expectations purely into converters. Tests pass.

* fix docs

* skip IBMQ test

* Add Converters docs. Tests pass.

* fix spell

* Add Evolutions docs. Tests pass.

* Add Expectation docs. Tests pass.

* fix spell

* Add StateFn docs. Tests pass.

* Fix typo.

* Add ListOp init docs.

* Fix some ordering

* Little docs edits.

* fix spell

* Little docs edits.

* 1) Add to_legacy_op to OperatorBase to allow non-migrated algos to accept new Operators.
2) Allow QPE and iQPE to accept new Operators, migrate tests. Tests pass.

* Fix typehints for minimum_eigen_solvers

* Make sure expectations can handle mixed observables.

* fix spell

* Turn some more of Steve's comments. Tests pass.

* Turn some more of Steve's comments. Fix a buncha parameter stuff, and make sure mixed Pauli evolution works.

* Turn some more of Steve's comments. Tests pass.

* Turn some comments, fix a QAOA bug.

* Try collapsing ListOp to_matrix a bit.

* Turn more comments, fix some bugs.

* Turn more comments, fix some bugs.

* Update ListOp docs.

* Update ListOp docs.

* Update ListOp docs.

* fix docstring

* Update minimum_eigen_solvers setter typehints.

* Add Changelog and tests for DictToCircuitSum.

* Update VQE's construct_circuit and some changelog elements.

* fix spell

* Allow MinEigenOptimizer to accept StateFn result in result.eigenstate.

* fix style

* Update changelog with more detail. Update VQE to call super.

* Typo

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
manoelmarques added a commit to qiskit-community/qiskit-finance that referenced this pull request Jan 19, 2021
* Add abelian property to opvecs and AbelianGrouper to operator init.

* Break up PauliCoB big clifford synthesis function into smaller ones.

* Add AbelianGrouper test.

* Add better input checking in primitives and remove unnecessary print.

* Fix coeffs bugs in pauli_cob.py.

* Reorganize pauli_cob. All tests pass, with grouping on and off.

* Change expectation_value backends to work through setters.

* Reorganize local_simulator_sampler.py a bit to use it in a test.

* Grouping Paulis works!! All tests pass.

* Add "compute TPB pauli" function to pauli_cob.

* Add WIP attempt at evolution over Abelian paulis.

* Fix trotter bug.

* Fix some other Trotter bugs.

* Add parameters to OpPaulis and test. Parameterized evolution passes!!!

* Add parameter binding for Op coefficients.

* Add parameter binding, and binding tests. Tests pass.

* Add division to Operators to make normalization convenient.

* Finish merging MinEigenSolver PR. All tests pass.

* Update QAOA, all tests pass!!

* Update some QAOA imports and typehints.

* Add QDrift trotterization method. All tests pass.

* Start migrating QPE, tests fail.

* fix spell

* fix almost all style errors

* fix copyright

* fix import cycles, changed to relative imports when possible

* relative imports

* Add bind_params to state_fn_circuit.py and op_circuit.py, and tests. Add list unrolling for param binding, and tests. Tests pass.

* Add param list handling for all Op types.

* Make OpVec printing nicer.

* Add op_converter to imports for better backwards compatibility.

* Add AerPauliExpectation tests. Tests pass. Issue with Aer though.

* Fix a few AerPauliExpectation bugs

* Start building toward parameterized Qobj.

* fix some lint errors

* fix some lint errors

* fix style

* fix copyright

* set style to defaults, fix aqua unit test loading

* change loading tests qpe/iqpe

* Fix OpPrimitive lint errors.

* Fix operator_base.py lint errors.

* Fix state_fn.py lint errors.

* Fix OpVec lint errors.

* Fix state_fn_circuit.py lint errors.

* Fix state_fn_dict.py lint errors.

* Fix state_fn_operator.py lint errors.

* Fix state_fn_vector.py lint errors. Tests pass.

* Fix QDrift test to deal with first Op in trotterization list being OpCircuit.

* Fix op_circuit.py lint errors.

* Fix op_pauli.py lint errors.

* Fix op_composition.py lint errors.

* Fix op_kron.py lint errors.

* Fix abelian_grouper.py lint errors. Tests pass.

* Fix pauli_cob.py lint errors. Tests pass.

* Fix Expectation lint errors. Tests pass.

* Fix circuit sampler lint errors. Tests pass.

* Fix other expectation lint errors. Tests pass.

* Fix trotterization lint errors. Tests pass.

* Add MatrixEvolution shell, fix evolution lint errors.

* Fix bug in evolution tests after fixing lint errors.

* Fix cyclic import for lint.

* fix pylint cyclic import error

* Make tests pass. Add aux_ops back to VQE, and make VQE and QAOA take old or new ops.

* fix spell and lint

* Fix swapping issue in evolution.

* Fix composition in OpEvolution.

* Fix add OpSum and kron OpKron in OpEvolution.

* Add to_opflow to legacy base_operator

* Clean OpCircuit and StateFnCircuit __str__

* Fix qaoa mixer.

* fix spell,style

* Ok now really all tests pass.

* add to_matrix_op() methods to ops.

* Start migrating NumpyEigensolver for Opflow

* Start removing back from op_primitive eval functions. All tests pass.

* Update eval logic (to be able to remove back) for operator_combos.

* Add to_matrix_op for OpMatrix and StateFnVector, and change some `if back`s to `if back is not None`

* Finish decoupling back args from evals. All tests pass.

* Remove back from eval logic.

* Remove back from eval. All tests pass.

* Change matrix_expectation.py to rely on to_matrix_op.

* Migrate numpy_eigen_solver.py and numpy_minimum_eigen_solver.

* Remove ToMatrixOp converter.

* set VQE _auto_conversion to False for now

* Add sampling and tests. Fix a rounding error in a test. Fix a not none error in numpy_eigen_solver.py.

* Add array methods to OpVec. Fix typo in OpPauli. Allow reverse_endianness in to_opflow for WeightedPauli.

* Make NumpyEigensolver return a StateFn in result.eigenstate.

* Fix flaky optimization tests. Fix OpVec so iterator interface works.

* Fix StateFnVector sampling. Fix sparse NumpyEigensolution. Fix some aux_op stuff. Fix some other things here and there. Please no more breakage.

* Change some sparsity stuff.

* fix spelling

* Typehints.

* More typehints

* fix copyright

* fix spelling

* More typehints, make globals immutable.

* fix style

* Rearrange tests, Add CZ to globals.

* Refactor some names.

* Rename OpEvolution to EvolutionOp. Tests pass.

* Rename primitive ops. All tests pass.

* Finish renamings.

* Test IBMQ Pauli expectation. All tests pass.

* Update spelling.

* Update Pauli to num_qubits.

* Updating some naming.

* Add diag support to fix knapsack issue.

* fix unit test

* fix unit test

* fix travis

* Turn half of Steve's comments.

* Fix some exponentiation things.

* Fix some exponentiation things.

* Add trotterization_factory. All tests pass.

* Add evolution_factory. All tests pass.

* Add circuit_sampler_factory. All tests pass.

* Rename get_primitives to primitive_strings. Turn some of Julien's changes.

* Only allow sample_circuits to accept circuit_ops. Tests pass.

* Turn more review changes

* fix spell, style

* Add matrix_op exp_i() into HamiltonianGate. Tests fail due to CircuitOp decompose() during composition. If commented out (line 158) tests pass.

* Change CircuitOp and StateFnCircuit to rely on QuantumCircuit instead of Instruction. All tests pass. Add to_circuit_op to relevant ops. Solves all the decompose issues.

* Add matrix_evolution and update QAOA to test matrix_op for cost operator. Add logic to update UCCSD to operator flow. Tests pass.

* Delete PauliToInstruction, as it's obsolete.

* Add to_pauli_op and tests. Tests pass.

* Fix composed_op.py eval bug

* Add sig digit rounding. VQE tests fail.

* better precision for sig digit rounding. Tests pass.

* Fix pep8, add comment

* Add to_circuit_op to statefns, making DictToCircuit mostly obsolete. Tests pass.

* fix cyclic imports

* fix numpy boolean to string coercion

* Update repr and a docstring.

* Make ExpectationValues into converters. Test pass.

* Fix bug from merge.

* Fix bugs, make Minus just a CircuitStateFn and not a ComposedOp.

* Uncomment HamiltonianGate

* Update lots of docstrings part I. Tests pass.

* fix docstring

* More docstrings. Change class.rst so docs are generated for some python operator overloads.

* Add navigation structure for docs to init files

* More docs.

* fix doctrings

* 1) Change local_simulator_sampler.py to circuit_sampler.py
2) Set up circuit_samplers directory to be removed.
3) Add IBMQ VQE test.
4) Change AerPauliExpectation and CircuitSampler to handle expval_measurement/snapshots correctly.

Tests pass.

* 1) Delete circuit_samplers.
2) Allow CircuitSampler to attach_results.

* Update Operator init

* Change Operator directory names. Tests pass.

* fix spell, docs

* Turn Expectations purely into converters. Tests pass.

* fix docs

* skip IBMQ test

* Add Converters docs. Tests pass.

* fix spell

* Add Evolutions docs. Tests pass.

* Add Expectation docs. Tests pass.

* fix spell

* Add StateFn docs. Tests pass.

* Fix typo.

* Add ListOp init docs.

* Fix some ordering

* Little docs edits.

* fix spell

* Little docs edits.

* 1) Add to_legacy_op to OperatorBase to allow non-migrated algos to accept new Operators.
2) Allow QPE and iQPE to accept new Operators, migrate tests. Tests pass.

* Fix typehints for minimum_eigen_solvers

* Make sure expectations can handle mixed observables.

* fix spell

* Turn some more of Steve's comments. Tests pass.

* Turn some more of Steve's comments. Fix a buncha parameter stuff, and make sure mixed Pauli evolution works.

* Turn some more of Steve's comments. Tests pass.

* Turn some comments, fix a QAOA bug.

* Try collapsing ListOp to_matrix a bit.

* Turn more comments, fix some bugs.

* Turn more comments, fix some bugs.

* Update ListOp docs.

* Update ListOp docs.

* Update ListOp docs.

* fix docstring

* Update minimum_eigen_solvers setter typehints.

* Add Changelog and tests for DictToCircuitSum.

* Update VQE's construct_circuit and some changelog elements.

* fix spell

* Allow MinEigenOptimizer to accept StateFn result in result.eigenstate.

* fix style

* Update changelog with more detail. Update VQE to call super.

* Typo

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
manoelmarques added a commit to qiskit-community/qiskit-machine-learning that referenced this pull request Feb 27, 2021
* Add abelian property to opvecs and AbelianGrouper to operator init.

* Break up PauliCoB big clifford synthesis function into smaller ones.

* Add AbelianGrouper test.

* Add better input checking in primitives and remove unnecessary print.

* Fix coeffs bugs in pauli_cob.py.

* Reorganize pauli_cob. All tests pass, with grouping on and off.

* Change expectation_value backends to work through setters.

* Reorganize local_simulator_sampler.py a bit to use it in a test.

* Grouping Paulis works!! All tests pass.

* Add "compute TPB pauli" function to pauli_cob.

* Add WIP attempt at evolution over Abelian paulis.

* Fix trotter bug.

* Fix some other Trotter bugs.

* Add parameters to OpPaulis and test. Parameterized evolution passes!!!

* Add parameter binding for Op coefficients.

* Add parameter binding, and binding tests. Tests pass.

* Add division to Operators to make normalization convenient.

* Finish merging MinEigenSolver PR. All tests pass.

* Update QAOA, all tests pass!!

* Update some QAOA imports and typehints.

* Add QDrift trotterization method. All tests pass.

* Start migrating QPE, tests fail.

* fix spell

* fix almost all style errors

* fix copyright

* fix import cycles, changed to relative imports when possible

* relative imports

* Add bind_params to state_fn_circuit.py and op_circuit.py, and tests. Add list unrolling for param binding, and tests. Tests pass.

* Add param list handling for all Op types.

* Make OpVec printing nicer.

* Add op_converter to imports for better backwards compatibility.

* Add AerPauliExpectation tests. Tests pass. Issue with Aer though.

* Fix a few AerPauliExpectation bugs

* Start building toward parameterized Qobj.

* fix some lint errors

* fix some lint errors

* fix style

* fix copyright

* set style to defaults, fix aqua unit test loading

* change loading tests qpe/iqpe

* Fix OpPrimitive lint errors.

* Fix operator_base.py lint errors.

* Fix state_fn.py lint errors.

* Fix OpVec lint errors.

* Fix state_fn_circuit.py lint errors.

* Fix state_fn_dict.py lint errors.

* Fix state_fn_operator.py lint errors.

* Fix state_fn_vector.py lint errors. Tests pass.

* Fix QDrift test to deal with first Op in trotterization list being OpCircuit.

* Fix op_circuit.py lint errors.

* Fix op_pauli.py lint errors.

* Fix op_composition.py lint errors.

* Fix op_kron.py lint errors.

* Fix abelian_grouper.py lint errors. Tests pass.

* Fix pauli_cob.py lint errors. Tests pass.

* Fix Expectation lint errors. Tests pass.

* Fix circuit sampler lint errors. Tests pass.

* Fix other expectation lint errors. Tests pass.

* Fix trotterization lint errors. Tests pass.

* Add MatrixEvolution shell, fix evolution lint errors.

* Fix bug in evolution tests after fixing lint errors.

* Fix cyclic import for lint.

* fix pylint cyclic import error

* Make tests pass. Add aux_ops back to VQE, and make VQE and QAOA take old or new ops.

* fix spell and lint

* Fix swapping issue in evolution.

* Fix composition in OpEvolution.

* Fix add OpSum and kron OpKron in OpEvolution.

* Add to_opflow to legacy base_operator

* Clean OpCircuit and StateFnCircuit __str__

* Fix qaoa mixer.

* fix spell,style

* Ok now really all tests pass.

* add to_matrix_op() methods to ops.

* Start migrating NumpyEigensolver for Opflow

* Start removing back from op_primitive eval functions. All tests pass.

* Update eval logic (to be able to remove back) for operator_combos.

* Add to_matrix_op for OpMatrix and StateFnVector, and change some `if back`s to `if back is not None`

* Finish decoupling back args from evals. All tests pass.

* Remove back from eval logic.

* Remove back from eval. All tests pass.

* Change matrix_expectation.py to rely on to_matrix_op.

* Migrate numpy_eigen_solver.py and numpy_minimum_eigen_solver.

* Remove ToMatrixOp converter.

* set VQE _auto_conversion to False for now

* Add sampling and tests. Fix a rounding error in a test. Fix a not none error in numpy_eigen_solver.py.

* Add array methods to OpVec. Fix typo in OpPauli. Allow reverse_endianness in to_opflow for WeightedPauli.

* Make NumpyEigensolver return a StateFn in result.eigenstate.

* Fix flaky optimization tests. Fix OpVec so iterator interface works.

* Fix StateFnVector sampling. Fix sparse NumpyEigensolution. Fix some aux_op stuff. Fix some other things here and there. Please no more breakage.

* Change some sparsity stuff.

* fix spelling

* Typehints.

* More typehints

* fix copyright

* fix spelling

* More typehints, make globals immutable.

* fix style

* Rearrange tests, Add CZ to globals.

* Refactor some names.

* Rename OpEvolution to EvolutionOp. Tests pass.

* Rename primitive ops. All tests pass.

* Finish renamings.

* Test IBMQ Pauli expectation. All tests pass.

* Update spelling.

* Update Pauli to num_qubits.

* Updating some naming.

* Add diag support to fix knapsack issue.

* fix unit test

* fix unit test

* fix travis

* Turn half of Steve's comments.

* Fix some exponentiation things.

* Fix some exponentiation things.

* Add trotterization_factory. All tests pass.

* Add evolution_factory. All tests pass.

* Add circuit_sampler_factory. All tests pass.

* Rename get_primitives to primitive_strings. Turn some of Julien's changes.

* Only allow sample_circuits to accept circuit_ops. Tests pass.

* Turn more review changes

* fix spell, style

* Add matrix_op exp_i() into HamiltonianGate. Tests fail due to CircuitOp decompose() during composition. If commented out (line 158) tests pass.

* Change CircuitOp and StateFnCircuit to rely on QuantumCircuit instead of Instruction. All tests pass. Add to_circuit_op to relevant ops. Solves all the decompose issues.

* Add matrix_evolution and update QAOA to test matrix_op for cost operator. Add logic to update UCCSD to operator flow. Tests pass.

* Delete PauliToInstruction, as it's obsolete.

* Add to_pauli_op and tests. Tests pass.

* Fix composed_op.py eval bug

* Add sig digit rounding. VQE tests fail.

* better precision for sig digit rounding. Tests pass.

* Fix pep8, add comment

* Add to_circuit_op to statefns, making DictToCircuit mostly obsolete. Tests pass.

* fix cyclic imports

* fix numpy boolean to string coercion

* Update repr and a docstring.

* Make ExpectationValues into converters. Test pass.

* Fix bug from merge.

* Fix bugs, make Minus just a CircuitStateFn and not a ComposedOp.

* Uncomment HamiltonianGate

* Update lots of docstrings part I. Tests pass.

* fix docstring

* More docstrings. Change class.rst so docs are generated for some python operator overloads.

* Add navigation structure for docs to init files

* More docs.

* fix doctrings

* 1) Change local_simulator_sampler.py to circuit_sampler.py
2) Set up circuit_samplers directory to be removed.
3) Add IBMQ VQE test.
4) Change AerPauliExpectation and CircuitSampler to handle expval_measurement/snapshots correctly.

Tests pass.

* 1) Delete circuit_samplers.
2) Allow CircuitSampler to attach_results.

* Update Operator init

* Change Operator directory names. Tests pass.

* fix spell, docs

* Turn Expectations purely into converters. Tests pass.

* fix docs

* skip IBMQ test

* Add Converters docs. Tests pass.

* fix spell

* Add Evolutions docs. Tests pass.

* Add Expectation docs. Tests pass.

* fix spell

* Add StateFn docs. Tests pass.

* Fix typo.

* Add ListOp init docs.

* Fix some ordering

* Little docs edits.

* fix spell

* Little docs edits.

* 1) Add to_legacy_op to OperatorBase to allow non-migrated algos to accept new Operators.
2) Allow QPE and iQPE to accept new Operators, migrate tests. Tests pass.

* Fix typehints for minimum_eigen_solvers

* Make sure expectations can handle mixed observables.

* fix spell

* Turn some more of Steve's comments. Tests pass.

* Turn some more of Steve's comments. Fix a buncha parameter stuff, and make sure mixed Pauli evolution works.

* Turn some more of Steve's comments. Tests pass.

* Turn some comments, fix a QAOA bug.

* Try collapsing ListOp to_matrix a bit.

* Turn more comments, fix some bugs.

* Turn more comments, fix some bugs.

* Update ListOp docs.

* Update ListOp docs.

* Update ListOp docs.

* fix docstring

* Update minimum_eigen_solvers setter typehints.

* Add Changelog and tests for DictToCircuitSum.

* Update VQE's construct_circuit and some changelog elements.

* fix spell

* Allow MinEigenOptimizer to accept StateFn result in result.eigenstate.

* fix style

* Update changelog with more detail. Update VQE to call super.

* Typo

Co-authored-by: Manoel Marques <manoel@us.ibm.com>
Co-authored-by: woodsp <woodsp@us.ibm.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants