def __init__(self, encoding, decoding):
    ' Initialization of a binary code.\n\n        Args:\n            encoding (np.ndarray or list): nested lists or binary 2D-array\n            decoding (array or list): list of BinaryPolynomial (list or str).\n\n        Raises:\n            TypeError: non-list, array like encoding or decoding, unsuitable\n                BinaryPolynomial generators,\n            BinaryCodeError: in case of decoder/encoder size mismatch or\n                decoder size, qubits indexed mismatch\n        '
    if (not isinstance(encoding, (numpy.ndarray, list))):
        raise TypeError('encoding must be a list or array.')
    if (not isinstance(decoding, (numpy.ndarray, list))):
        raise TypeError('decoding must be a list or array.')
    self.encoder = scipy.sparse.csc_matrix(encoding)
    (self.n_qubits, self.n_modes) = numpy.shape(encoding)
    if (self.n_modes != len(decoding)):
        raise BinaryCodeError('size mismatch, decoder and encoder should have the same first dimension')
    decoder_qubits = set()
    self.decoder = []
    for symbolic_binary in decoding:
        if isinstance(symbolic_binary, (tuple, list, str, int, numpy.int32, numpy.int64)):
            symbolic_binary = BinaryPolynomial(symbolic_binary)
        if isinstance(symbolic_binary, BinaryPolynomial):
            self.decoder.append(symbolic_binary)
            decoder_qubits = (decoder_qubits | set(symbolic_binary.enumerate_qubits()))
        else:
            raise TypeError('decoder component provided is not a suitable for BinaryPolynomial', symbolic_binary)
    if (len(decoder_qubits) != self.n_qubits):
        raise BinaryCodeError('decoder and encoder provided has different number of qubits')
    if ((max(decoder_qubits) + 1) > self.n_qubits):
        raise BinaryCodeError('decoder is not indexing some qubits. Qubitsindexed are: {}'.format(decoder_qubits))
Initialization of a binary code.

Args:
    encoding (np.ndarray or list): nested lists or binary 2D-array
    decoding (array or list): list of BinaryPolynomial (list or str).

Raises:
    TypeError: non-list, array like encoding or decoding, unsuitable
        BinaryPolynomial generators,
    BinaryCodeError: in case of decoder/encoder size mismatch or
        decoder size, qubits indexed mismatch
def __init__(self, encoding, decoding):
    ' Initialization of a binary code.\n\n        Args:\n            encoding (np.ndarray or list): nested lists or binary 2D-array\n            decoding (array or list): list of BinaryPolynomial (list or str).\n\n        Raises:\n            TypeError: non-list, array like encoding or decoding, unsuitable\n                BinaryPolynomial generators,\n            BinaryCodeError: in case of decoder/encoder size mismatch or\n                decoder size, qubits indexed mismatch\n        '
    if (not isinstance(encoding, (numpy.ndarray, list))):
        raise TypeError('encoding must be a list or array.')
    if (not isinstance(decoding, (numpy.ndarray, list))):
        raise TypeError('decoding must be a list or array.')
    self.encoder = scipy.sparse.csc_matrix(encoding)
    (self.n_qubits, self.n_modes) = numpy.shape(encoding)
    if (self.n_modes != len(decoding)):
        raise BinaryCodeError('size mismatch, decoder and encoder should have the same first dimension')
    decoder_qubits = set()
    self.decoder = []
    for symbolic_binary in decoding:
        if isinstance(symbolic_binary, (tuple, list, str, int, numpy.int32, numpy.int64)):
            symbolic_binary = BinaryPolynomial(symbolic_binary)
        if isinstance(symbolic_binary, BinaryPolynomial):
            self.decoder.append(symbolic_binary)
            decoder_qubits = (decoder_qubits | set(symbolic_binary.enumerate_qubits()))
        else:
            raise TypeError('decoder component provided is not a suitable for BinaryPolynomial', symbolic_binary)
    if (len(decoder_qubits) != self.n_qubits):
        raise BinaryCodeError('decoder and encoder provided has different number of qubits')
    if ((max(decoder_qubits) + 1) > self.n_qubits):
        raise BinaryCodeError('decoder is not indexing some qubits. Qubitsindexed are: {}'.format(decoder_qubits))