# openfermion.ops.MajoranaOperator

A linear combination of products of Majorana operators.

A system of N fermionic modes can be described using 2N Majorana operators :math:\gamma_1, \ldots, \gamma_{2N} as an alternative to using N fermionic annihilation operators. The algebra of Majorana operators amounts to the relation

.. math:: {\gamma_i, \gamma_j} = \gamma_i \gamma_j + \gamma_j \gammai = 2 \delta{ij}

Note that this implies :math:\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 :math:-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 ==.

term (Tuple[int]): The indices of a Majorana operator term to start off with coefficient (complex): The coefficient of the term

terms A dictionary from term, represented by a tuple of integers, to the coefficient of the term in the linear combination.

## Methods

### commutes_with

View source

Test commutation with another MajoranaOperator

### from_dict

View source

Initialize a MajoranaOperator from a terms dictionary.

Args
terms A dictionary from Majorana term to coefficient

### with_basis_rotated_by

View source

Change to a basis of new Majorana operators.

The input to this method is a real orthogonal matrix :math: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 :math:\gamma_i and the new operators be denoted by :math:\tilde{\gamma_i}. Then they are related by the equation

.. math::

\tilde{\gamma_i} = \sum_j O_{ij} \gamma_j.


Args
transformation_matrix A real orthogonal matrix representing the basis transformation.

Returns
The rotated operator.

View source

### __eq__

View source

Approximate numerical equality.

View source

### __ne__

View source

Return self!=value.

View source

View source

View source

View source

### __truediv__

View source

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]