Weight-2 segment code (arXiv:1712.07067). Outputs a 5-mode, 4-qubit

code, which encodes all the vectors (states) with Hamming weight (occupation) 2 and 1. n_qubits = 4, n_modes = 5. A linear amount of qubits can be saved appending several instances of this code.


This code is highly non-linear and might produce a lot of terms.

Returns (BinaryCode): weight-2 segment code