def power(self, exponent: float):
    'Creates a unitary gate as `gate^exponent`.\n\n        Args:\n            exponent (float): Gate^exponent\n\n        Returns:\n            qiskit.extensions.UnitaryGate: To which `to_matrix` is self.to_matrix^exponent.\n\n        Raises:\n            CircuitError: If Gate is not unitary\n        '
    from qiskit.quantum_info.operators import Operator
    from qiskit.extensions.unitary import UnitaryGate
    (decomposition, unitary) = schur(Operator(self).data, output='complex')
    decomposition_power = list()
    decomposition_diagonal = decomposition.diagonal()
    if (not np.allclose(np.diag(decomposition_diagonal), decomposition)):
        raise CircuitError('The matrix is not diagonal')
    for element in decomposition_diagonal:
        decomposition_power.append(pow(element, exponent))
    unitary_power = ((unitary @ np.diag(decomposition_power)) @ unitary.conj().T)
    return UnitaryGate(unitary_power, label=('%s^%s' % (self.name, exponent)))
Creates a unitary gate as `gate^exponent`.

Args:
    exponent (float): Gate^exponent

Returns:
    qiskit.extensions.UnitaryGate: To which `to_matrix` is self.to_matrix^exponent.

Raises:
    CircuitError: If Gate is not unitary
def power(self, exponent: float):
    'Creates a unitary gate as `gate^exponent`.\n\n        Args:\n            exponent (float): Gate^exponent\n\n        Returns:\n            qiskit.extensions.UnitaryGate: To which `to_matrix` is self.to_matrix^exponent.\n\n        Raises:\n            CircuitError: If Gate is not unitary\n        '
    from qiskit.quantum_info.operators import Operator
    from qiskit.extensions.unitary import UnitaryGate
    (decomposition, unitary) = schur(Operator(self).data, output='complex')
    decomposition_power = list()
    decomposition_diagonal = decomposition.diagonal()
    if (not np.allclose(np.diag(decomposition_diagonal), decomposition)):
        raise CircuitError('The matrix is not diagonal')
    for element in decomposition_diagonal:
        decomposition_power.append(pow(element, exponent))
    unitary_power = ((unitary @ np.diag(decomposition_power)) @ unitary.conj().T)
    return UnitaryGate(unitary_power, label=('%s^%s' % (self.name, exponent)))