dynamite.extras

dynamite.extras.commutator(o1, o2)[source]

The commutator \([O_1,O_2]\).

Returns:

The commutator

Return type:

dynamite.operators.Operator

dynamite.extras.majorana(idx)[source]

A function generating an operator that represents a Majorana fermion as a boundary in a spin chain.

The boundary is at index b_idx = floor(idx/2) + 1. The operator consists of the tensor product of \(\sigma_z\) operators up to spin b_idx - 1, and then on spin b_idx a \(\sigma_x\) operator if idx is even or a \(\sigma_y\) operator if idx is odd.

Parameters:

idx (int) – The index of the Majorana

Returns:

The Majorana of index idx

Return type:

dynamite.operators.Operator