Пример #1
0
    def __init__(self,
                 pauli0: Pauli, invert0: bool,
                 pauli1: Pauli, invert1: bool,
                 *,
                 half_turns: Optional[Union[value.Symbol, float]] = None,
                 rads: Optional[float] = None,
                 degs: Optional[float] = None) -> None:
        """At most one angle argument may be specified. If more are specified,
        the result is considered ambiguous and an error is thrown. If no angle
        argument is given, the default value of one half turn is used.

        Args:
            half_turns: Relative phasing of the interaction's eigenstates, in
                half_turns.
            rads: Relative phasing of the interaction's eigenstates, in radians.
            degs: Relative phasing of the interaction's eigenstates, in degrees.
        """
        super().__init__(exponent=value.chosen_angle_to_half_turns(
            half_turns=half_turns,
            rads=rads,
            degs=degs))
        self.pauli0 = pauli0
        self.invert0 = invert0
        self.pauli1 = pauli1
        self.invert1 = invert1
Пример #2
0
    def __init__(
            self,
            pauli_string: PauliString,
            *,  # Forces keyword args.
            half_turns: Optional[Union[sympy.Basic, float]] = None,
            rads: Optional[float] = None,
            degs: Optional[float] = None) -> None:
        """Initializes the operation.

        At most one angle argument may be specified. If more are specified,
        the result is considered ambiguous and an error is thrown. If no angle
        argument is given, the default value of one half turn is used.

        If pauli_string is negative, the sign is transferred to the phase.

        Args:
            pauli_string: The PauliString to phase.
            half_turns: Phasing of the Pauli string, in half_turns.
            rads: Phasing of the Pauli string, in radians.
            degs: Phasing of the Pauli string, in degrees.
        """
        half_turns = value.chosen_angle_to_half_turns(half_turns=half_turns,
                                                      rads=rads,
                                                      degs=degs)
        if not isinstance(half_turns, sympy.Basic):
            half_turns = 1 - (1 - half_turns) % 2
        super().__init__(pauli_string)
        self.half_turns = half_turns
Пример #3
0
    def __init__(self,
                 pauli0: Pauli,
                 invert0: bool,
                 pauli1: Pauli,
                 invert1: bool,
                 *,
                 half_turns: Optional[Union[value.Symbol, float]] = None,
                 rads: Optional[float] = None,
                 degs: Optional[float] = None) -> None:
        """At most one angle argument may be specified. If more are specified,
        the result is considered ambiguous and an error is thrown. If no angle
        argument is given, the default value of one half turn is used.

        Args:
            half_turns: Relative phasing of the interaction's eigenstates, in
                half_turns.
            rads: Relative phasing of the interaction's eigenstates, in radians.
            degs: Relative phasing of the interaction's eigenstates, in degrees.
        """
        super().__init__(exponent=value.chosen_angle_to_half_turns(
            half_turns=half_turns, rads=rads, degs=degs))
        self.pauli0 = pauli0
        self.invert0 = invert0
        self.pauli1 = pauli1
        self.invert1 = invert1
Пример #4
0
    def __init__(
            self,
            *,  # Forces keyword args.
            half_turns: Optional[Union[value.Symbol, float]] = None,
            rads: Optional[float] = None,
            degs: Optional[float] = None,
            global_shift_in_half_turns: float = 0.0) -> None:
        """Initializes the gate.

        At most one relative phasing angle argument may be specified. If more
        are specified, the result is considered ambiguous and an error is
        thrown. If no angle argument is given, the default value of one half
        turn is used.

        Args:
            half_turns: The relative phasing of Z's eigenstates, in half_turns.
            rads: The relative phasing of Z's eigenstates, in radians.
            degs: The relative phasing of Z's eigenstates, in degrees.
            global_shift_in_half_turns: Offsets the eigenvalues of the gate.
                The default shift of 0 gives the Z gate's matrix eigenvalues of
                +1 and -1, whereas a shift of -0.5 changes those eigenvalues to
                -i and +i. The shift is always specified assuming an exponent of
                one (i.e. a 180 degree rotation).
        """
        super().__init__(exponent=value.chosen_angle_to_half_turns(
            half_turns=half_turns, rads=rads, degs=degs),
                         global_shift_in_half_turns=global_shift_in_half_turns)
Пример #5
0
    def __init__(self,
                 pauli_string: PauliString,
                 *,  # Forces keyword args.
                 half_turns: Optional[Union[value.Symbol, float]] = None,
                 rads: Optional[float] = None,
                 degs: Optional[float] = None) -> None:
        """Initializes the operation.

        At most one angle argument may be specified. If more are specified,
        the result is considered ambiguous and an error is thrown. If no angle
        argument is given, the default value of one half turn is used.

        If pauli_string is negative, the sign is transferred to the phase.

        Args:
            pauli_string: The PauliString to phase.
            half_turns: Phasing of the Pauli string, in half_turns.
            rads: Phasing of the Pauli string, in radians.
            degs: Phasing of the Pauli string, in degrees.
        """
        half_turns = value.chosen_angle_to_half_turns(
                            half_turns=half_turns,
                            rads=rads,
                            degs=degs)
        if not isinstance(half_turns, value.Symbol):
            half_turns = 1 - (1 - half_turns) % 2
        super().__init__(pauli_string)
        self.half_turns = half_turns
Пример #6
0
    def __init__(
            self,
            *,  # Forces keyword args.
            half_turns: Optional[Union[value.Symbol, float]] = None,
            rads: Optional[float] = None,
            degs: Optional[float] = None) -> None:
        """Initializes the gate.

        At most one angle argument may be specified. If more are specified,
        the result is considered ambiguous and an error is thrown. If no angle
        argument is given, the default value of one half turn is used.

        Args:
            half_turns: The relative phasing of X's eigenstates, in half_turns.
            rads: The relative phasing of X's eigenstates, in radians.
            degs: The relative phasing of X's eigenstates, in degrees.
        """
        super().__init__(exponent=value.chosen_angle_to_half_turns(
            half_turns=half_turns, rads=rads, degs=degs))
Пример #7
0
    def __init__(self, *,  # Forces keyword args.
                 half_turns: Optional[Union[value.Symbol, float]] = None,
                 rads: Optional[float] = None,
                 degs: Optional[float] = None) -> None:
        """Initializes the gate.

        At most one angle argument may be specified. If more are specified,
        the result is considered ambiguous and an error is thrown. If no angle
        argument is given, the default value of one half turn is used.

        Args:
            half_turns: Relative phasing of CNOT's eigenstates, in half_turns.
            rads: Relative phasing of CNOT's eigenstates, in radians.
            degs: Relative phasing of CNOT's eigenstates, in degrees.
        """
        super().__init__(exponent=value.chosen_angle_to_half_turns(
            half_turns=half_turns,
            rads=rads,
            degs=degs))