PauliMatrices.from_string

static PauliMatrices.from_string(pauli_string)[source]

Construct pauli matrices from a string description.

Parameters:

pauli_string (str) – A string that describes the desired matrices. This is a comma-seperated list of pauli strings. A pauli string has the following regex pattern: [IXYZ]+

Returns:

Either the single pauli matrix if only one is constructed, or the list of the constructed pauli matrices.

Return type:

np.ndarray | list[np.ndarray]

Raises:

ValueError – if pauli_string is invalid.