def __init__(self,
                 tensor: bk.TensorLike,
                 qubits: Qubits = None,  # FIXME: Consistent interface
                 params: Dict[str, float] = None,
                 name: str = None) -> None:
        """Create a new gate from a gate tensor or operator.

            params: Parameters used to define this gate
        """
        if qubits is None:
            tensor = bk.astensorproduct(tensor)
            N = bk.rank(tensor) // 2
            qubits = range(N)

        self.vec = QubitVector(tensor, qubits)

        if params is None:
            params = {}
        self.params = params

        if name is None:
            name = self.__class__.__name__
        self._name = name
def __init__ ( self , tensor : bk . TensorLike , qubits : Qubits = None , params : Dict [ str , float ] = None , name : str = None ) -> None : if qubits is None : tensor = bk . astensorproduct ( tensor ) N = bk . rank ( tensor ) // 2 qubits = range ( N ) self . vec = QubitVector ( tensor , qubits ) if params is None : params = { } self . params = params if name is None : name = self . __class__ . __name__ self . _name = name
Create a new gate from a gate tensor or operator.

            params: Parameters used to define this gate