mindquantum.core.gates.GlobalPhase

View Source On Gitee
class mindquantum.core.gates.GlobalPhase(pr)[source]

Global phase gate. More usage, please see RX.

\[\begin{split}{\rm GlobalPhase}=\begin{pmatrix}\exp(-i\theta)&0\\ 0&\exp(-i\theta)\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, **kwargs)[source]

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. Default: None.

  • kwargs (dict) – other key arguments.

Returns

numpy.ndarray, the differential form matrix.

get_cpp_obj()[source]

Construct cpp obj.

matrix(pr=None, full=False, **kwargs)[source]

Matrix of 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.

  • kwargs (dict) – other key arguments.

Returns

numpy.ndarray, the matrix of this gate.