def __imul__(self, factor):
    'In-place code concatenation or appendage via *= .\n        Multiplication with integer will yield appendage, otherwise\n        concatenation.\n\n        Args:\n            factor (int or BinaryCode): the BinaryCode to concatenate. In case\n                of int, it will append the code to itself factor times.\n\n        Returns (BinaryCode): segmented or concatenated code\n\n        Raises:\n            TypeError: factor must be an integer or a BinaryCode\n            BinaryCodeError: size mismatch between self and factor\n            ValueError: in case of an integer factor that is < 1\n        '
    if (not isinstance(factor, (BinaryCode, numpy.int32, numpy.int64, int))):
        raise TypeError('argument must be a BinaryCode or integer')
    if isinstance(factor, BinaryCode):
        if (self.n_qubits != factor.n_modes):
            raise BinaryCodeError('size mismatch between inner and outer code layer')
        self.decoder = double_decoding(self.decoder, factor.decoder)
        self.encoder = factor.encoder.dot(self.encoder)
        (self.n_qubits, self.n_modes) = numpy.shape(self.encoder)
        return self
    elif isinstance(factor, (numpy.int32, numpy.int64, int)):
        if (factor < 1):
            raise ValueError('integer factor has to be positive, non-zero ')
        self.encoder = scipy.sparse.kron(scipy.sparse.identity(factor, format='csc', dtype=int), self.encoder, 'csc')
        tmp_decoder = self.decoder
        for index in numpy.arange(1, factor):
            self.decoder = numpy.append(self.decoder, shift_decoder(tmp_decoder, (index * self.n_qubits)))
        self.n_qubits *= factor
        self.n_modes *= factor
        return self
In-place code concatenation or appendage via *= .
Multiplication with integer will yield appendage, otherwise
concatenation.

Args:
    factor (int or BinaryCode): the BinaryCode to concatenate. In case
        of int, it will append the code to itself factor times.

Returns (BinaryCode): segmented or concatenated code

Raises:
    TypeError: factor must be an integer or a BinaryCode
    BinaryCodeError: size mismatch between self and factor
    ValueError: in case of an integer factor that is < 1
def __imul__(self, factor):
    'In-place code concatenation or appendage via *= .\n        Multiplication with integer will yield appendage, otherwise\n        concatenation.\n\n        Args:\n            factor (int or BinaryCode): the BinaryCode to concatenate. In case\n                of int, it will append the code to itself factor times.\n\n        Returns (BinaryCode): segmented or concatenated code\n\n        Raises:\n            TypeError: factor must be an integer or a BinaryCode\n            BinaryCodeError: size mismatch between self and factor\n            ValueError: in case of an integer factor that is < 1\n        '
    if (not isinstance(factor, (BinaryCode, numpy.int32, numpy.int64, int))):
        raise TypeError('argument must be a BinaryCode or integer')
    if isinstance(factor, BinaryCode):
        if (self.n_qubits != factor.n_modes):
            raise BinaryCodeError('size mismatch between inner and outer code layer')
        self.decoder = double_decoding(self.decoder, factor.decoder)
        self.encoder = factor.encoder.dot(self.encoder)
        (self.n_qubits, self.n_modes) = numpy.shape(self.encoder)
        return self
    elif isinstance(factor, (numpy.int32, numpy.int64, int)):
        if (factor < 1):
            raise ValueError('integer factor has to be positive, non-zero ')
        self.encoder = scipy.sparse.kron(scipy.sparse.identity(factor, format='csc', dtype=int), self.encoder, 'csc')
        tmp_decoder = self.decoder
        for index in numpy.arange(1, factor):
            self.decoder = numpy.append(self.decoder, shift_decoder(tmp_decoder, (index * self.n_qubits)))
        self.n_qubits *= factor
        self.n_modes *= factor
        return self