qiskit_qec.utils.pauli_repΒΆ

N-qubit Pauli Representation Encodings and Conversion Module

Functions

boolean_to_indices(booleans)

Converts a array of boolean values into a index numpy array of non-zero-elements

change_pauli_encoding(phase_exp[, y_count, ...])

Converts the input phase exponent of a Pauli operator encoded in the input_pauli_encoding into the phase exponent of the same Pauli operator encoded in the output_pauli_encoding.

cpx2cpxstr(cpx[, same_type, ones])

Converts the complex number(s) to strings

cpx2exp(cpx, output_encoding[, same_type, ...])

Converts complex phases to encoded exponents for Pauli group phases

cpx2expstr(cpx, encoding[, same_type])

Converts complex Pauli group phases into strings representing phase exponents

cpxstr2cpx(cpx_str[, same_type])

Converts the complex number defined by the input string(s) to a complex number

cpxstr2exp(cpx_str, encoding[, same_type])

Converts strings representing a complex pauli grioup phase to an encoded phase.

cpxstr2expstr(cpx_str, encoding[, same_type])

Converts a complex string represnetation into a exponent string representation.

encode_of_phase_str(phase_str[, same_type])

Returns how a string(s) representing a phase(s) are encoded

encode_of_tensor_str(tensor_str[, encoded, ...])

Returns how a string representing a Pauli tensor without a phase component is encoded.

exp2cpx(phase_exp, input_encoding[, same_type])

Converts a encoded phase(s) to a complex number(s)

exp2cpxstr(phase_exp, encoding[, same_type, ...])

Converts encoded Pauli groups phases into strings that represent the associated complex numbers

exp2exp(phase_exp[, input_encoding, ...])

Convert between the different phase exponents of encoded phase

exp2expstr(phase_exp, input_encoding[, ...])

Converts encoded phases (exponents) to their string representations

expstr2cpx(phase_str, encoding[, same_type])

Converts strings representing phase exponents to complex numbers

expstr2cpxstr(exp_str, encoding[, ...])

Converts a string(s) representing a phase exponent into a string representing the equivalent complex number.

expstr2exp(exp_str[, same_type])

Converts string representations of phase encoded phases to encoded phases

from_array(matrix[, phase_exp, ...])

Convert array and phase_exp to the matrix and phase_exp in BasePauli's internal Pauli encoding (pauli_rep.INTERNAL_PAULI_ENCODING) :type matrix: Union[List, Tuple, ndarray] :param matrix: _description_ :type matrix: _type_ :type phase_exp: Union[int, List, Tuple, ndarray, None] :param phase_exp: _description_ :type phase_exp: _type_ :type input_pauli_encoding: Optional[str] :param input_pauli_encoding: input Pauli encoding

from_split_array(x, z, phase_exp[, ...])

Convert split array (separate X and Z arrays) and phase_exp to the matrix and phase_exp in BasePauli's internal Pauli encoding (pauli_rep.INTERNAL_PAULI_ENCODING)

gate2symplectic(gate[, encoding])

Converts a Pauli gate to a symplectic matrix with phase

get_pauli_encodings()

Returns the available Pauli encodings

get_phase_enc(encoding)

Returns the phase encodeing part of the Pauli encoding string

get_phase_encodings()

Returns the availble phase encodings

get_tensor_enc(encoding)

Returns the tensor encodeing part of the Pauli encoding string

get_tensor_encodings()

Returns the available tensor encodings

indices_to_boolean(indices, dim)

Converts an array/list of indices to a numpy boolean vector

is_exp_type(phase_exp, input_phase_encoding)

Determines if a given input is an encoded phase exponent of a Pauli operator

is_scalar(obj[, scalar_pair])

Deteremines if an obj is a scalar or not (i.e. not an array of some sort).

scalar_op2symplectic(op[, output_encoding])

Convert a ScalarOp to symplectic representation with phase.

split_pauli(pauli_str[, same_type])

Splits up a string reprenting a Pauli operator into the phase part and the Pauli part.

split_pauli_enc(encoding)

Splits the Pauli encoding into the phase and tensor encodings

squeeze(array_[, scalar])

Squeeze an numpy array with the option to convert a resulting 0d array to a scalar (scalar=True)

stand_phase_str(phase_str[, same_type, ...])

Standardize the phase string

str2exp(phase_str, encoding[, same_type])

Converts string representations of a Pauli group phases to and encoded phase exponents

str2str(pauli_str, syntax_output[, ...])

Converts between different string representations of Pauli operators

str2symplectic(pauli_str[, qubit_order, ...])

Converts strings of Pauli group elements into phase exponents and their symplectic matrix representation.

symplectic2str(matrix[, phase_exp, ...])

Converts a symplectic matrix and phase to string representations

to_cpx_matrix(matrix, phase_exp[, ...])

Return the complex matrix representation from its symplectic representation with phase.