Skip to content

Commit

Permalink
Add MajoranaOp class (#1270)
Browse files Browse the repository at this point in the history
* Add MajoranaOp class

* New style of MajoranaOp.terms(), some new tests

* Update majorana_op.py

* Update majorana_op.py

* Some easier reviews done. More will follow.

* Update releasenotes/notes/add-majoranaop-1cbf9d4a1d4c264e.yaml

Co-authored-by: Max Rossmannek <[email protected]>

* Update releasenotes/notes/add-majoranaop-1cbf9d4a1d4c264e.yaml

Co-authored-by: Max Rossmannek <[email protected]>

* Update qiskit_nature/second_q/operators/majorana_op.py

Co-authored-by: Max Rossmannek <[email protected]>

* Reviewed changes

* final suggestions by mrossinek

* release notes: added example

* suggestions from pylint for tests to pass

* Fixed copyright header for modified files

---------

Co-authored-by: Max Rossmannek <[email protected]>
Co-authored-by: Steve Wood <[email protected]>
Co-authored-by: Max Rossmannek <[email protected]>
  • Loading branch information
4 people authored Apr 17, 2024
1 parent d59bdb2 commit 27a1460
Show file tree
Hide file tree
Showing 6 changed files with 1,279 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .pylintdict
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ chkfile
cholesky
chuang
ci
classmethod
clbit
clbits
clifford
Expand Down Expand Up @@ -301,6 +302,7 @@ kwargs
kwds
labelled
langle
lbl
lbrace
lda
ldots
Expand All @@ -326,6 +328,7 @@ lvert
lysine
macos
majorana
majoranaop
makefile
matmul
matplotlib
Expand Down Expand Up @@ -453,6 +456,7 @@ pxd
py
pydata
pyquante
pyright
pyscf
qarg
qargs
Expand Down
3 changes: 3 additions & 0 deletions qiskit_nature/second_q/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ElectronicIntegrals
FermionicOp
MajoranaOp
BosonicOp
SparseLabelOp
SpinOp
Expand All @@ -44,6 +45,7 @@

from .electronic_integrals import ElectronicIntegrals
from .fermionic_op import FermionicOp
from .majorana_op import MajoranaOp
from .bosonic_op import BosonicOp
from .spin_op import SpinOp
from .vibrational_op import VibrationalOp
Expand All @@ -55,6 +57,7 @@
__all__ = [
"ElectronicIntegrals",
"FermionicOp",
"MajoranaOp",
"BosonicOp",
"SpinOp",
"VibrationalOp",
Expand Down
4 changes: 2 additions & 2 deletions qiskit_nature/second_q/operators/fermionic_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ class FermionicOp(SparseLabelOp):
However, a FermionicOp containing parameters does not support the following methods:
- ``is_hermitian``
- ``to_matrix``
"""

_OPERATION_REGEX = re.compile(r"([\+\-]_\d+\s)*[\+\-]_\d+")
Expand Down Expand Up @@ -459,7 +458,8 @@ def index_order(self) -> FermionicOp:
}
)

def _index_order(self, terms: list[tuple[str, int]], coeff: _TCoeff) -> tuple[str, _TCoeff]:
@classmethod
def _index_order(cls, terms: list[tuple[str, int]], coeff: _TCoeff) -> tuple[str, _TCoeff]:
if not terms:
return "", coeff

Expand Down
Loading

0 comments on commit 27a1460

Please sign in to comment.