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

[new opmath 1] Toggle __use_new_opmath #5269

Merged
merged 67 commits into from
Mar 25, 2024
Merged

[new opmath 1] Toggle __use_new_opmath #5269

merged 67 commits into from
Mar 25, 2024

Commits on Feb 27, 2024

  1. toggle __use_new_opmath

    Qottmann committed Feb 27, 2024
    Configuration menu
    Copy the full SHA
    fc0eb52 View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2024

  1. Configuration menu
    Copy the full SHA
    6406a46 View commit details
    Browse the repository at this point in the history

Commits on Mar 5, 2024

  1. Configuration menu
    Copy the full SHA
    b178ee3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4900f54 View commit details
    Browse the repository at this point in the history
  3. black formatting

    Qottmann committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    2bc5936 View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2024

  1. Configuration menu
    Copy the full SHA
    9008e4c View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    efb065f View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Configuration menu
    Copy the full SHA
    b7e4278 View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    d58da38 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6b499fb View commit details
    Browse the repository at this point in the history
  4. [ci skip]

    Qottmann committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    4c03020 View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    a6af70b View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    8554984 View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    10a57da View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 12, 2024
    Configuration menu
    Copy the full SHA
    d604f8c View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    81fefca View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 13, 2024
    Configuration menu
    Copy the full SHA
    9e4bfb7 View commit details
    Browse the repository at this point in the history

Commits on Mar 14, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    f4ee9fa View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 14, 2024
    Configuration menu
    Copy the full SHA
    4eefc86 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    5b25192 View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    d93a835 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    e8064eb View commit details
    Browse the repository at this point in the history
  4. [ci skip]

    Qottmann committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    e4435ce View commit details
    Browse the repository at this point in the history
  5. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    f2b4555 View commit details
    Browse the repository at this point in the history
  6. [ci skip]

    Qottmann committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    12a42f4 View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 18, 2024
    Configuration menu
    Copy the full SHA
    24e576a View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 18, 2024
    Configuration menu
    Copy the full SHA
    9422bad View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2024

  1. Configuration menu
    Copy the full SHA
    79321c5 View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    6238f1e View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    329cae4 View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 21, 2024
    Configuration menu
    Copy the full SHA
    43434f6 View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    393aa10 View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    4baebde View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2024

  1. Merge branch 'master' of https://github.com/PennyLaneAI/pennylane int…

    …o enable_new_opmath
    Qottmann committed Mar 23, 2024
    Configuration menu
    Copy the full SHA
    0131ec0 View commit details
    Browse the repository at this point in the history
  2. [ci skip]

    Qottmann committed Mar 23, 2024
    Configuration menu
    Copy the full SHA
    aaa07da View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2024

  1. [new opmath 2] New LinearCombination class to succeed `qml.Hamilton…

    …ian` (#5216)
    
    Branching: #5269 >
    #5216 >
    #5322 >
    #5335
    
    The basic idea is to have a clone of `qml.Hamiltonian` with a better
    name, `LinearCombination` - that inherits from `CompositeOp` and plays
    nice with new opmath. The motivation is that sometimes it is still handy
    to have an operator class for which you _know_ there is no funny nesting
    and that has `coeffs` and `ops` separately on demand without processing.
    
    ToDo
    
    - [x] basic init
    - [x] `tests/ops/op_math/test_linear_combination.py` pass
    - [x] update map_wires
    - [x] all tests pass
    - [x] add pauli_rep
    - [x] add operands attribute and make iterable (?)
    - [x] update string repr
    - [x] upgrade to internally use new opmath
    - [x] update tests with default new opmath
    - [x] dunder math methods support with new opmath
    - [x] simplify and speed-up `simplify()`, also make sure to not act
    in-place
    - [x] Could we make the matrix generation workflow more general like
    Sum?
    - [x] Also, deferring to the pauli rep method for matrix generation
    leads to substantial performance improvements.
    - [x] toggle `__use_new_opmath`
    - [x] tests_linear_combination pass
    - [x] Integration tests
    - [x] get all linear combination tests to pass locally
    - [x] utilize super().sparse_matrix
    - [x] use grouping functionality from Sum that Mudit is adding in
    #5179
    - [x] update matmul to handle other LinearCombination instances
    - [x] remove top level import
    - [x] remove unnecessary copies
    - [x] add diagonalizing gates
    - [x] bugfix trivial case of simplify empty LinearCombination
    - [x] add trivial case for is_hermitian
    - [ ] torch differentiation with simplify=True in constructor
    - [x] changelog
    
    Optional features (likely to be included in a follow-up)
    - [x] `qml.Hamiltonian` points to either old Hamiltonian or
    LinearCombination depending on `__use_new_opmath`
    - [x] support Hermitian
    - [ ] matrix method (optional)
    - [ ] adjoint method (optional)
    - [ ] batching support (optional)
    - [ ] qml.dot points to LinearCombination
    - [ ] take care of xfails (mostly about raiseing errors in other parts
    of the codebase)
    - [ ] update logic of adjoint differentiation to catch attempt to
    differentiate lincomb coeffs
    - [x] support in qml.equal
    - [x]  add special matmul with other product or non-composite ops
    - [x] add special matmul with other LinearCombination
    
    
    [sc-56704]
    
    ---------
    
    Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
    Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
    Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
    Co-authored-by: Christina Lee <christina@xanadu.ai>
    Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
    Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
    Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
    Co-authored-by: lillian542 <Lillian.frederiksen@xanadu.ai>
    Co-authored-by: Alex Preciado <alex.preciado@xanadu.ai>
    Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
    Co-authored-by: Vincent Michaud-Rioux <vincentm@nanoacademic.com>
    Co-authored-by: Josh Izaac <josh146@gmail.com>
    Co-authored-by: Nathan Killoran <co9olguy@users.noreply.github.com>
    Co-authored-by: Matthew Silverman <matthews@xanadu.ai>
    Co-authored-by: Mikhail Andrenkov <mikhail@xanadu.ai>
    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    17 people authored Mar 25, 2024
    Configuration menu
    Copy the full SHA
    7343038 View commit details
    Browse the repository at this point in the history
  2. pauli/conversion coverage

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    230acb5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    dab69ed View commit details
    Browse the repository at this point in the history
  4. linear combination coverage

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    fdbbd30 View commit details
    Browse the repository at this point in the history
  5. linear combination coverage

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    c0045a7 View commit details
    Browse the repository at this point in the history
  6. black formatting

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    ac269e0 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    bcd1d0c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    84516ee View commit details
    Browse the repository at this point in the history
  9. operation coverage

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    a1fbbb6 View commit details
    Browse the repository at this point in the history
  10. tests for coverage

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    e3ceca5 View commit details
    Browse the repository at this point in the history
  11. black formatting

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    76a1fd6 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    287c9d8 View commit details
    Browse the repository at this point in the history
  13. pylint

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    30ed7f7 View commit details
    Browse the repository at this point in the history
  14. make pylint happy

    astralcai committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    be79409 View commit details
    Browse the repository at this point in the history
  15. parameter shift coverage

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    f96a73c View commit details
    Browse the repository at this point in the history
  16. parameter shift coverage

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    f2518df View commit details
    Browse the repository at this point in the history
  17. black formatting

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    3fc66ac View commit details
    Browse the repository at this point in the history
  18. adjoint matrix hamiltonian

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    9b49a7f View commit details
    Browse the repository at this point in the history
  19. black formatting

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    c2659c9 View commit details
    Browse the repository at this point in the history
  20. merge

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    57c75af View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    3ee65af View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    bbd565c View commit details
    Browse the repository at this point in the history
  23. trigger-ci

    astralcai committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    875dcf8 View commit details
    Browse the repository at this point in the history
  24. trigger

    Qottmann committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    da40e05 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    631a1e5 View commit details
    Browse the repository at this point in the history
  26. parameter shift coverage

    astralcai committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    ffe44cc View commit details
    Browse the repository at this point in the history
  27. adding more test coverage

    albi3ro committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    38032a7 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    36e855b View commit details
    Browse the repository at this point in the history
  29. trigger ci

    albi3ro committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    8898cc7 View commit details
    Browse the repository at this point in the history
  30. remove duplicate code

    albi3ro committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    3cf8ad5 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    6f47d72 View commit details
    Browse the repository at this point in the history
  32. Fix test case

    astralcai committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    0596287 View commit details
    Browse the repository at this point in the history