mindquantum.core.circuit.change_param_name
- mindquantum.core.circuit.change_param_name(circuit_fn, name_map)[source]
Change the parameter name 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 change_param_name, Circuit >>> from mindquantum.core.gates import RX, H >>> u = lambda qubit: Circuit([H.on(0), RX('a').on(qubit)]) >>> u1 = u(0) >>> u2 = change_param_name(u1, {'a': 'b'}) >>> u3 = change_param_name(u, {'a': 'b'}) >>> u3 = u3(0) >>> u2 ┏━━━┓ ┏━━━━━━━┓ q0: ──┨ H ┠─┨ RX(b) ┠─── ┗━━━┛ ┗━━━━━━━┛ >>> u3 ┏━━━┓ ┏━━━━━━━┓ q0: ──┨ H ┠─┨ RX(b) ┠─── ┗━━━┛ ┗━━━━━━━┛