![]() |
A representation of stabilizer states using the CH form,
Inherits From: StabilizerState
cirq.StabilizerStateChForm(
num_qubits: int, initial_state: int = 0
) -> None
\\(|\psi> = \omega U_C U_H |s>\\)
This representation keeps track of overall phase.
Reference: https://arxiv.org/abs/1808.00128
Args | |
---|---|
num_qubits
|
The number of qubits in the system. |
initial_state
|
The computational basis representation of the state as a big endian int. |
Methods
apply_cx
apply_cx(
control_axis: int,
target_axis: int,
exponent: float = 1,
global_shift: float = 0
)
Apply a CX operation to the state.
Args | |
---|---|
control_axis
|
The control axis of the operation. |
target_axis
|
The axis to which the operation should be applied. |
exponent
|
The exponent of the CX operation, must be an integer. |
global_shift
|
The global phase shift of the raw operation, prior to
exponentiation. Typically the value in gate.global_shift .
|
Raises | |
---|---|
ValueError
|
If the exponent is not an integer. |
apply_cz
apply_cz(
control_axis: int,
target_axis: int,
exponent: float = 1,
global_shift: float = 0
)
Apply a CZ operation to the state.
Args | |
---|---|
control_axis
|
The control axis of the operation. |
target_axis
|
The axis to which the operation should be applied. |
exponent
|
The exponent of the CZ operation, must be an integer. |
global_shift
|
The global phase shift of the raw operation, prior to
exponentiation. Typically the value in gate.global_shift .
|
Raises | |
---|---|
ValueError
|
If the exponent is not an integer. |
apply_global_phase
apply_global_phase(
coefficient: value.Scalar
)
Apply a global phase to the state.
Args | |
---|---|
coefficient
|
The global phase to apply. |
apply_h
apply_h(
axis: int, exponent: float = 1, global_shift: float = 0
)
Apply an H operation to the state.
Args | |
---|---|
axis
|
The axis to which the operation should be applied. |
exponent
|
The exponent of the H operation, must be an integer. |
global_shift
|
The global phase shift of the raw operation, prior to
exponentiation. Typically the value in gate.global_shift .
|
Raises | |
---|---|
ValueError
|
If the exponent is not an integer. |
apply_x
apply_x(
axis: int, exponent: float = 1, global_shift: float = 0
)
Apply an X operation to the state.
Args | |
---|---|
axis
|
The axis to which the operation should be applied. |
exponent
|
The exponent of the X operation, must be a half-integer. |
global_shift
|
The global phase shift of the raw operation, prior to
exponentiation. Typically the value in gate.global_shift .
|
Raises | |
---|---|
ValueError
|
If the exponent is not half-integer. |
apply_y
apply_y(
axis: int, exponent: float = 1, global_shift: float = 0
)
Apply an Y operation to the state.
Args | |
---|---|
axis
|
The axis to which the operation should be applied. |
exponent
|
The exponent of the Y operation, must be a half-integer. |
global_shift
|
The global phase shift of the raw operation, prior to
exponentiation. Typically the value in gate.global_shift .
|
Raises | |
---|---|
ValueError
|
If the exponent is not half-integer. |
apply_z
apply_z(
axis: int, exponent: float = 1, global_shift: float = 0
)
Apply a Z operation to the state.
Args | |
---|---|
axis
|
The axis to which the operation should be applied. |
exponent
|
The exponent of the Z operation, must be a half-integer. |
global_shift
|
The global phase shift of the raw operation, prior to
exponentiation. Typically the value in gate.global_shift .
|
Raises | |
---|---|
ValueError
|
If the exponent is not half-integer. |
copy
copy() -> 'cirq.StabilizerStateChForm'
inner_product_of_state_and_x
inner_product_of_state_and_x(
x: int
) -> Union[float, complex]
Returns the amplitude of x'th element of
the state vector, i.e.
kron
kron(
other: 'cirq.StabilizerStateChForm'
) -> 'cirq.StabilizerStateChForm'
project_Z
project_Z(
q, z
)
Applies a Z projector on the q'th qubit.
Returns: a normalized state with Z_q |psi> = z |psi>
reindex
reindex(
axes: Sequence[int]
) -> 'cirq.StabilizerStateChForm'
state_vector
state_vector() -> np.ndarray
to_state_vector
to_state_vector() -> np.ndarray
update_sum
update_sum(
t, u, delta=0, alpha=0
)
Implements the transformation (Proposition 4 in Bravyi et al)
i^alpha U_H (|t> + i^delta |u>) = omega W_C W_H |s'>
__eq__
__eq__(
other: _SupportsValueEquality
) -> bool