cirq.StabilizerStateChForm

A representation of stabilizer states using the CH form,

Inherits From: StabilizerState, QuantumStateRepresentation

\\(|\psi> = \omega U_C U_H |s>\\)

This representation keeps track of overall phase.

Reference: https://arxiv.org/abs/1808.00128

can_represent_mixed_states Subclasses that can represent mixed states should override this.
supports_factor Subclasses that allow factorization should override this.

Methods

apply_cx

View source

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

View source

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

View source

Apply a global phase to the state.

Args
coefficient The global phase to apply.

apply_h

View source

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

View source

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

View source

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

View source

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

View source

Creates a copy of the object.

Args
deep_copy_buffers If True, buffers will also be deep-copied. Otherwise the copy will share a reference to the original object's buffers.

Returns
A copied instance.

factor

View source

Splits two state spaces after a measurement or reset.

inner_product_of_state_and_x

View source

Returns the amplitude of x'th element of the state vector, i.e.

kron

View source

Joins two state spaces together.

measure

View source

Measures the state.

Args
axes The axes to measure.
seed The random number seed to use.

Returns
The measurements in order.

project_Z

View source

Applies a Z projector on the q'th qubit.

Returns: a normalized state with Z_q |psi> = z |psi>

reindex

View source

Physically reindexes the state by the new basis.

Args
axes The desired axis order.

Returns
The state with qubit order transposed and underlying representation updated.

sample

View source

Samples the state. Subclasses can override with more performant method.

Args
axes The axes to sample.
repetitions The number of samples to make.
seed The random number seed to use.

Returns
The samples in order.

state_vector

View source

to_state_vector

View source

update_sum

View source

Implements the transformation (Proposition 4 in Bravyi et al)

i^alpha U_H (|t> + i^delta |u>) = omega W_C W_H |s'>

__eq__

View source

__ne__

View source