pauli_tracker.frames.StackedTransposed
- class pauli_tracker.frames.StackedTransposed
Bases:
object
The frames of a Frames-tracker with swapped major and minor axis.
This is usually returned from the according stacked_transpose method of a Frames object. The frames are now on the major axis and the qubits on the minor axis.
- __init__(stacks)
Create a new StackedTransposed
- Parameters:
stacks (list[PauliStack]) – The stacks to wrap.
- Returns:
StackedTransposed
Methods
__init__
(stacks)Create a new StackedTransposed
deserialize
(file_path[, serialization_format])Deserialize the internal data structure from a file.
deserialize_from_string
(string[, ...])Deserialize the internal data structure from a string.
get
(index)Get the Pauli stack at the given index.
get_and_add_to_stack
(index, stack)Get the Pauli stack at the given index and add it to the given stack.
Transform and return the internal Rust data representation into the according Python representation.
pop
()serialize
(file_path[, serialization_format])Serialize the internal data structure into a file.
serialize_to_string
([serialization_format])Serialize the internal data structure into a string.
Transform and return the internal Rust data representation into the according Python representation replacing the internal data with its default value.
- static deserialize(file_path, serialization_format='serde_json')
Deserialize the internal data structure from a file.
- Parameters:
file_path (str) – The path to the file to read from.
serialization_format (str) – The serialization format to use. The supported formats are: serde_json and bincode.
- static deserialize_from_string(string, serialization_format='serde_json')
Deserialize the internal data structure from a string.
- Parameters:
string (str) – The string to read from.
serialization_format (str) – The serialization format to use. The supported formats are: serde_json.
- get(index)
Get the Pauli stack at the given index.
Use
get_and_add_to_stack()
if you directly want to add it to another stack to avoid cloning.- Parameters:
index (int) – The index of the stack to get.
- Return type:
- get_and_add_to_stack(index, stack)
Get the Pauli stack at the given index and add it to the given stack.
- Parameters:
index (int) – The index of the stack to get.
stack (PauliStack) – The stack to add the gotten stack to.
- into_py_matrix()
Transform and return the internal Rust data representation into the according Python representation. If you do this mutiple times consider using the according take_ method to avoid an additional clone, however, be aware that the internal data is replaced with its default value.
- Returns:
list[tuple[list[int], list[int]]]
- serialize(file_path, serialization_format='serde_json')
Serialize the internal data structure into a file.
- Parameters:
file_path (str) – The path to the file to write to.
serialization_format (str) – The serialization format to use. The supported formats are: serde_json and bincode.
- serialize_to_string(serialization_format='serde_json')
Serialize the internal data structure into a string.
- Parameters:
serialization_format (str) – The serialization format to use. The supported formats are: serde_json.
- take_into_py_matrix()
Transform and return the internal Rust data representation into the according Python representation replacing the internal data with its default value.
- Returns:
list[tuple[list[int], list[int]]]