loom.cliffordsim.tableau

Copyright 2024 Entropica Labs Pte Ltd

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class loom.cliffordsim.tableau.Tableau(nqubits=None, initial_tableau=None, seed=None)[source]

Bases: object

The Tableau class represents the stabilizer state of a quantum system using the tableau representation. It provides methods to manipulate and query the stabilizer state.

Initializes the the state |00…0>.

create_snapshot()[source]

Creates a TableauSnapshot object, a snapshot of the state of the Tableau, that contains important properties of the Tableau.

The TableauSnapshot object can then be used to restore the state of the Tableau at the time the TableauSnapshot was created.

Return type:

TableauSnapshot

dtype

alias of int8

property nqubits: int

The number of qubits in the tableau.

restore(engine_snapshot)[source]

This method allows us to restore the state of the Tableau with a TableauSnapshot Object. Once the Tableau has been restored, the views would be redefined.

Return type:

None

rewrite_tableau(input_tableau)[source]

This method updates the internal tableau of this Tableau by returning a new Tableau with the updated tableau. The tableau is updated as a whole. This method also checks for compatibility of the updated tableau.

Return type:

Tableau

property stabilizer_set: set[str]

Generates the stabilizers in human readable format.

property stabilizer_set_sparse_format: list[dict]

Returns the stabilizers in more human readable format. This is the sparse format.

Note: the formatter function can be called by user directly as well. Look for it in QCDutils

Returns:

A list of dicts, each dict representing one stabilizer operator. The keys refer to the Pauli operators, while value refer to the qubit indices where the Pauli operator resides. E.g. +ZXIIYXZII gets returned as {‘sign’:’+’, ‘X’:(1,5), ‘Z’:(0,6), ‘Y’:(4,)}

Return type:

list[dict]

update()[source]

Updates the internal structure after the tableau has been modified

class loom.cliffordsim.tableau.TableauSnapshot(nqubits, rand_gen, tableau_w_scratch)[source]

Bases: object

A snapshot of the Tableau at a specific point in time.

nqubits: int
rand_gen: int
tableau_w_scratch: ndarray
loom.cliffordsim.tableau.compare_stabilizer_set(engine_rep_1, engine_rep_2)[source]

Returns true if the stabilizer set of both Tableau(s) are equal when they are reduced.

Return type:

bool