def _x_gate(self, lines, ctrl_lines):
        """
        Return the TikZ code for a NOT-gate.

        :param lines: List of length 1 denoting the target qubit of the NOT / X gate.
        :type: list[int]
        :param ctrl_lines: List of qubit lines which act as controls.
        :type: list[int]
        """
        line = lines[0]
        delta_pos = self._gate_offset('X')
        gate_width = self._gate_width('X')
        op = self._op(line)
        gate_str = ("\n\\node[xstyle] ({op}) at ({pos},-{line}) {{}};\n\\draw"
                    "[edgestyle] ({op}.north)--({op}.south);\n\\draw"
                    "[edgestyle] ({op}.west)--({op}.east);").format(op=op, line=line, pos=self.pos[line])
        if len(ctrl_lines) > 0:
            for ctrl in ctrl_lines:
                gate_str += self._phase(ctrl, self.pos[line])
                gate_str += self._line(ctrl, line)

        all_lines = ctrl_lines + [line]
        new_pos = self.pos[line] + delta_pos + gate_width
        for i in all_lines:
            self.op_count[i] += 1
        for i in range(min(all_lines), max(all_lines) + 1):
            self.pos[i] = new_pos
        return gate_str
def _x_gate ( self , lines , ctrl_lines ) : line = lines [ 0 ] delta_pos = self . _gate_offset ( 'X' ) gate_width = self . _gate_width ( 'X' ) op = self . _op ( line ) gate_str = ( "\n\\node[xstyle] ({op}) at ({pos},-{line}) {{}};\n\\draw" "[edgestyle] ({op}.north)--({op}.south);\n\\draw" "[edgestyle] ({op}.west)--({op}.east);" ) . format ( op = op , line = line , pos = self . pos [ line ] ) if len ( ctrl_lines ) > 0 : for ctrl in ctrl_lines : gate_str += self . _phase ( ctrl , self . pos [ line ] ) gate_str += self . _line ( ctrl , line ) all_lines = ctrl_lines + [ line ] new_pos = self . pos [ line ] + delta_pos + gate_width for i in all_lines : self . op_count [ i ] += 1 for i in range ( min ( all_lines ) , max ( all_lines ) + 1 ) : self . pos [ i ] = new_pos return gate_str
Return the TikZ code for a NOT-gate.

        :param lines: List of length 1 denoting the target qubit of the NOT / X gate.
        :type: list[int]
        :param ctrl_lines: List of qubit lines which act as controls.
        :type: list[int]