mindquantum.core.gates.UnivMathGate

View Source On Gitee
class mindquantum.core.gates.UnivMathGate(name, matrix_value)[source]

Universal math gate.

More usage, please see XGate.

Parameters
  • name (str) – the name of this gate.

  • mat (np.ndarray) – the matrix value of this gate.

Examples

>>> from mindquantum.core.gates import UnivMathGate
>>> x_mat=np.array([[0,1],[1,0]])
>>> X_gate=UnivMathGate('X',x_mat)
>>> x1=X_gate.on(0,1)
>>> print(x1)
X(0 <-: 1)
get_cpp_obj()[source]

Get the underlying C++ object.