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 MajoranaOp class #1270

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7d1134d
Add MajoranaOp class
grossardt Nov 11, 2023
08e0983
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Nov 12, 2023
812653e
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Nov 14, 2023
922eca3
New style of MajoranaOp.terms(), some new tests
grossardt Nov 18, 2023
51633b0
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Nov 18, 2023
29600dd
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Nov 27, 2023
97625dd
Update majorana_op.py
grossardt Nov 27, 2023
e2e9803
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Nov 27, 2023
4c84cec
Update majorana_op.py
grossardt Nov 27, 2023
700aa59
Some easier reviews done. More will follow.
grossardt Nov 28, 2023
0ea65bf
Update releasenotes/notes/add-majoranaop-1cbf9d4a1d4c264e.yaml
grossardt Nov 28, 2023
2e1dd95
Update releasenotes/notes/add-majoranaop-1cbf9d4a1d4c264e.yaml
grossardt Nov 28, 2023
8d3987d
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Nov 28, 2023
60e6473
Update qiskit_nature/second_q/operators/majorana_op.py
grossardt Dec 1, 2023
48661fa
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Dec 1, 2023
d72af53
Reviewed changes
grossardt Dec 1, 2023
f73a068
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Dec 4, 2023
1b43a10
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Dec 13, 2023
72ffda7
final suggestions by mrossinek
grossardt Dec 13, 2023
07be9da
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Jan 25, 2024
9409137
Merge branch 'main' into addfeature-majoranaop-issue1257
woodsp-ibm Feb 20, 2024
42face7
release notes: added example
grossardt Feb 25, 2024
5d353bd
Merge branch 'main' into addfeature-majoranaop-issue1257
grossardt Feb 25, 2024
ec08359
suggestions from pylint for tests to pass
grossardt Feb 26, 2024
d2464b6
Fixed copyright header for modified files
grossardt Feb 26, 2024
a9c72ff
Merge branch 'main' into addfeature-majoranaop-issue1257
mrossinek Apr 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -300,6 +301,7 @@ kwargs
kwds
labelled
langle
lbl
lbrace
lda
ldots
Expand All @@ -325,6 +327,7 @@ lvert
lysine
macos
majorana
majoranaop
makefile
matmul
matplotlib
Expand Down Expand Up @@ -452,6 +455,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
grossardt marked this conversation as resolved.
Show resolved Hide resolved
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
5 changes: 3 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``
grossardt marked this conversation as resolved.
Show resolved Hide resolved
"""

_OPERATION_REGEX = re.compile(r"([\+\-]_\d+\s)*[\+\-]_\d+")
Expand Down Expand Up @@ -460,7 +459,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 Expand Up @@ -539,6 +539,7 @@ def simplify(self, atol: float | None = None) -> FermionicOp:

data = defaultdict(complex) # type: dict[str, _TCoeff]
# TODO: use parallel_map to make this more efficient (?)
# (if this is done, apply equally to MajoranaOp.simplify())
grossardt marked this conversation as resolved.
Show resolved Hide resolved
for label, coeff in self.items():
label, coeff = self._simplify_label(label, coeff)
data[label] += coeff
Expand Down
Loading