mindquantum.core.gates.SWAPalpha#
- class mindquantum.core.gates.SWAPalpha(pr)#
SWAP alpha gate. More usage, please see
RX.\[\begin{split}\text{SWAP}(\alpha) = \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & \frac{1}{2}\left(1+e^{i\pi\alpha}\right) & \frac{1}{2}\left(1-e^{i\pi\alpha}\right) & 0\\ 0 & \frac{1}{2}\left(1-e^{i\pi\alpha}\right) & \frac{1}{2}\left(1+e^{i\pi\alpha}\right) & 0\\ 0 & 0 & 0 & 1\\ \end{pmatrix}\end{split}\]- Parameters:
pr (Union[int, float, str, dict, ParameterResolver]) – the parameters of parameterized gate, see above for detail explanation.
- diff_matrix(pr=None, about_what=None)#
Differential form of this parameterized gate.
- Parameters:
pr (Union[ParameterResolver, dict]) – The parameter value for parameterized gate. Default:
None.about_what (str) – calculate the gradient w.r.t which parameter.
- Returns:
numpy.ndarray, the differential form matrix.
- get_cpp_obj()#
Construct cpp obj.
- matrix(pr=None, full=False)#
Get the matrix of this parameterized gate.
- Parameters:
pr (Union[ParameterResolver, dict]) – The parameter value for parameterized gate. Default:
None.full (bool) – Whether to get the full matrix of this gate (the gate should be acted on some qubits). Default:
False.
- Returns:
numpy.ndarray, the matrix of this gate.