pygsti.evotypes.stabilizer_slow

A pure python (and thus slower) stabilizer-state, evolution type.

Submodules

Package Contents

Classes

_StateSpace

Base class for defining a state space (Hilbert or Hilbert-Schmidt space).

EffectRep

The base class for all POVM effect representation classes

EffectRepComputational

The base class for all POVM effect representation classes

EffectRepComposed

The base class for all POVM effect representation classes

_StateSpace

Base class for defining a state space (Hilbert or Hilbert-Schmidt space).

OpRep

The base class for all operation representation classes

OpRepClifford

The base class for all operation representation classes

OpRepStandard

The base class for all operation representation classes

OpRepComposed

The base class for all operation representation classes

OpRepSum

The base class for all operation representation classes

OpRepEmbedded

The base class for all operation representation classes

OpRepExpErrorgen

The base class for all operation representation classes

OpRepRepeated

The base class for all operation representation classes

OpRepLindbladErrorgen

The base class for all operation representation classes

_StateSpace

Base class for defining a state space (Hilbert or Hilbert-Schmidt space).

StateRep

The base class for all state representation classes

StateRepComputational

The base class for all state representation classes

StateRepComposed

The base class for all state representation classes

StateRepTensorProduct

The base class for all state representation classes

Attributes

minimal_space

pygsti.evotypes.stabilizer_slow.minimal_space = Hilbert
class pygsti.evotypes.stabilizer_slow._StateSpace

Bases: pygsti.baseobjs.nicelyserializable.NicelySerializable

Base class for defining a state space (Hilbert or Hilbert-Schmidt space).

This base class just sets the API for a “state space” in pyGSTi, accessed as the direct sum of one or more tensor products of Hilbert spaces.

classmethod cast(cls, obj)

Casts obj into a StateSpace object if possible.

If obj is already of this type, it is simply returned without modification.

Parameters

obj (StateSpace or int or list) – Either an already-built state space object or an integer specifying the number of qubits, or a list of labels as would be provided to the first argument of :method:`ExplicitStateSpace.__init__`.

Returns

StateSpace

property udim(self)

Integer Hilbert (unitary operator) space dimension of this quantum state space.

Raises an error if this space is not a quantum state space.

property dim(self)

Integer Hilbert-Schmidt (super-operator) or classical dimension of this state space.

property num_qubits(self)

The number of qubits in this quantum state space.

Raises a ValueError if this state space doesn’t consist entirely of qubits.

property num_tensor_product_blocks(self)

The number of tensor-product blocks which are direct-summed to get the final state space.

Returns

int

property tensor_product_blocks_labels(self)

The labels for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_dimensions(self)

The superoperator dimensions for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_udimensions(self)

The unitary operator dimensions for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_types(self)

The type (quantum vs classical) of all the tensor-product blocks.

Returns

tuple of tuples

abstract label_dimension(self, label)

The superoperator dimension of the given label (from any tensor product block)

Parameters

label (str or int) – The label whose dimension should be retrieved.

Returns

int

abstract label_udimension(self, label)

The unitary operator dimension of the given label (from any tensor product block)

Parameters

label (str or int) – The label whose dimension should be retrieved.

Returns

int

abstract label_tensor_product_block_index(self, label)

The index of the tensor product block containing the given label.

Parameters

label (str or int) – The label whose index should be retrieved.

Returns

int

abstract label_type(self, label)

The type (quantum or classical) of the given label (from any tensor product block).

Parameters

label (str or int) – The label whose type should be retrieved.

Returns

str

tensor_product_block_labels(self, i_tpb)

The labels for the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

tensor_product_block_dimensions(self, i_tpb)

The superoperator dimensions for the factors in the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

tensor_product_block_udimensions(self, i_tpb)

The unitary-operator dimensions for the factors in the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

copy(self)

Return a copy of this StateSpace.

Returns

StateSpace

is_compatible_with(self, other_state_space)

Whether another state space is compatible with this one.

Two state spaces are considered “compatible” when their overall dimensions agree (even if their tensor product block structure and labels do not). (This checks whether the Hilbert spaces are isomorphic.)

Parameters

other_state_space (StateSpace) – The state space to check compatibility with.

Returns

bool

property is_entirely_qubits(self)

Whether this state space is just the tensor product of qubit subspaces.

Returns

bool

is_entire_space(self, labels)

True if this state space is a single tensor product block with (exactly, in order) the given set of labels.

Parameters

labels (iterable) – the labels to test.

Returns

bool

contains_labels(self, labels)

True if this state space contains all of a given set of labels.

Parameters

labels (iterable) – the labels to test.

Returns

bool

contains_label(self, label)

True if this state space contains a given label.

Parameters

label (str or int) – the label to test for.

Returns

bool

property common_dimension(self)

Returns the common super-op dimension of all the labels in this space.

If not all the labels in this space have the same dimension, then None is returned to indicate this.

This property is useful when working with stencils, where operations are created for a “stencil space” that is not exactly a subspace of a StateSpace space but will be mapped to one in the future.

Returns

int or None

property common_udimension(self)

Returns the common unitary-op dimension of all the labels in this space.

If not all the labels in this space have the same dimension, then None is returned to indicate this.

This property is useful when working with stencils, where operations are created for a “stencil space” that is not exactly a subspace of a StateSpace space but will be mapped to one in the future.

Returns

int or None

create_subspace(self, labels)

Create a sub-StateSpace object from a set of existing labels.

Parameters

labels (iterable) – The labels to include in the returned state space.

Returns

StateSpace

intersection(self, other_state_space)

Create a state space whose labels are the intersection of the labels of this space and one other.

Dimensions associated with the labels are preserved, as is the ordering of tensor product blocks. If the two spaces have the same label, but their dimensions or indices do not agree, an error is raised.

Parameters

other_state_space (StateSpace) – The other state space.

Returns

StateSpace

union(self, other_state_space)

Create a state space whose labels are the union of the labels of this space and one other.

Dimensions associated with the labels are preserved, as is the tensor product block index. If the two spaces have the same label, but their dimensions or indices do not agree, an error is raised.

Parameters

other_state_space (StateSpace) – The other state space.

Returns

StateSpace

create_stencil_subspace(self, labels)

Create a template sub-StateSpace object from a set of potentially stencil-type labels.

That is, the elements of labels don’t need to actually exist within this state space – they may be stencil labels that will resolve to a label in this state space later on.

Parameters

labels (iterable) – The labels to include in the returned state space.

Returns

StateSpace

__repr__(self)

Return repr(self).

__hash__(self)

Return hash(self).

__eq__(self, other_statespace)

Return self==value.

class pygsti.evotypes.stabilizer_slow.EffectRep(state_space)

Bases: pygsti.evotypes.basereps.EffectRep

The base class for all POVM effect representation classes

property nqubits(self)
probability(self, state)
amplitude(self, state)
to_dense(self, on_space)
class pygsti.evotypes.stabilizer_slow.EffectRepComputational(zvals, basis, state_space)

Bases: EffectRep

The base class for all POVM effect representation classes

__str__(self)

Return str(self).

to_dense(self, on_space, outvec=None)
class pygsti.evotypes.stabilizer_slow.EffectRepComposed(op_rep, effect_rep, op_id, state_space)

Bases: EffectRep

The base class for all POVM effect representation classes

probability(self, state)
amplitude(self, state)
class pygsti.evotypes.stabilizer_slow._StateSpace

Bases: pygsti.baseobjs.nicelyserializable.NicelySerializable

Base class for defining a state space (Hilbert or Hilbert-Schmidt space).

This base class just sets the API for a “state space” in pyGSTi, accessed as the direct sum of one or more tensor products of Hilbert spaces.

classmethod cast(cls, obj)

Casts obj into a StateSpace object if possible.

If obj is already of this type, it is simply returned without modification.

Parameters

obj (StateSpace or int or list) – Either an already-built state space object or an integer specifying the number of qubits, or a list of labels as would be provided to the first argument of :method:`ExplicitStateSpace.__init__`.

Returns

StateSpace

property udim(self)

Integer Hilbert (unitary operator) space dimension of this quantum state space.

Raises an error if this space is not a quantum state space.

property dim(self)

Integer Hilbert-Schmidt (super-operator) or classical dimension of this state space.

property num_qubits(self)

The number of qubits in this quantum state space.

Raises a ValueError if this state space doesn’t consist entirely of qubits.

property num_tensor_product_blocks(self)

The number of tensor-product blocks which are direct-summed to get the final state space.

Returns

int

property tensor_product_blocks_labels(self)

The labels for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_dimensions(self)

The superoperator dimensions for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_udimensions(self)

The unitary operator dimensions for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_types(self)

The type (quantum vs classical) of all the tensor-product blocks.

Returns

tuple of tuples

abstract label_dimension(self, label)

The superoperator dimension of the given label (from any tensor product block)

Parameters

label (str or int) – The label whose dimension should be retrieved.

Returns

int

abstract label_udimension(self, label)

The unitary operator dimension of the given label (from any tensor product block)

Parameters

label (str or int) – The label whose dimension should be retrieved.

Returns

int

abstract label_tensor_product_block_index(self, label)

The index of the tensor product block containing the given label.

Parameters

label (str or int) – The label whose index should be retrieved.

Returns

int

abstract label_type(self, label)

The type (quantum or classical) of the given label (from any tensor product block).

Parameters

label (str or int) – The label whose type should be retrieved.

Returns

str

tensor_product_block_labels(self, i_tpb)

The labels for the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

tensor_product_block_dimensions(self, i_tpb)

The superoperator dimensions for the factors in the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

tensor_product_block_udimensions(self, i_tpb)

The unitary-operator dimensions for the factors in the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

copy(self)

Return a copy of this StateSpace.

Returns

StateSpace

is_compatible_with(self, other_state_space)

Whether another state space is compatible with this one.

Two state spaces are considered “compatible” when their overall dimensions agree (even if their tensor product block structure and labels do not). (This checks whether the Hilbert spaces are isomorphic.)

Parameters

other_state_space (StateSpace) – The state space to check compatibility with.

Returns

bool

property is_entirely_qubits(self)

Whether this state space is just the tensor product of qubit subspaces.

Returns

bool

is_entire_space(self, labels)

True if this state space is a single tensor product block with (exactly, in order) the given set of labels.

Parameters

labels (iterable) – the labels to test.

Returns

bool

contains_labels(self, labels)

True if this state space contains all of a given set of labels.

Parameters

labels (iterable) – the labels to test.

Returns

bool

contains_label(self, label)

True if this state space contains a given label.

Parameters

label (str or int) – the label to test for.

Returns

bool

property common_dimension(self)

Returns the common super-op dimension of all the labels in this space.

If not all the labels in this space have the same dimension, then None is returned to indicate this.

This property is useful when working with stencils, where operations are created for a “stencil space” that is not exactly a subspace of a StateSpace space but will be mapped to one in the future.

Returns

int or None

property common_udimension(self)

Returns the common unitary-op dimension of all the labels in this space.

If not all the labels in this space have the same dimension, then None is returned to indicate this.

This property is useful when working with stencils, where operations are created for a “stencil space” that is not exactly a subspace of a StateSpace space but will be mapped to one in the future.

Returns

int or None

create_subspace(self, labels)

Create a sub-StateSpace object from a set of existing labels.

Parameters

labels (iterable) – The labels to include in the returned state space.

Returns

StateSpace

intersection(self, other_state_space)

Create a state space whose labels are the intersection of the labels of this space and one other.

Dimensions associated with the labels are preserved, as is the ordering of tensor product blocks. If the two spaces have the same label, but their dimensions or indices do not agree, an error is raised.

Parameters

other_state_space (StateSpace) – The other state space.

Returns

StateSpace

union(self, other_state_space)

Create a state space whose labels are the union of the labels of this space and one other.

Dimensions associated with the labels are preserved, as is the tensor product block index. If the two spaces have the same label, but their dimensions or indices do not agree, an error is raised.

Parameters

other_state_space (StateSpace) – The other state space.

Returns

StateSpace

create_stencil_subspace(self, labels)

Create a template sub-StateSpace object from a set of potentially stencil-type labels.

That is, the elements of labels don’t need to actually exist within this state space – they may be stencil labels that will resolve to a label in this state space later on.

Parameters

labels (iterable) – The labels to include in the returned state space.

Returns

StateSpace

__repr__(self)

Return repr(self).

__hash__(self)

Return hash(self).

__eq__(self, other_statespace)

Return self==value.

class pygsti.evotypes.stabilizer_slow.OpRep(state_space)

Bases: pygsti.evotypes.basereps.OpRep

The base class for all operation representation classes

abstract acton(self, state)
abstract adjoint_acton(self, state)
property nqubits(self)
class pygsti.evotypes.stabilizer_slow.OpRepClifford(unitarymx, symplecticrep, basis, state_space)

Bases: OpRep

The base class for all operation representation classes

property unitary_dagger(self)
acton(self, state)

Act this gate map on an input state

adjoint_acton(self, state)

Act the adjoint of this operation matrix on an input state

__str__(self)

Return string representation

class pygsti.evotypes.stabilizer_slow.OpRepStandard(name, basis, state_space)

Bases: OpRepClifford

The base class for all operation representation classes

class pygsti.evotypes.stabilizer_slow.OpRepComposed(factor_op_reps, state_space)

Bases: OpRep

The base class for all operation representation classes

reinit_factor_op_reps(self, factor_op_reps)
acton(self, state)

Act this gate map on an input state

adjoint_acton(self, state)

Act the adjoint of this operation matrix on an input state

class pygsti.evotypes.stabilizer_slow.OpRepSum(factor_reps, state_space)

Bases: OpRep

The base class for all operation representation classes

reinit_factor_reps(self, factor_reps)
abstract acton(self, state)

Act this gate map on an input state

abstract adjoint_acton(self, state)

Act the adjoint of this operation matrix on an input state

class pygsti.evotypes.stabilizer_slow.OpRepEmbedded(state_space, target_labels, embedded_rep)

Bases: OpRep

The base class for all operation representation classes

acton(self, state)
adjoint_acton(self, state)
class pygsti.evotypes.stabilizer_slow.OpRepExpErrorgen(errorgen_rep)

Bases: OpRep

The base class for all operation representation classes

errgenrep_has_changed(self, onenorm_upperbound)
acton(self, state)
adjoint_acton(self, state)
class pygsti.evotypes.stabilizer_slow.OpRepRepeated(rep_to_repeat, num_repetitions, state_space)

Bases: OpRep

The base class for all operation representation classes

acton(self, state)

Act this gate map on an input state

adjoint_acton(self, state)

Act the adjoint of this operation matrix on an input state

class pygsti.evotypes.stabilizer_slow.OpRepLindbladErrorgen(lindblad_term_dict, basis, state_space)

Bases: OpRep

The base class for all operation representation classes

class pygsti.evotypes.stabilizer_slow._StateSpace

Bases: pygsti.baseobjs.nicelyserializable.NicelySerializable

Base class for defining a state space (Hilbert or Hilbert-Schmidt space).

This base class just sets the API for a “state space” in pyGSTi, accessed as the direct sum of one or more tensor products of Hilbert spaces.

classmethod cast(cls, obj)

Casts obj into a StateSpace object if possible.

If obj is already of this type, it is simply returned without modification.

Parameters

obj (StateSpace or int or list) – Either an already-built state space object or an integer specifying the number of qubits, or a list of labels as would be provided to the first argument of :method:`ExplicitStateSpace.__init__`.

Returns

StateSpace

property udim(self)

Integer Hilbert (unitary operator) space dimension of this quantum state space.

Raises an error if this space is not a quantum state space.

property dim(self)

Integer Hilbert-Schmidt (super-operator) or classical dimension of this state space.

property num_qubits(self)

The number of qubits in this quantum state space.

Raises a ValueError if this state space doesn’t consist entirely of qubits.

property num_tensor_product_blocks(self)

The number of tensor-product blocks which are direct-summed to get the final state space.

Returns

int

property tensor_product_blocks_labels(self)

The labels for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_dimensions(self)

The superoperator dimensions for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_udimensions(self)

The unitary operator dimensions for all the tensor-product blocks.

Returns

tuple of tuples

property tensor_product_blocks_types(self)

The type (quantum vs classical) of all the tensor-product blocks.

Returns

tuple of tuples

abstract label_dimension(self, label)

The superoperator dimension of the given label (from any tensor product block)

Parameters

label (str or int) – The label whose dimension should be retrieved.

Returns

int

abstract label_udimension(self, label)

The unitary operator dimension of the given label (from any tensor product block)

Parameters

label (str or int) – The label whose dimension should be retrieved.

Returns

int

abstract label_tensor_product_block_index(self, label)

The index of the tensor product block containing the given label.

Parameters

label (str or int) – The label whose index should be retrieved.

Returns

int

abstract label_type(self, label)

The type (quantum or classical) of the given label (from any tensor product block).

Parameters

label (str or int) – The label whose type should be retrieved.

Returns

str

tensor_product_block_labels(self, i_tpb)

The labels for the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

tensor_product_block_dimensions(self, i_tpb)

The superoperator dimensions for the factors in the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

tensor_product_block_udimensions(self, i_tpb)

The unitary-operator dimensions for the factors in the iTBP-th tensor-product block.

Parameters

i_tpb (int) – Tensor-product block index.

Returns

tuple

copy(self)

Return a copy of this StateSpace.

Returns

StateSpace

is_compatible_with(self, other_state_space)

Whether another state space is compatible with this one.

Two state spaces are considered “compatible” when their overall dimensions agree (even if their tensor product block structure and labels do not). (This checks whether the Hilbert spaces are isomorphic.)

Parameters

other_state_space (StateSpace) – The state space to check compatibility with.

Returns

bool

property is_entirely_qubits(self)

Whether this state space is just the tensor product of qubit subspaces.

Returns

bool

is_entire_space(self, labels)

True if this state space is a single tensor product block with (exactly, in order) the given set of labels.

Parameters

labels (iterable) – the labels to test.

Returns

bool

contains_labels(self, labels)

True if this state space contains all of a given set of labels.

Parameters

labels (iterable) – the labels to test.

Returns

bool

contains_label(self, label)

True if this state space contains a given label.

Parameters

label (str or int) – the label to test for.

Returns

bool

property common_dimension(self)

Returns the common super-op dimension of all the labels in this space.

If not all the labels in this space have the same dimension, then None is returned to indicate this.

This property is useful when working with stencils, where operations are created for a “stencil space” that is not exactly a subspace of a StateSpace space but will be mapped to one in the future.

Returns

int or None

property common_udimension(self)

Returns the common unitary-op dimension of all the labels in this space.

If not all the labels in this space have the same dimension, then None is returned to indicate this.

This property is useful when working with stencils, where operations are created for a “stencil space” that is not exactly a subspace of a StateSpace space but will be mapped to one in the future.

Returns

int or None

create_subspace(self, labels)

Create a sub-StateSpace object from a set of existing labels.

Parameters

labels (iterable) – The labels to include in the returned state space.

Returns

StateSpace

intersection(self, other_state_space)

Create a state space whose labels are the intersection of the labels of this space and one other.

Dimensions associated with the labels are preserved, as is the ordering of tensor product blocks. If the two spaces have the same label, but their dimensions or indices do not agree, an error is raised.

Parameters

other_state_space (StateSpace) – The other state space.

Returns

StateSpace

union(self, other_state_space)

Create a state space whose labels are the union of the labels of this space and one other.

Dimensions associated with the labels are preserved, as is the tensor product block index. If the two spaces have the same label, but their dimensions or indices do not agree, an error is raised.

Parameters

other_state_space (StateSpace) – The other state space.

Returns

StateSpace

create_stencil_subspace(self, labels)

Create a template sub-StateSpace object from a set of potentially stencil-type labels.

That is, the elements of labels don’t need to actually exist within this state space – they may be stencil labels that will resolve to a label in this state space later on.

Parameters

labels (iterable) – The labels to include in the returned state space.

Returns

StateSpace

__repr__(self)

Return repr(self).

__hash__(self)

Return hash(self).

__eq__(self, other_statespace)

Return self==value.

class pygsti.evotypes.stabilizer_slow.StateRep(smatrix, pvectors, amps, state_space)

Bases: pygsti.evotypes.basereps.StateRep

The base class for all state representation classes

property smatrix(self)
property pvectors(self)
property amps(self)
property nqubits(self)
actionable_staterep(self)
copy(self)
__str__(self)

Return str(self).

class pygsti.evotypes.stabilizer_slow.StateRepComputational(zvals, basis, state_space)

Bases: StateRep

The base class for all state representation classes

class pygsti.evotypes.stabilizer_slow.StateRepComposed(state_rep, op_rep, state_space)

Bases: StateRep

The base class for all state representation classes

reps_have_changed(self)
actionable_staterep(self)
class pygsti.evotypes.stabilizer_slow.StateRepTensorProduct(factor_state_reps, state_space)

Bases: StateRep

The base class for all state representation classes

reps_have_changed(self)