Skip to content

Commit

Permalink
replace back circles by C/N
Browse files Browse the repository at this point in the history
  • Loading branch information
jcjaskula-aws committed Dec 27, 2023
1 parent a1c44fe commit 3db7791
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 77 deletions.
6 changes: 3 additions & 3 deletions src/braket/circuits/angled_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
printing a diagram of a circuit. The length must be the same as `qubit_count`, and
index ordering is expected to correlate with the target ordering on the instruction.
For instance, if a CNOT instruction has the control qubit on the first index and
target qubit on the second index, the ASCII symbols should have `["", "X"]` to
target qubit on the second index, the ASCII symbols should have `["C", "X"]` to
correlate a symbol with that index.
Raises:
Expand Down Expand Up @@ -147,7 +147,7 @@ def __init__(
printing a diagram of a circuit. The length must be the same as `qubit_count`, and
index ordering is expected to correlate with the target ordering on the instruction.
For instance, if a CNOT instruction has the control qubit on the first index and
target qubit on the second index, the ASCII symbols should have `["", "X"]` to
target qubit on the second index, the ASCII symbols should have `["C", "X"]` to
correlate a symbol with that index.
Raises:
Expand Down Expand Up @@ -265,7 +265,7 @@ def __init__(
printing a diagram of a circuit. The length must be the same as `qubit_count`, and
index ordering is expected to correlate with the target ordering on the instruction.
For instance, if a CNOT instruction has the control qubit on the first index and
target qubit on the second index, the ASCII symbols should have `["", "X"]` to
target qubit on the second index, the ASCII symbols should have `["C", "X"]` to
correlate a symbol with that index.
Raises:
Expand Down
4 changes: 2 additions & 2 deletions src/braket/circuits/ascii_circuit_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def _ascii_diagram_column(
# when a user has a gate genuinely named C, but
# is necessary to enable proper printing of custom
# gates with built-in control qubits
and ascii_symbols[item_qubit_index] != ""
and ascii_symbols[item_qubit_index] != "C"
)
else ""
)
Expand All @@ -368,7 +368,7 @@ def _ascii_diagram_column(
else ascii_symbols[item_qubit_index]
)
elif qubit in control_qubits:
symbols[qubit] = "" if map_control_qubit_states[qubit] else ""
symbols[qubit] = "C" if map_control_qubit_states[qubit] else "N"
else:
symbols[qubit] = "|"

Expand Down
10 changes: 5 additions & 5 deletions src/braket/circuits/box_drawing_circuit_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def _ascii_diagram_column(
# when a user has a gate genuinely named C, but
# is necessary to enable proper printing of custom
# gates with built-in control qubits
and ascii_symbols[item_qubit_index] != ""
and ascii_symbols[item_qubit_index] != "C"
)
else ""
)
Expand All @@ -391,7 +391,7 @@ def _ascii_diagram_column(
if power_string
else ascii_symbols[item_qubit_index]
)
if symbols[qubit] in ["", ""]:
if symbols[qubit] in ["C", "N"]:
if min(target_and_control) < qubit < max(target_and_control):
connections[qubit] = "both"
elif qubit == max(target_and_control):
Expand All @@ -400,7 +400,7 @@ def _ascii_diagram_column(
connections[qubit] = "below"

elif qubit in control_qubits:
symbols[qubit] = "" if map_control_qubit_states[qubit] else ""
symbols[qubit] = "C" if map_control_qubit_states[qubit] else "N"
if min(target_and_control) < qubit < max(target_and_control):
connections[qubit] = "both"
elif qubit == max(target_and_control):
Expand Down Expand Up @@ -461,12 +461,12 @@ def _draw_symbol(

top = ""
bottom = ""
if symbol in ["", ""]:
if symbol in ["C", "N"]:
if connection in ["above", "both"]:
top = fill_symbol("│", " ")
if connection in ["below", "both"]:
bottom = fill_symbol("│", " ")
symbol = fill_symbol(f"{symbol}", "─")
symbol = fill_symbol("●" if symbol == "C" else "◯", "─")
elif symbol in ["StartVerbatim", "EndVerbatim"]:
top, symbol, bottom = BoxDrawingCircuitDiagram._build_verbatim_box(symbol, connection)
elif symbol == "┼":
Expand Down
8 changes: 4 additions & 4 deletions src/braket/circuits/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ def apply_gate_noise(
>>> print(circ)
T : |0|1|2|
q0 : -X-Z--
q0 : -X-Z-C-
|
q1 : -Y-X-X-
Expand All @@ -724,7 +724,7 @@ def apply_gate_noise(
>>> print(circ.apply_gate_noise(noise, target_gates = Gate.X))
T : | 0 | 1 |2|
q0 : -X-DEPO(0.1)-Z------------
q0 : -X-DEPO(0.1)-Z-----------C-
|
q1 : -Y-----------X-DEPO(0.1)-X-
Expand All @@ -734,7 +734,7 @@ def apply_gate_noise(
>>> print(circ.apply_gate_noise(noise, target_qubits = 1))
T : | 0 | 1 | 2 |
q0 : -X-----------Z----------------------
q0 : -X-----------Z-----------C-----------
|
q1 : -Y-DEPO(0.1)-X-DEPO(0.1)-X-DEPO(0.1)-
Expand All @@ -747,7 +747,7 @@ def apply_gate_noise(
... )
T : | 0 | 1 |2|
q0 : -X-DEPO(0.1)-Z------------
q0 : -X-DEPO(0.1)-Z-----------C-
|
q1 : -Y-DEPO(0.1)-X-DEPO(0.1)-X-
Expand Down
2 changes: 1 addition & 1 deletion src/braket/circuits/gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, qubit_count: Optional[int], ascii_symbols: Sequence[str]):
printing a diagram of circuits. Length must be the same as `qubit_count`, and
index ordering is expected to correlate with target ordering on the instruction.
For instance, if CNOT instruction has the control qubit on the first index and
target qubit on the second index. Then ASCII symbols would have ["", "X"] to
target qubit on the second index. Then ASCII symbols would have ["C", "X"] to
correlate a symbol with that index.
Raises:
Expand Down
20 changes: 10 additions & 10 deletions src/braket/circuits/gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ class CNot(Gate):
"""

def __init__(self):
super().__init__(qubit_count=None, ascii_symbols=["", "X"])
super().__init__(qubit_count=None, ascii_symbols=["C", "X"])

@property
def _qasm_name(self) -> str:
Expand Down Expand Up @@ -2023,7 +2023,7 @@ def __init__(self, angle: Union[FreeParameterExpression, float]):
super().__init__(
angle=angle,
qubit_count=None,
ascii_symbols=["", angled_ascii_characters("PHASE", angle)],
ascii_symbols=["C", angled_ascii_characters("PHASE", angle)],
)

@property
Expand Down Expand Up @@ -2108,7 +2108,7 @@ def __init__(self, angle: Union[FreeParameterExpression, float]):
super().__init__(
angle=angle,
qubit_count=None,
ascii_symbols=["", angled_ascii_characters("PHASE00", angle)],
ascii_symbols=["C", angled_ascii_characters("PHASE00", angle)],
)

@property
Expand Down Expand Up @@ -2193,7 +2193,7 @@ def __init__(self, angle: Union[FreeParameterExpression, float]):
super().__init__(
angle=angle,
qubit_count=None,
ascii_symbols=["", angled_ascii_characters("PHASE01", angle)],
ascii_symbols=["C", angled_ascii_characters("PHASE01", angle)],
)

@property
Expand Down Expand Up @@ -2278,7 +2278,7 @@ def __init__(self, angle: Union[FreeParameterExpression, float]):
super().__init__(
angle=angle,
qubit_count=None,
ascii_symbols=["", angled_ascii_characters("PHASE10", angle)],
ascii_symbols=["C", angled_ascii_characters("PHASE10", angle)],
)

@property
Expand Down Expand Up @@ -2357,7 +2357,7 @@ class CV(Gate):
"""

def __init__(self):
super().__init__(qubit_count=None, ascii_symbols=["", "V"])
super().__init__(qubit_count=None, ascii_symbols=["C", "V"])

@property
def _qasm_name(self) -> str:
Expand Down Expand Up @@ -2434,7 +2434,7 @@ class CY(Gate):
"""

def __init__(self):
super().__init__(qubit_count=None, ascii_symbols=["", "Y"])
super().__init__(qubit_count=None, ascii_symbols=["C", "Y"])

@property
def _qasm_name(self) -> str:
Expand Down Expand Up @@ -2511,7 +2511,7 @@ class CZ(Gate):
"""

def __init__(self):
super().__init__(qubit_count=None, ascii_symbols=["", "Z"])
super().__init__(qubit_count=None, ascii_symbols=["C", "Z"])

@property
def _qasm_name(self) -> str:
Expand Down Expand Up @@ -3008,7 +3008,7 @@ class CCNot(Gate):
"""

def __init__(self):
super().__init__(qubit_count=None, ascii_symbols=["", "", "X"])
super().__init__(qubit_count=None, ascii_symbols=["C", "C", "X"])

@property
def _qasm_name(self) -> str:
Expand Down Expand Up @@ -3116,7 +3116,7 @@ class CSwap(Gate):
"""

def __init__(self):
super().__init__(qubit_count=None, ascii_symbols=["", "SWAP", "SWAP"])
super().__init__(qubit_count=None, ascii_symbols=["C", "SWAP", "SWAP"])

@property
def _qasm_name(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion src/braket/circuits/quantum_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, qubit_count: Optional[int], ascii_symbols: Sequence[str]):
Length must be the same as `qubit_count`, and index ordering is expected
to correlate with target ordering on the instruction.
For instance, if CNOT instruction has the control qubit on the first index and
target qubit on the second index. Then ASCII symbols would have ["", "X"] to
target qubit on the second index. Then ASCII symbols would have ["C", "X"] to
correlate a symbol with that index.
Raises:
Expand Down
Loading

0 comments on commit 3db7791

Please sign in to comment.