mindquantum.core.circuit.add_suffix
- mindquantum.core.circuit.add_suffix(circuit_fn, suffix: str)[source]
Add a suffix on the parameter of a parameterized quantum circuit or a parameterized quantum operator.
(a function that can generate a parameterized quantum circuit).
- Parameters
- Returns
Circuit or a function that can generate a Circuit.
- Raises
Examples
>>> from mindquantum.algorithm.library import qft >>> from mindquantum.core.circuit import add_suffix >>> from mindquantum import RX, H, Circuit >>> u = lambda qubit: Circuit([H.on(0), RX('a').on(qubit)]) >>> u1 = u(0) >>> u2 = add_suffix(u1, '1') >>> u3 = add_suffix(u, '1') >>> u3 = u3(0) >>> u2 ┏━━━┓ ┏━━━━━━━━━┓ q0: ──┨ H ┠─┨ RX(a_1) ┠─── ┗━━━┛ ┗━━━━━━━━━┛ >>> u3 ┏━━━┓ ┏━━━━━━━━━┓ q0: ──┨ H ┠─┨ RX(a_1) ┠─── ┗━━━┛ ┗━━━━━━━━━┛