View source on GitHub |
A linear combination of products of Majorana operators.
openfermion.ops.MajoranaOperator(
term=None, coefficient=1.0
)
A system of N fermionic modes can be described using 2N Majorana operators \(\gamma_1, \ldots, \gamma_{2N}\) as an alternative to using N fermionic annihilation operators. The algebra of Majorana operators amounts to the relation
\[ \{\gamma_i, \gamma_j\} = \gamma_i \gamma_j + \gamma_j \gamma_i = 2 \delta_{ij} \]
Note that this implies \(\gamma_i^2 = 1\).
The MajoranaOperator class stores a linear combination of products
of Majorana operators. Each product is represented as a tuple of
integers representing the indices of the operators. As an example,
MajoranaOperator((2, 3, 5), -1.5)
initializes an operator with
a single term which represents the operator
\(-1.5 \gamma_2 \gamma_3 \gamma_5\). MajoranaOperators can be
added, subtracted, multiplied, and divided by scalars. They can be
compared for approximate numerical equality using ==
.
Args | |
---|---|
term
|
Tuple[int]
The indices of a Majorana operator term to start off with |
coefficient
|
complex
The coefficient of the term |
Attributes | |
---|---|
terms
|
A dictionary from term, represented by a tuple of integers, to the coefficient of the term in the linear combination. |
Methods
commutes_with
commutes_with(
other
)
Test commutation with another MajoranaOperator
from_dict
@staticmethod
from_dict( terms )
Initialize a MajoranaOperator from a terms dictionary.
Args | |
---|---|
terms
|
A dictionary from Majorana term to coefficient |
with_basis_rotated_by
with_basis_rotated_by(
transformation_matrix
)
Change to a basis of new Majorana operators.
The input to this method is a real orthogonal matrix \(O\). It returns a new MajoranaOperator which is equivalent to the old one but rewritten in terms of a new basis of Majorana operators. Let the original Majorana operators be denoted by \(\gamma_i\) and the new operators be denoted by \(\tilde{\gamma_i}\). Then they are related by the equation
\[ \tilde{\gamma_i} = \sum_j O_{ij} \gamma_j. \]
Args | |
---|---|
transformation_matrix
|
A real orthogonal matrix representing the basis transformation. |
Returns | |
---|---|
The rotated operator. |
__add__
__add__(
other
)
__eq__
__eq__(
other
)
Approximate numerical equality.
__mul__
__mul__(
other
)
__ne__
__ne__(
other
)
Return self!=value.
__neg__
__neg__()
__pow__
__pow__(
other
)
__rmul__
__rmul__(
other
)
__sub__
__sub__(
other
)
__truediv__
__truediv__(
other
)