pauli_tracker.frames.map.Frames
- class pauli_tracker.frames.map.Frames
Bases:
object
Frames<Map<PauliStack<BitVec>>>.
- __init__(len=0)
Create a new Frames tracker.
- Parameters:
len (int) – The number of qubits to track
- Return type:
Methods
__init__
([len])Create a new Frames tracker.
cx
(control, target)cy
(control, target)cz
(bit_a, bit_b)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
(bit)Get the Pauli stack of a qubit in the tracker, returning None if the qubit was not initialized.
get_order
(map)This is just get_order as a method.
get_py_order
(map)Like
get_order()
, but directly returns the graph as a Python type.h
(bit)hs
(bit)hxy
(bit)hyz
(bit)id
(bit)Transform and return the internal Rust data representation into the according Python representation.
Transform and return the internal Rust data representation into the according Python representation.
iswap
(bit_a, bit_b)iswapdg
(bit_a, bit_b)measure
(bit)Remove a qubit in the tracker, returning the according Pauli stack and erroring if the qubit was not initialized.
move_x_to_x
(source, destination)move_x_to_z
(source, destination)move_z_to_x
(source, destination)move_z_to_z
(source, destination)new_qubit
(bit)Create a new qubit in the tracker, returning the old Pauli stack if the qubit was already initialized.
remove_x
(bit)remove_z
(bit)s
(bit)sdg
(bit)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.
sh
(bit)shs
(bit)stacked_transpose
(highest_qubit)Get the frames, but with swapped major and minor axis and sorted bits.
swap
(bit_a, bit_b)sx
(bit)sxdg
(bit)sz
(bit)szdg
(bit)Transform and return the internal Rust data representation into the according Python representation replacing the internal data with its default value.
Transform and return the internal Rust data representation into the according Python representation replacing the internal data with its default value.
take_stacked_transpose
(highest_qubit)Like
stacked_transpose()
, but take out the internal data (replacing it with its default value).track_x
(bit)track_y
(bit)track_z
(bit)x
(bit)y
(bit)z
(bit)zcx
(bit_a, bit_b)zcy
(control, target)zcz
(control, target)- 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(bit)
Get the Pauli stack of a qubit in the tracker, returning None if the qubit was not initialized. Note that this clones the data.
- get_order(map)
This is just get_order as a method.
If you directly want to turn it into a Python type, use
get_py_order()
, because this avoids cloning the graph (which would happen when callinginto_py_graph()
).- Return type:
- get_py_order(map)
Like
get_order()
, but directly returns the graph as a Python type.- Return type:
list[list[tuple[int, list[int]]]]
- into_py_dict()
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.
- Return type:
dict[int, PauliStack]
- into_py_dict_recursive()
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: cf.
PauliStack
dict[int, tuple[list[int], list[int]]]:
- Returns: cf.
- measure(bit)
Remove a qubit in the tracker, returning the according Pauli stack and erroring if the qubit was not initialized.
- new_qubit(bit)
Create a new qubit in the tracker, returning the old Pauli stack if the qubit was already initialized.
- 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.
- stacked_transpose(highest_qubit)
Get the frames, but with swapped major and minor axis and sorted bits.
The frames are now on the major axis and the qubits on the minor axis.
Consider using
take_stacked_transpose()
to avoid cloning.- Parameters:
highest_qubit (int) – The highest qubit index that has been tracked.
- Return type:
- take_into_py_dict()
Transform and return the internal Rust data representation into the according Python representation replacing the internal data with its default value.
- Return type:
dict[int, PauliStack]
- take_into_py_dict_recursive()
Transform and return the internal Rust data representation into the according Python representation replacing the internal data with its default value.
- Returns: cf.
PauliStack
dict[int, tuple[list[int], list[int]]]:
- Returns: cf.
- take_stacked_transpose(highest_qubit)
Like
stacked_transpose()
, but take out the internal data (replacing it with its default value).