Skip to content

Commit a78b423

Browse files
Merge branch 'dev' of https://github.com/ColibrITD-SAS/mpqp into dev
2 parents 8c7470b + f4e066f commit a78b423

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

docs/measures.rst

+4
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ Measuring using an observable
4343

4444
.. automodule:: mpqp.core.instruction.measurement.expectation_value
4545

46+
Pauli String
47+
^^^^^^^^^^^^
48+
49+
.. automodule:: mpqp.core.instruction.measurement.pauli_string

mpqp/core/instruction/measurement/pauli_string.py

+11-14
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class PauliString:
2727
monomials : List of Pauli monomials.
2828
2929
Example:
30-
>>> I@Z + 2*Y@I + X@Z
30+
>>> I @ Z + 2 * Y @ I + X @ Z
3131
1*I@Z + 2*Y@I + 1*X@Z
3232
"""
3333

@@ -142,7 +142,7 @@ def simplify(self) -> PauliString:
142142
"""Simplify the PauliString by combining like terms and removing terms with zero coefficients.
143143
144144
Example:
145-
>>> ps = I@I - 2* I@I + Z@I - Z@I
145+
>>> ps = I @ I - 2 * I @ I + Z @ I - Z @ I
146146
>>> simplified_ps = ps.simplify()
147147
>>> print(simplified_ps)
148148
-1*I@I
@@ -471,27 +471,24 @@ def __hash__(self):
471471
_allow_atom_creation = True
472472

473473
I = PauliStringAtom("I", np.eye(2, dtype=np.complex64))
474-
"""Pauli-I atom representing the identity operator in a Pauli monomial or string.
474+
r"""Pauli-I atom representing the identity operator in a Pauli monomial or string.
475475
Matrix representation:
476-
[1 0]
477-
[0 1]
476+
`\begin{pmatrix}1&0\\0&1\end{pmatrix}`
478477
"""
479478
X = PauliStringAtom("X", 1 - np.eye(2, dtype=np.complex64))
480-
"""Pauli-X atom representing the X operator in a Pauli monomial or string.
479+
r"""Pauli-X atom representing the X operator in a Pauli monomial or string.
481480
Matrix representation:
482-
[0 1]
483-
[1 0]
481+
`\begin{pmatrix}0&1\\1&0\end{pmatrix}`
482+
484483
"""
485484
Y = PauliStringAtom("Y", np.fliplr(np.diag([1j, -1j])))
486-
"""Pauli-Y atom representing the Y operator in a Pauli monomial or string.
485+
r"""Pauli-Y atom representing the Y operator in a Pauli monomial or string.
487486
Matrix representation:
488-
[0 -i]
489-
[i 0]
487+
`\begin{pmatrix}0&-i\\i&0\end{pmatrix}`
490488
"""
491489
Z = PauliStringAtom("Z", np.diag([1, -1]))
492-
"""Pauli-Z atom representing the Z operator in a Pauli monomial or string.
490+
r"""Pauli-Z atom representing the Z operator in a Pauli monomial or string.
493491
Matrix representation:
494-
[1 0]
495-
[0 -1]
492+
`\begin{pmatrix}1&0\\0&-1\end{pmatrix}`
496493
"""
497494
_allow_atom_creation = False

0 commit comments

Comments
 (0)