def _compose_subsystem(self, other, qargs, front=False):
<EOL>input_dims = list(self.input_dims())<EOL>output_dims = list(self.output_dims())<EOL>if front:<EOL><INDENT>num_indices = len(self.input_dims())<EOL>shift = len(self.output_dims())<EOL>right_mul = True<EOL>for pos, qubit in enumerate(qargs):<EOL><INDENT>input_dims[qubit] = other._input_dims[pos]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>num_indices = len(self.output_dims())<EOL>shift = <NUM_LIT:0><EOL>right_mul = False<EOL>for pos, qubit in enumerate(qargs):<EOL><INDENT>output_dims[qubit] = other._output_dims[pos]<EOL><DEDENT><DEDENT>tensor = np.reshape(self.data, self._shape)<EOL>mat = np.reshape(other.data, other._shape)<EOL>indices = [num_indices - <NUM_LIT:1> - qubit for qubit in qargs]<EOL>final_shape = [np.product(output_dims), np.product(input_dims)]<EOL>data = np.reshape(<EOL>self._einsum_matmul(tensor, mat, indices, shift, right_mul),<EOL>final_shape)<EOL>return Operator(data, input_dims, output_dims)<EOL>
Return the composition channel.