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

Add matrix support for fermionic objects #5895

Closed
soranjh opened this issue Jun 21, 2024 · 0 comments
Closed

Add matrix support for fermionic objects #5895

soranjh opened this issue Jun 21, 2024 · 0 comments
Labels
enhancement ✨ New feature or request

Comments

@soranjh
Copy link
Contributor

soranjh commented Jun 21, 2024

Feature details

⚠️ This issue is part of an internal assignment and not meant for external contributors.

The fermi module has several functions and classes for creating and manipulating fermionic operators. It will be useful to have tools for obtaining the matrix representation of these operators. The FermiWord and FermiSentence objects can be upgraded to have a to_mat() method that allows computing their matrix representation, similar to the PauliWord and PauliSentence classes. The users can then compute the matrix as

>>> import pennylane as qml
>>> op = qml.fermi.FermiWord({(0, 0): '+', (1, 1): '-'})
>>> op.to_mat()
array([[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j]])

Implementation

The to_mat() method should be added as an instance method to FermiWord and FermiSentence. The method should have an optional keyword argument, n, for specifying the total number of orbitals which determines the matrix size.

Requirements

  1. The computed matrix should properly describe the behaviour of fermionic operators.
  2. The computed matrix should satisfy the commutation relationship between fermionic operators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant