MPRZGate
- class MPRZGate(num_qudits, target_qubit=-1)[source]
Bases:
QubitGate,DifferentiableUnitary,CachedClass,LocallyOptimizableUnitaryA gate representing a multiplexed Z rotation.
A multiplexed Z rotation uses n - 1 qubits as select qubits and applies a Z rotation to the target. If the target qubit is the last qubit, then the unitary is block diagonal. Each block is a 2x2 RZ matrix with parameter theta.
Since there are n - 1 select qubits, there are 2^(n-1) parameters (thetas).
We allow the target qubit to be specified to any qubit, and the other qubits maintain their order. Qubit 0 is the most significant qubit.
Why is 0 the MSB? Typically, in the QSD diagram, we see the block drawn with qubit 0 at the top and qubit n-1 at the bottom. Then, the decomposition slowly moves from the bottom to the top.
See this paper: https://arxiv.org/pdf/quant-ph/0406176
- __init__(num_qudits, target_qubit=-1)[source]
Create a new MPRZGate with num_qudits qubits and target_qubit as the target qubit. We then have 2^(n-1) parameters for this gate.
For Example: num_qudits = 3, target_qubit = 1
Then, the select qubits are 0 and 2 with 0 as the MSB.
If the input vector is |0x0> then the selection is 00, and RZ(theta_0) is applied to the target qubit.
If the input vector is |1x0> then the selection is 01, and RZ(theta_1) is applied to the target qubit.
Attributes
The matrix dimension for this unitary.
The name of this gate, with the number of qudits appended.
The number of real parameters this unitary-valued function takes.
The number of qudits this unitary can act on.
The qasm identifier for this gate.
The number of orthogonal states for each qudit.
Methods
check_env_matrix(env_matrix)Check to ensure the env_matrix is validly shaped.
check_parameters(params)Check parameters are valid and match the unitary.
get_grad([params])Return the gradient for this gate.
Return the gate's inverse as a gate.
get_inverse_params([params])Return the parameters that invert the gate.
get_qasm(params, location)Returns the qasm string for this gate.
Returns a qasm gate definition block for this gate.
get_unitary([params])Return the unitary for this gate, see
Unitaryfor more.get_unitary_and_grad([params])Return a tuple combining the outputs of get_unitary and get_grad.
Return true if this unitary doesn't take parameters.
Return true if this unitary is parameterized.
Return true if this unitary can only act on qubits.
is_qudit_only(radix)Return true if this unitary can only act on radix-qudits.
Return true if this unitary can only act on qutrits.
is_self_inverse([params])Checks whether the unitary is its own inverse.
optimize(env_matrix)Return the optimal parameters with respect to an environment matrix.
with_all_frozen_params(params)Freeze all of a gate's parameters so they don't change from optimization.
with_frozen_params(frozen_params)Freeze some of a gate's parameters so they don't change from optimization.