Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpRefactor] Add static compute_diagonalizing_gates method #1993

Merged
merged 46 commits into from
Dec 17, 2021

Conversation

mariaschuld
Copy link
Contributor

@mariaschuld mariaschuld commented Dec 7, 2021

Context:

To make diagonalizing_gates consistent with other representations, we add a static method, which is called in the dynamic one. Operators can either overwrite both (i.e. to define a custom signature for the former), or just define the static method.

Description of the Change:

Added default method, updated observables and added tests. Considerably improved the docstrings, including examples.

@mariaschuld mariaschuld changed the base branch from master to op-move-diaggates December 7, 2021 13:32
@codecov
Copy link

codecov bot commented Dec 8, 2021

Codecov Report

❗ No coverage uploaded for pull request base (op-refactor@f34bc37). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff               @@
##             op-refactor    #1993   +/-   ##
==============================================
  Coverage               ?   99.17%           
==============================================
  Files                  ?      221           
  Lines                  ?    16873           
  Branches               ?        0           
==============================================
  Hits                   ?    16733           
  Misses                 ?      140           
  Partials               ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f34bc37...5e0d908. Read the comment docs.

@mariaschuld mariaschuld changed the title [WIP][OpRefactor] Add static_diagonalizing_gates method [OpRefactor] Add static compute_diagonalizing_gates method Dec 13, 2021
pennylane/operation.py Outdated Show resolved Hide resolved
@@ -159,9 +176,6 @@ def _matrix(cls, *params):
raise TypeError("Observable must be a scipy sparse coo_matrix.")
return A

def diagonalizing_gates(self):
return []
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what the intention of this is, but it seems misleading to pretend the Hamiltonian is diagonal?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must have been to avoid an error that was occurring downstream due to something assuming diagonalizing_gates exists. Might be worth checking the PR that introduces SparseHamiltonian, maybe #1579?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was the wrong PR link 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soranjh I wonder if you could have a look...do you remember if this method has any significance?

Or can we remove it (since it implies that all SparseHamiltonian objects are diagonal)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is required I think after playing around with the generators PR!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added this for consistency with other observables that do not have specific diagonalizing_gates. We also have the same method for the Projector class.

I removed this method in a branch and performed a VQE task with a sparse Hamiltonian for BeH2 and the results were accurate. Not sure if removing the method affects other tests or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @soranjh!

I think even before this PR, "no diag gates defined" was different from "empty diaggates", so I hope we do ourselves a favour by removing this here - it suggests that the op is diagonal... (and a sign how hard it is for developers to see through the old system of representations).

Or @josh146 do the generators give us a problem? I fear even in this case we need to try and return the correct gates here, so I remove it for now!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariaschuld now that I am fresh from doing the generator refactor, so much of the codebase assumes that:

  • op.diagonalizing_gates() raises not implemented error: not defined
  • op.diagonalizing_gates() returns empty list: diagonal!

which is quite nice? But yes I agree, we should reserve an empty list for diagonal operators (e.g., projector) and instead use None (or a registration system) for those that don't define diagonalizing gates.

@mariaschuld mariaschuld requested review from josh146 and albi3ro and removed request for josh146 December 13, 2021 13:25
Base automatically changed from op-move-diaggates to op-refactor December 15, 2021 08:47
pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/operation.py Outdated Show resolved Hide resolved
inputs (even if the diagonalizing gates are independent of these values).

Alternatively, a custom signature can be defined, in which case the `diagonalizing_gates()`
method has to be overwritten to use the right signature.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope this communicates the idea to developers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It reads well to me 🙂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might actually suggest removing this?

Alternatively, a custom signature can be defined, in which case the `diagonalizing_gates()`
method has to be overwritten to use the right signature.

it might add a bit too much complexity to parse

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it may be important if you're trying to do overwrite the method? So you remember that you have to overwrite something else too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - I guess my direction of thought was more: if I was a user reading this docstring (because I want to use op.diagonalizing_gates(), I would be confused by this statement, and might think I have to subclass or something.

So I like delineating quite explicitly "For developers or people that are making their own operations:..."

to ``op.hyperparameters``, and ``op`` is an instance of this operator.

If a subclass overwrites ``compute_diagonalizing_gates`` to use a custom signature,
this method has to be likewise overwritten to respect that signature.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, is this enough to tell you how to overwrite?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm almost wondering if we should simplify this significantly, e.g., replace the note with

.. seealso:: Developers should define :meth:`~.compute_diagonalization` for this method to work correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too worried about a long note, as long as it explains well. Is the shorter one clearer or just shorter? :)

I always appreciate when people give me detailed instructions in code...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the shorter one clearer or just shorter? :)

Perhaps I am conflating the two 😆

My main motiviation (as mentioned in a previous comment) was:

  • making this standout (the yellow background)
  • explicitly calling out who this sentence is important for (those making their own operations). Users using this operation can ignore it.

Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on my end @mariaschuld!

pennylane/operation.py Outdated Show resolved Hide resolved
inputs (even if the diagonalizing gates are independent of these values).

Alternatively, a custom signature can be defined, in which case the `diagonalizing_gates()`
method has to be overwritten to use the right signature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It reads well to me 🙂

inputs (even if the diagonalizing gates are independent of these values).

Alternatively, a custom signature can be defined, in which case the `diagonalizing_gates()`
method has to be overwritten to use the right signature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might actually suggest removing this?

Alternatively, a custom signature can be defined, in which case the `diagonalizing_gates()`
method has to be overwritten to use the right signature.

it might add a bit too much complexity to parse

pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/operation.py Outdated Show resolved Hide resolved
to ``op.hyperparameters``, and ``op`` is an instance of this operator.

If a subclass overwrites ``compute_diagonalizing_gates`` to use a custom signature,
this method has to be likewise overwritten to respect that signature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm almost wondering if we should simplify this significantly, e.g., replace the note with

.. seealso:: Developers should define :meth:`~.compute_diagonalization` for this method to work correctly.

pennylane/operation.py Outdated Show resolved Hide resolved
Comment on lines +141 to 146
r"""Diagonalizing gates of this operator.

For the Pauli-X operator,
These gates rotate the specified wires such that they
are in the eigenbasis of PauliX:

.. math:: X = H^\dagger Z H.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing 💯 (and actually a huge effort to do!)

Only two very minor thoughts:

  • except for this docstring(?) we have placed other numerical representation in the class docstring, since this is much more visible to readers, e.g., image, so this would mark a change in convention.

  • it feels slightly odd to use inheritance here, but then redefine the docstring (since part of the nicety of inheritance is inheriting the docstring!). But this was the case before your PR, your PR actually tidies it up and makes it a lot nicer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think we should add examples and specific docstrings whereever possible, even if it multiplies the information? No harm in having the equation in the class docstring as well... and even after adding the examples now, I consulted them a lot to write tests! :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right!

Comment on lines +122 to +126
>>> A = np.array([[-6, 2 + 1j], [2 - 1j, 0]])
>>> _, evecs = np.linalg.eigh(A)
>>> qml.Hermitian.compute_diagonalizing_gates(evecs, wires=[0])
[QubitUnitary(tensor([[-0.94915323-0.j, 0.2815786 +0.1407893j ],
[ 0.31481445-0.j, 0.84894846+0.42447423j]], requires_grad=True), wires=[0])]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon reading this again, I wonder why we do not pass A to the compute_diagonalizing_gates method, instead of evacs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems most intuitive to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this one of the few cases where the init method does some computation that we don't want to loose. At the moment I am solving this by changing what gets put into the compute method...I am in two minds about this though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah same. I must admit, if I was coding up the class myself, my intuition would be to do exactly what the templates do; process in init, and then store in hyperparameters. This is partly because hyperparameters is not user-facing; it feels like a place where developers can store the 'real' hyperparameters lol

@@ -159,9 +176,6 @@ def _matrix(cls, *params):
raise TypeError("Observable must be a scipy sparse coo_matrix.")
return A

def diagonalizing_gates(self):
return []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is required I think after playing around with the generators PR!

@mariaschuld mariaschuld merged commit ea47c53 into op-refactor Dec 17, 2021
@mariaschuld mariaschuld deleted the add_static_diaggates branch December 17, 2021 08:11
mariaschuld added a commit that referenced this pull request Feb 16, 2022
* remove string_for_inverse

* fix accidental push

* [OpRefractor] remove `string_for_inverse` (#2021)

* remove string_for_inverse

* remove string_for_inverse for device

* black

* Update doc/releases/changelog-dev.md

* [OpRefactor] add temporary hyperparameter attribute (#2017)

* add test and attribute

* black

* fix coverage

* polish

* changelog

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Apply suggestions from code review

Co-authored-by: Christina Lee <christina@xanadu.ai>

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>

* [OpRefactor] Move diagonalizing_gates method to Operator (#1985)

* move method and update docstrings in evals

* black

* revert to NotImplementedError

* fix queuing issue

* polish

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update the `Operation.generator` property (#2030)

* more

* more

* more

* more

* fixes

* fixes

* all tests passing

* fix

* more

* Apply suggestions from code review

* add to changelog

* [OpRefactor] Add static compute_diagonalizing_gates method (#1993)

* move method and update docstrings in evals

* black

* revert to NotImplementedError

* fix queuing issue

* add compute_diag_gates method

* backup

* add test and attribute

* black

* polish

* polish signatures

* black

* fix docstring

* fix signature

* polish

* make wires an arg

* fix coverage

* Update pennylane/operation.py

Co-authored-by: Christina Lee <christina@xanadu.ai>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* change signatures

* improve docstring

* small fix

* Apply suggestions from code review

* better docstrings

* add examples everywhere

* more docstring polish

* add docstring for identity

* hermitian better example

* black

* suggestions code review

Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Fix dev branch after merging master (#2047)

* use get_generator func

* add a lot of pylints

* fix failing test

* move pylints

* black

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Upgrade matrix methods (#1996)

* change matrix methods

* clean up basic methods

* changed matrix to matrix()

* black

* fix test

* fix Hadamard gate

* changelog

* fix some more small issues

* some more fixes

* make (almost) all _matrix methods static

* backup

* add test and attribute

* black

* fix coverage

* polish

* changelog

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* blackup

* wrote up new usage

* correct changelog

* add some tests for expand-matrix

* black

* fix some tests

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* replace expand logic in get_unitary

* fix multirz inverse

* fix minor pauli_eigs error

* fix qft error

* resolve conflict

* fix all test but the BIG ISSUE

* change signature, part 1

* finish dosctrings

* black

* all minor problems cleared again

* polish

* more polish and black

* fix docstrings, fix ControlledQubitUNitary

* changelog polish

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* backup

* implement suggestions josh

* black

* redesigned ControlledQubitUnitary

* backup

* revert to NotImplementedErrors

* typo

* black

* delete superfluous matrix methods

* delete superfluous arg

* fix tests

* black

* hopefully fix failing test

* fix codecoverage

* fix last coverage issue

* backup

* add hyperparameters and pylints

* black

* Update pennylane/operation.py

Co-authored-by: Christina Lee <christina@xanadu.ai>

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>

* [OpRefactor] Add terms and compute_terms (#2036)

* black and changelog

* fix typo

* fixed fermionic terms

* black

* backup

* fix

* simpler implementation

* minor updates

* fix some tests

* fix tests

* polishing

* add test

* fix docstring formatting

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* suggestions josh

* Update pennylane/ops/qubit/hamiltonian.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* add pylints (#2052)

* [OpRefactor] Rename wires as wire_order in heisenberg ops (#2051)

* rename

* update changelog

* [OpRefactor] Update eigenvalue representations (#2048)

* fix tests

* black

* increase codecov

* black

* josh suggestions

* move default to eigvals() and make everything static

* apply suggestions josh

* Apply suggestions from code review

* [OpRefactor] Add sparse_matrix and compute_sparse_matrix methods (#2050)

* basic changes

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* josh suggestions

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Update kraus representations (#2055)

* rename

* dicstrings

* fix docstring

* minor fix to test

* Update doc/releases/changelog-dev.md

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* black

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] `decomposition` and `compute_decomposition` methods in `Operator` base class (#2024)

* decomposition and compute decomposition methods

* adding some more ops

* more consistent across qubit ops, return as tuple

* start adding templates

* move hyperparameters defintions

* update templates in a later PR

* tests

* fixing tests

* more test fixes

* final test fix!

* docstrings, interface device tests

* black, tests for coverage

* changelog and docstrings

* docstrings

* more child class docstrings

* Update doc/releases/changelog-dev.md

Co-authored-by: Josh Izaac <josh146@gmail.com>

* nodecompositionerror, test new docstrings

* docstring fixes

* merge conflict

* docstring fixes and minor updates

* barrier doc change

* test fixing, parametric op docstrings

* final docstrings, black

* qft docstring

* black, fix test

* remove unused import

* black, fix multicontrolledx

* fix tests, black

* fixing more tests

* hopefully the last breaking tests

* enhance code coverage

* fix some problems from merging

* pin sphinx

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* [OpRefactor] Update the generator to raise an exception if not defined (#2061)

* Update the generator to raise an exception if not defined

* fixes

* fixes

* fixes

* fix

* [OpRefactor] Add custom errors when representations are undefined (#2064)

* add errors and tests, use errors

* small fix

* change one more None to Error

* delete obsolete line

* fix tests

* black

* update changelog

* [OpRefactor] fix codefactor (#2067)

* fix codefactor

* restore lines

* delete again

* `Tensor.matrix`: Warnings for partial wires overlaps and unsorted wire repetition (#2013)

* implement sorting before grouping and check partial wires overlaps.

* changelog

* black

* tests

* tiny

* reduce PR to warnings

* lint

* old python sum

* black

* code review

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* restructure warning logic

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* changes applied

* Apply suggestions from code review

* black

* one more test fixed

* [OpRefactor] Update dev guide to explain the new operator abstraction (#2066)

* add previous changes

* add graphic

* rewrite architecture overview

* rewrite op guide

* add differentiation

* fomatting

* polish

* polish

* polish

* black

* formatting

* fix sphinx?

* some dashes

* josh comments

* major polish

* minor details

* minor improvement

* more polishing

* fix link

* fix qasm precision

* changing qasm tests back

* Update doc/development/adding_operators.rst

Co-authored-by: Josh Izaac <josh146@gmail.com>

* suggestions Josh 1

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* backup

* minor improvements

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>

* Update doc/development/guide/architecture.rst

* Update doc/development/adding_operators.rst

* change images, fix link

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>

* Update Operation call signatures to match doc string  (#1976)

* Updated parameteric_ops to match docs call signature

* finished updating all of the ops

* Added wires arg to SparseHamiltonian

* updating some of cv ops

* updating call signature for more ops

* updated callsigns

* updated changelog

* disable too many args error for code factor

* replaced lam with delta

* Removed Sphinx Override

* fixed bug with TensorN observable

* Update doc/releases/changelog-dev.md

Co-authored-by: David Ittah <dime10@users.noreply.github.com>

Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>

* [OpRefactor] Use decomposition in templates (#2053)

* decomposition and compute decomposition methods

* adding some more ops

* more consistent across qubit ops, return as tuple

* start adding templates

* move hyperparameters defintions

* update templates in a later PR

* tests

* fixing tests

* more test fixes

* final test fix!

* docstrings, interface device tests

* black, tests for coverage

* changelog and docstrings

* docstrings

* more child class docstrings

* Update doc/releases/changelog-dev.md

Co-authored-by: Josh Izaac <josh146@gmail.com>

* nodecompositionerror, test new docstrings

* docstring fixes

* merge conflict

* docstring fixes and minor updates

* barrier doc change

* test fixing, parametric op docstrings

* final docstrings, black

* qft docstring

* black, fix test

* embeddings started to refactor

* embeddings done

* backup

* layers done

* statepreps done

* backup

* done subroutines

* backup

* fix tests except grover, timeevol, commuting

* black

* fix last three tests

* black

* black

* fix tests

* mottonnen fixed

* update changelog

* fixes, including sphinx

* backup

* Fix tape expand tests (#2065)

* fixes

* more

* more

* more

* more

* more

* more

* black

* delete faulty import

* improve codecoverage

* improve coverage by one line

* port one bug fix from other branch

* backup

* suggestions Josh 1

* redo changes in reset files

* rewrite op_list extension

* black

* fix tests

* change ttn

* make pylint happy

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>

* black

* black

* revert

* adapt isingzz eval function

* backup

* fix all tests except from the batch one

* upgraded version of black and blackened again

* [OpRefactor] Final clean-up of operator subclasses (#2131)

* dummy change to open pr

* clean docstrings

* backup

* port some changes from operation.py PR

* clean docstrings of classes

* black

* minor sphinx fix

* make docstrings similar

* more cleaning, and revert BasisStatePrep for test passing

* black

* upgraded version of black and blackened again

* fix

* fix

* fix bug

* merge master

* linting

* remove print label

* [WIP] Renaming (#2189)

* more

* more

* more

* more

* more

* more

* more

* rename eigvals to get_eigvals()

* black

* update eigvals in tests

* tensor eigvals

* fix

* more

* Update pennylane/operation.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* update deprecation warning

* more

* add deprecation tests

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* coverage

Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: David Wierichs <davidwierichs@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>
dwierichs added a commit that referenced this pull request Feb 17, 2022
* remove string_for_inverse

* fix accidental push

* [OpRefractor] remove `string_for_inverse` (#2021)

* remove string_for_inverse

* remove string_for_inverse for device

* black

* Update doc/releases/changelog-dev.md

* [OpRefactor] add temporary hyperparameter attribute (#2017)

* add test and attribute

* black

* fix coverage

* polish

* changelog

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Apply suggestions from code review

Co-authored-by: Christina Lee <christina@xanadu.ai>

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>

* [OpRefactor] Move diagonalizing_gates method to Operator (#1985)

* move method and update docstrings in evals

* black

* revert to NotImplementedError

* fix queuing issue

* polish

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update the `Operation.generator` property (#2030)

* more

* more

* more

* more

* fixes

* fixes

* all tests passing

* fix

* more

* Apply suggestions from code review

* add to changelog

* [OpRefactor] Add static compute_diagonalizing_gates method (#1993)

* move method and update docstrings in evals

* black

* revert to NotImplementedError

* fix queuing issue

* add compute_diag_gates method

* backup

* add test and attribute

* black

* polish

* polish signatures

* black

* fix docstring

* fix signature

* polish

* make wires an arg

* fix coverage

* Update pennylane/operation.py

Co-authored-by: Christina Lee <christina@xanadu.ai>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* change signatures

* improve docstring

* small fix

* Apply suggestions from code review

* better docstrings

* add examples everywhere

* more docstring polish

* add docstring for identity

* hermitian better example

* black

* suggestions code review

Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Fix dev branch after merging master (#2047)

* use get_generator func

* add a lot of pylints

* fix failing test

* move pylints

* black

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Upgrade matrix methods (#1996)

* change matrix methods

* clean up basic methods

* changed matrix to matrix()

* black

* fix test

* fix Hadamard gate

* changelog

* fix some more small issues

* some more fixes

* make (almost) all _matrix methods static

* backup

* add test and attribute

* black

* fix coverage

* polish

* changelog

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* blackup

* wrote up new usage

* correct changelog

* add some tests for expand-matrix

* black

* fix some tests

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* replace expand logic in get_unitary

* fix multirz inverse

* fix minor pauli_eigs error

* fix qft error

* resolve conflict

* fix all test but the BIG ISSUE

* change signature, part 1

* finish dosctrings

* black

* all minor problems cleared again

* polish

* more polish and black

* fix docstrings, fix ControlledQubitUNitary

* changelog polish

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* backup

* implement suggestions josh

* black

* redesigned ControlledQubitUnitary

* backup

* revert to NotImplementedErrors

* typo

* black

* delete superfluous matrix methods

* delete superfluous arg

* fix tests

* black

* hopefully fix failing test

* fix codecoverage

* fix last coverage issue

* backup

* add hyperparameters and pylints

* black

* Update pennylane/operation.py

Co-authored-by: Christina Lee <christina@xanadu.ai>

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>

* [OpRefactor] Add terms and compute_terms (#2036)

* black and changelog

* fix typo

* fixed fermionic terms

* black

* backup

* fix

* simpler implementation

* minor updates

* fix some tests

* fix tests

* polishing

* add test

* fix docstring formatting

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* suggestions josh

* Update pennylane/ops/qubit/hamiltonian.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* add pylints (#2052)

* [OpRefactor] Rename wires as wire_order in heisenberg ops (#2051)

* rename

* update changelog

* [OpRefactor] Update eigenvalue representations (#2048)

* fix tests

* black

* increase codecov

* black

* josh suggestions

* move default to eigvals() and make everything static

* apply suggestions josh

* Apply suggestions from code review

* [OpRefactor] Add sparse_matrix and compute_sparse_matrix methods (#2050)

* basic changes

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* josh suggestions

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Update kraus representations (#2055)

* rename

* dicstrings

* fix docstring

* minor fix to test

* Update doc/releases/changelog-dev.md

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* black

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] `decomposition` and `compute_decomposition` methods in `Operator` base class (#2024)

* decomposition and compute decomposition methods

* adding some more ops

* more consistent across qubit ops, return as tuple

* start adding templates

* move hyperparameters defintions

* update templates in a later PR

* tests

* fixing tests

* more test fixes

* final test fix!

* docstrings, interface device tests

* black, tests for coverage

* changelog and docstrings

* docstrings

* more child class docstrings

* Update doc/releases/changelog-dev.md

Co-authored-by: Josh Izaac <josh146@gmail.com>

* nodecompositionerror, test new docstrings

* docstring fixes

* merge conflict

* docstring fixes and minor updates

* barrier doc change

* test fixing, parametric op docstrings

* final docstrings, black

* qft docstring

* black, fix test

* remove unused import

* black, fix multicontrolledx

* fix tests, black

* fixing more tests

* hopefully the last breaking tests

* enhance code coverage

* fix some problems from merging

* pin sphinx

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* [OpRefactor] Update the generator to raise an exception if not defined (#2061)

* Update the generator to raise an exception if not defined

* fixes

* fixes

* fixes

* fix

* [OpRefactor] Add custom errors when representations are undefined (#2064)

* add errors and tests, use errors

* small fix

* change one more None to Error

* delete obsolete line

* fix tests

* black

* update changelog

* [OpRefactor] fix codefactor (#2067)

* fix codefactor

* restore lines

* delete again

* `Tensor.matrix`: Warnings for partial wires overlaps and unsorted wire repetition (#2013)

* implement sorting before grouping and check partial wires overlaps.

* changelog

* black

* tests

* tiny

* reduce PR to warnings

* lint

* old python sum

* black

* code review

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* restructure warning logic

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* changes applied

* Apply suggestions from code review

* black

* one more test fixed

* [OpRefactor] Update dev guide to explain the new operator abstraction (#2066)

* add previous changes

* add graphic

* rewrite architecture overview

* rewrite op guide

* add differentiation

* fomatting

* polish

* polish

* polish

* black

* formatting

* fix sphinx?

* some dashes

* josh comments

* major polish

* minor details

* minor improvement

* more polishing

* fix link

* fix qasm precision

* changing qasm tests back

* Update doc/development/adding_operators.rst

Co-authored-by: Josh Izaac <josh146@gmail.com>

* suggestions Josh 1

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* backup

* minor improvements

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>

* Update doc/development/guide/architecture.rst

* Update doc/development/adding_operators.rst

* change images, fix link

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>

* Update Operation call signatures to match doc string  (#1976)

* Updated parameteric_ops to match docs call signature

* finished updating all of the ops

* Added wires arg to SparseHamiltonian

* updating some of cv ops

* updating call signature for more ops

* updated callsigns

* updated changelog

* disable too many args error for code factor

* replaced lam with delta

* Removed Sphinx Override

* fixed bug with TensorN observable

* Update doc/releases/changelog-dev.md

Co-authored-by: David Ittah <dime10@users.noreply.github.com>

Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>

* [OpRefactor] Use decomposition in templates (#2053)

* decomposition and compute decomposition methods

* adding some more ops

* more consistent across qubit ops, return as tuple

* start adding templates

* move hyperparameters defintions

* update templates in a later PR

* tests

* fixing tests

* more test fixes

* final test fix!

* docstrings, interface device tests

* black, tests for coverage

* changelog and docstrings

* docstrings

* more child class docstrings

* Update doc/releases/changelog-dev.md

Co-authored-by: Josh Izaac <josh146@gmail.com>

* nodecompositionerror, test new docstrings

* docstring fixes

* merge conflict

* docstring fixes and minor updates

* barrier doc change

* test fixing, parametric op docstrings

* final docstrings, black

* qft docstring

* black, fix test

* embeddings started to refactor

* embeddings done

* backup

* layers done

* statepreps done

* backup

* done subroutines

* backup

* fix tests except grover, timeevol, commuting

* black

* fix last three tests

* black

* black

* fix tests

* mottonnen fixed

* update changelog

* fixes, including sphinx

* backup

* Fix tape expand tests (#2065)

* fixes

* more

* more

* more

* more

* more

* more

* black

* delete faulty import

* improve codecoverage

* improve coverage by one line

* port one bug fix from other branch

* backup

* suggestions Josh 1

* redo changes in reset files

* rewrite op_list extension

* black

* fix tests

* change ttn

* make pylint happy

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>

* black

* black

* revert

* adapt isingzz eval function

* backup

* fix all tests except from the batch one

* upgraded version of black and blackened again

* [OpRefactor] Final clean-up of operator subclasses (#2131)

* dummy change to open pr

* clean docstrings

* backup

* port some changes from operation.py PR

* clean docstrings of classes

* black

* minor sphinx fix

* make docstrings similar

* more cleaning, and revert BasisStatePrep for test passing

* black

* upgraded version of black and blackened again

* first step

* reduce step

* undo has_gen

* tests

* changelog

* restore grad_recipe

* black

* fix orbitalrotation gradient

* docstring

* lint

* add gradient bug fix for OrbitalRotaiton to changelog

* fix

* tests for parameter frequencies

* test coverage

* copy JacobianTape methods to parameter_shift.py

* fix

* Revert "copy JacobianTape methods to parameter_shift.py"

This reverts commit 3be9806.

* use parameter_frequencies for shift rule. adapt tests. add parameter_frequencies to operation.grad_method

* black

* changelog

* whitespace

* debugging

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* add eight-term rule to OrbitalRotation

* formatting of frequencies

* orbital

* doc

* make frequencies a property

* test

* adapt tests to frequencies being property

* adapt to parameter_frequencies as property

* adapt more tests

* more

* more

* simplify util functions a bit

* fix bug

* merge master

* linting

* remove print label

* [WIP] Renaming (#2189)

* more

* more

* more

* more

* more

* more

* more

* rename eigvals to get_eigvals()

* black

* update eigvals in tests

* tensor eigvals

* fix

* more

* Update pennylane/operation.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* update deprecation warning

* more

* add deprecation tests

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* test coverage

* lint

* lint abstractmethod

* coverage

* tests for default grad_method

* remove old prints

* test coverage

* black

* undo move of JacobianTape methods

* pointless statement is not pointless

* black

* some linting

* print reintroduce

* wrong local pylint

* more fiddling with pylint

* docstring shifts

* test_draw

* test_draw_1

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* drawing tests

* make _process_shifts public

* rename no_duplicates to check_duplicates

* remove unnecessary lint disable

* black

* merge master

Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>
dwierichs added a commit that referenced this pull request Feb 17, 2022
* remove string_for_inverse

* fix accidental push

* [OpRefractor] remove `string_for_inverse` (#2021)

* remove string_for_inverse

* remove string_for_inverse for device

* black

* Update doc/releases/changelog-dev.md

* [OpRefactor] add temporary hyperparameter attribute (#2017)

* add test and attribute

* black

* fix coverage

* polish

* changelog

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Apply suggestions from code review

Co-authored-by: Christina Lee <christina@xanadu.ai>

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>

* [OpRefactor] Move diagonalizing_gates method to Operator (#1985)

* move method and update docstrings in evals

* black

* revert to NotImplementedError

* fix queuing issue

* polish

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update the `Operation.generator` property (#2030)

* more

* more

* more

* more

* fixes

* fixes

* all tests passing

* fix

* more

* Apply suggestions from code review

* add to changelog

* [OpRefactor] Add static compute_diagonalizing_gates method (#1993)

* move method and update docstrings in evals

* black

* revert to NotImplementedError

* fix queuing issue

* add compute_diag_gates method

* backup

* add test and attribute

* black

* polish

* polish signatures

* black

* fix docstring

* fix signature

* polish

* make wires an arg

* fix coverage

* Update pennylane/operation.py

Co-authored-by: Christina Lee <christina@xanadu.ai>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* change signatures

* improve docstring

* small fix

* Apply suggestions from code review

* better docstrings

* add examples everywhere

* more docstring polish

* add docstring for identity

* hermitian better example

* black

* suggestions code review

Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Fix dev branch after merging master (#2047)

* use get_generator func

* add a lot of pylints

* fix failing test

* move pylints

* black

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Upgrade matrix methods (#1996)

* change matrix methods

* clean up basic methods

* changed matrix to matrix()

* black

* fix test

* fix Hadamard gate

* changelog

* fix some more small issues

* some more fixes

* make (almost) all _matrix methods static

* backup

* add test and attribute

* black

* fix coverage

* polish

* changelog

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* blackup

* wrote up new usage

* correct changelog

* add some tests for expand-matrix

* black

* fix some tests

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* replace expand logic in get_unitary

* fix multirz inverse

* fix minor pauli_eigs error

* fix qft error

* resolve conflict

* fix all test but the BIG ISSUE

* change signature, part 1

* finish dosctrings

* black

* all minor problems cleared again

* polish

* more polish and black

* fix docstrings, fix ControlledQubitUNitary

* changelog polish

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* backup

* implement suggestions josh

* black

* redesigned ControlledQubitUnitary

* backup

* revert to NotImplementedErrors

* typo

* black

* delete superfluous matrix methods

* delete superfluous arg

* fix tests

* black

* hopefully fix failing test

* fix codecoverage

* fix last coverage issue

* backup

* add hyperparameters and pylints

* black

* Update pennylane/operation.py

Co-authored-by: Christina Lee <christina@xanadu.ai>

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>

* [OpRefactor] Add terms and compute_terms (#2036)

* black and changelog

* fix typo

* fixed fermionic terms

* black

* backup

* fix

* simpler implementation

* minor updates

* fix some tests

* fix tests

* polishing

* add test

* fix docstring formatting

* Update pennylane/operation.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

* suggestions josh

* Update pennylane/ops/qubit/hamiltonian.py

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* add pylints (#2052)

* [OpRefactor] Rename wires as wire_order in heisenberg ops (#2051)

* rename

* update changelog

* [OpRefactor] Update eigenvalue representations (#2048)

* fix tests

* black

* increase codecov

* black

* josh suggestions

* move default to eigvals() and make everything static

* apply suggestions josh

* Apply suggestions from code review

* [OpRefactor] Add sparse_matrix and compute_sparse_matrix methods (#2050)

* basic changes

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* josh suggestions

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] Update kraus representations (#2055)

* rename

* dicstrings

* fix docstring

* minor fix to test

* Update doc/releases/changelog-dev.md

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* black

Co-authored-by: Josh Izaac <josh146@gmail.com>

* [OpRefactor] `decomposition` and `compute_decomposition` methods in `Operator` base class (#2024)

* decomposition and compute decomposition methods

* adding some more ops

* more consistent across qubit ops, return as tuple

* start adding templates

* move hyperparameters defintions

* update templates in a later PR

* tests

* fixing tests

* more test fixes

* final test fix!

* docstrings, interface device tests

* black, tests for coverage

* changelog and docstrings

* docstrings

* more child class docstrings

* Update doc/releases/changelog-dev.md

Co-authored-by: Josh Izaac <josh146@gmail.com>

* nodecompositionerror, test new docstrings

* docstring fixes

* merge conflict

* docstring fixes and minor updates

* barrier doc change

* test fixing, parametric op docstrings

* final docstrings, black

* qft docstring

* black, fix test

* remove unused import

* black, fix multicontrolledx

* fix tests, black

* fixing more tests

* hopefully the last breaking tests

* enhance code coverage

* fix some problems from merging

* pin sphinx

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* [OpRefactor] Update the generator to raise an exception if not defined (#2061)

* Update the generator to raise an exception if not defined

* fixes

* fixes

* fixes

* fix

* [OpRefactor] Add custom errors when representations are undefined (#2064)

* add errors and tests, use errors

* small fix

* change one more None to Error

* delete obsolete line

* fix tests

* black

* update changelog

* [OpRefactor] fix codefactor (#2067)

* fix codefactor

* restore lines

* delete again

* `Tensor.matrix`: Warnings for partial wires overlaps and unsorted wire repetition (#2013)

* implement sorting before grouping and check partial wires overlaps.

* changelog

* black

* tests

* tiny

* reduce PR to warnings

* lint

* old python sum

* black

* code review

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* restructure warning logic

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: Josh Izaac <josh146@gmail.com>

* changes applied

* Apply suggestions from code review

* black

* one more test fixed

* [OpRefactor] Update dev guide to explain the new operator abstraction (#2066)

* add previous changes

* add graphic

* rewrite architecture overview

* rewrite op guide

* add differentiation

* fomatting

* polish

* polish

* polish

* black

* formatting

* fix sphinx?

* some dashes

* josh comments

* major polish

* minor details

* minor improvement

* more polishing

* fix link

* fix qasm precision

* changing qasm tests back

* Update doc/development/adding_operators.rst

Co-authored-by: Josh Izaac <josh146@gmail.com>

* suggestions Josh 1

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* backup

* minor improvements

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>

* Update doc/development/guide/architecture.rst

* Update doc/development/adding_operators.rst

* change images, fix link

Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>

* Update Operation call signatures to match doc string  (#1976)

* Updated parameteric_ops to match docs call signature

* finished updating all of the ops

* Added wires arg to SparseHamiltonian

* updating some of cv ops

* updating call signature for more ops

* updated callsigns

* updated changelog

* disable too many args error for code factor

* replaced lam with delta

* Removed Sphinx Override

* fixed bug with TensorN observable

* Update doc/releases/changelog-dev.md

Co-authored-by: David Ittah <dime10@users.noreply.github.com>

Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>

* [OpRefactor] Use decomposition in templates (#2053)

* decomposition and compute decomposition methods

* adding some more ops

* more consistent across qubit ops, return as tuple

* start adding templates

* move hyperparameters defintions

* update templates in a later PR

* tests

* fixing tests

* more test fixes

* final test fix!

* docstrings, interface device tests

* black, tests for coverage

* changelog and docstrings

* docstrings

* more child class docstrings

* Update doc/releases/changelog-dev.md

Co-authored-by: Josh Izaac <josh146@gmail.com>

* nodecompositionerror, test new docstrings

* docstring fixes

* merge conflict

* docstring fixes and minor updates

* barrier doc change

* test fixing, parametric op docstrings

* final docstrings, black

* qft docstring

* black, fix test

* embeddings started to refactor

* embeddings done

* backup

* layers done

* statepreps done

* backup

* done subroutines

* backup

* fix tests except grover, timeevol, commuting

* black

* fix last three tests

* black

* black

* fix tests

* mottonnen fixed

* update changelog

* fixes, including sphinx

* backup

* Fix tape expand tests (#2065)

* fixes

* more

* more

* more

* more

* more

* more

* black

* delete faulty import

* improve codecoverage

* improve coverage by one line

* port one bug fix from other branch

* backup

* suggestions Josh 1

* redo changes in reset files

* rewrite op_list extension

* black

* fix tests

* change ttn

* make pylint happy

* black

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>

* black

* black

* revert

* adapt isingzz eval function

* backup

* fix all tests except from the batch one

* upgraded version of black and blackened again

* [OpRefactor] Final clean-up of operator subclasses (#2131)

* dummy change to open pr

* clean docstrings

* backup

* port some changes from operation.py PR

* clean docstrings of classes

* black

* minor sphinx fix

* make docstrings similar

* more cleaning, and revert BasisStatePrep for test passing

* black

* upgraded version of black and blackened again

* first step

* reduce step

* undo has_gen

* tests

* changelog

* restore grad_recipe

* black

* fix orbitalrotation gradient

* docstring

* lint

* add gradient bug fix for OrbitalRotaiton to changelog

* fix

* tests for parameter frequencies

* test coverage

* copy JacobianTape methods to parameter_shift.py

* fix

* Revert "copy JacobianTape methods to parameter_shift.py"

This reverts commit 3be9806.

* use parameter_frequencies for shift rule. adapt tests. add parameter_frequencies to operation.grad_method

* black

* changelog

* whitespace

* debugging

* Apply suggestions from code review

Co-authored-by: Josh Izaac <josh146@gmail.com>

* add eight-term rule to OrbitalRotation

* formatting of frequencies

* orbital

* doc

* make frequencies a property

* test

* adapt tests to frequencies being property

* adapt to parameter_frequencies as property

* adapt more tests

* more

* more

* simplify util functions a bit

* fix bug

* merge master

* linting

* remove print label

* [WIP] Renaming (#2189)

* more

* more

* more

* more

* more

* more

* more

* rename eigvals to get_eigvals()

* black

* update eigvals in tests

* tensor eigvals

* fix

* more

* Update pennylane/operation.py

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* update deprecation warning

* more

* add deprecation tests

Co-authored-by: Maria Schuld <mariaschuld@gmail.com>

* test coverage

* lint

* lint abstractmethod

* coverage

* tests for default grad_method

* remove old prints

* test coverage

* black

* undo move of JacobianTape methods

* pointless statement is not pointless

* black

* some linting

* print reintroduce

* wrong local pylint

* more fiddling with pylint

* docstring shifts

* move methods away from JacobianTape to gradients module

* black

* also use moved methods for finite diff

* remove old print

* make methods public

Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Josh Izaac <josh146@gmail.com>
Co-authored-by: Maria Schuld <mariaschuld@gmail.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
Co-authored-by: DSGuala <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants