Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect TeX #11599

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions qiskit/circuit/library/standard_gates/u3.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class CU3Gate(ControlledGate):

.. math::

\newcommand{\rotationangle}{\frac{\theta}{2}}

CU3(\theta, \phi, \lambda)\ q_1, q_0 =
|0\rangle\langle 0| \otimes I +
|1\rangle\langle 1| \otimes U3(\theta,\phi,\lambda) =
Expand Down
25 changes: 21 additions & 4 deletions qiskit/pulse/library/symbolic_pulses.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ def parameters(self) -> dict[str, Any]:
return params

def __eq__(self, other: object) -> bool:

if not isinstance(other, SymbolicPulse):
return NotImplemented

Expand Down Expand Up @@ -723,8 +722,10 @@ class Gaussian(metaclass=_PulseType):

.. math::

\begin{aligned}
f'(x) &= \exp\Bigl( -\frac12 \frac{{(x - \text{duration}/2)}^2}{\text{sigma}^2} \Bigr)\\
f(x) &= \text{A} \times \frac{f'(x) - f'(-1)}{1-f'(-1)}, \quad 0 \le x < \text{duration}
\end{aligned}

where :math:`f'(x)` is the gaussian waveform without lifting or amplitude scaling, and
:math:`\text{A} = \text{amp} \times \exp\left(i\times\text{angle}\right)`.
Expand Down Expand Up @@ -793,8 +794,10 @@ class GaussianSquare(metaclass=_PulseType):

.. math::

\\text{risefall} &= \\text{risefall_sigma_ratio} \\times \\text{sigma}\\\\
\\begin{aligned}
\\text{risefall} &= \\text{risefall\\_sigma\\_ratio} \\times \\text{sigma}\\\\
\\text{width} &= \\text{duration} - 2 \\times \\text{risefall}
\\end{aligned}

If ``width`` is not None and ``risefall_sigma_ratio`` is None:

Expand All @@ -804,6 +807,7 @@ class GaussianSquare(metaclass=_PulseType):

.. math::

\\begin{aligned}
f'(x) &= \\begin{cases}\
\\exp\\biggl(-\\frac12 \\frac{(x - \\text{risefall})^2}{\\text{sigma}^2}\\biggr)\
& x < \\text{risefall}\\\\
Expand All @@ -817,6 +821,7 @@ class GaussianSquare(metaclass=_PulseType):
\\end{cases}\\\\
f(x) &= \\text{A} \\times \\frac{f'(x) - f'(-1)}{1-f'(-1)},\
\\quad 0 \\le x < \\text{duration}
\\end{aligned}

where :math:`f'(x)` is the gaussian square waveform without lifting or amplitude scaling, and
:math:`\\text{A} = \\text{amp} \\times \\exp\\left(i\\times\\text{angle}\\right)`.
Expand Down Expand Up @@ -935,8 +940,10 @@ def GaussianSquareDrag(

.. math::

\\text{risefall} &= \\text{risefall_sigma_ratio} \\times \\text{sigma}\\\\
\\begin{aligned}
\\text{risefall} &= \\text{risefall\\_sigma\\_ratio} \\times \\text{sigma}\\\\
\\text{width} &= \\text{duration} - 2 \\times \\text{risefall}
\\end{aligned}

If ``width`` is not None and ``risefall_sigma_ratio`` is None:

Expand All @@ -947,8 +954,10 @@ def GaussianSquareDrag(

.. math::

\\begin{aligned}
g(x, c, σ) &= \\exp\\Bigl(-\\frac12 \\frac{(x - c)^2}{σ^2}\\Bigr)\\\\
g'(x, c, σ) &= \\frac{g(x, c, σ)-g(-1, c, σ)}{1-g(-1, c, σ)}
\\end{aligned}

From these, the lifted DRAG curve :math:`d'(x, c, σ, β)` can be written as

Expand All @@ -961,6 +970,7 @@ def GaussianSquareDrag(

.. math::

\\begin{aligned}
f'(x) &= \\begin{cases}\
\\text{A} \\times d'(x, \\text{risefall}, \\text{sigma}, \\text{beta})\
& x < \\text{risefall}\\\\
Expand All @@ -974,6 +984,7 @@ def GaussianSquareDrag(
)\
& \\text{risefall} + \\text{width} \\le x\
\\end{cases}\\\\
\\end{aligned}

where :math:`\\text{A} = \\text{amp} \\times
\\exp\\left(i\\times\\text{angle}\\right)`.
Expand Down Expand Up @@ -1077,12 +1088,14 @@ def gaussian_square_echo(

.. math::

\\begin{aligned}
g_e(x) &= \\begin{cases}\
f_{\\text{active}} + f_{\\text{echo}}(x)\
& x < \\frac{\\text{duration}}{2}\\\\
f_{\\text{active}} - f_{\\text{echo}}(x)\
& \\frac{\\text{duration}}{2} < x\
\\end{cases}\\\\
\\end{aligned}

One case where this pulse can be used is when implementing a direct CNOT gate with
a cross-resonance superconducting qubit architecture. When applying this pulse to
Expand All @@ -1095,8 +1108,10 @@ def gaussian_square_echo(

.. math::

\\text{risefall} &= \\text{risefall_sigma_ratio} \\times \\text{sigma}\\\\
\\begin{aligned}
\\text{risefall} &= \\text{risefall\\_sigma\\_ratio} \\times \\text{sigma}\\\\
\\text{width} &= \\text{duration} - 2 \\times \\text{risefall}
\\end{aligned}

If ``width`` is not None and ``risefall_sigma_ratio`` is None:

Expand Down Expand Up @@ -1326,11 +1341,13 @@ class Drag(metaclass=_PulseType):

.. math::

\\begin{aligned}
g(x) &= \\exp\\Bigl(-\\frac12 \\frac{(x - \\text{duration}/2)^2}{\\text{sigma}^2}\\Bigr)\\\\
g'(x) &= \\text{A}\\times\\frac{g(x)-g(-1)}{1-g(-1)}\\\\
f(x) &= g'(x) \\times \\Bigl(1 + 1j \\times \\text{beta} \\times\
\\Bigl(-\\frac{x - \\text{duration}/2}{\\text{sigma}^2}\\Bigr) \\Bigr),
\\quad 0 \\le x < \\text{duration}
\\end{aligned}

where :math:`g(x)` is a standard unlifted Gaussian waveform, :math:`g'(x)` is the lifted
:class:`~qiskit.pulse.library.Gaussian` waveform, and
Expand Down
8 changes: 5 additions & 3 deletions qiskit/quantum_info/operators/measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def process_fidelity(
require_tp (bool): check if input and target channels are
trace-preserving and if non-TP log warning
containing negative eigenvalues of partial
Choi-matrix :math:`Tr_{\mbox{out}}[\mathcal{E}] - I`
Choi-matrix :math:`Tr_{\text{out}}[\mathcal{E}] - I`
[Default: True].

Returns:
Expand Down Expand Up @@ -154,10 +154,12 @@ def average_gate_fidelity(
The average gate fidelity :math:`F_{\text{ave}}` is given by

.. math::
\begin{aligned}
F_{\text{ave}}(\mathcal{E}, U)
&= \int d\psi \langle\psi|U^\dagger
\mathcal{E}(|\psi\rangle\!\langle\psi|)U|\psi\rangle \\
&= \frac{d F_{\text{pro}}(\mathcal{E}, U) + 1}{d + 1}
\end{aligned}

where :math:`F_{\text{pro}}(\mathcal{E}, U)` is the
:meth:`~qiskit.quantum_info.process_fidelity` of the input quantum
Expand All @@ -175,7 +177,7 @@ def average_gate_fidelity(
require_tp (bool): check if input and target channels are
trace-preserving and if non-TP log warning
containing negative eigenvalues of partial
Choi-matrix :math:`Tr_{\mbox{out}}[\mathcal{E}] - I`
Choi-matrix :math:`Tr_{\text{out}}[\mathcal{E}] - I`
[Default: True].

Returns:
Expand Down Expand Up @@ -232,7 +234,7 @@ def gate_error(
require_tp (bool): check if input and target channels are
trace-preserving and if non-TP log warning
containing negative eigenvalues of partial
Choi-matrix :math:`Tr_{\mbox{out}}[\mathcal{E}] - I`
Choi-matrix :math:`Tr_{\text{out}}[\mathcal{E}] - I`
[Default: True].

Returns:
Expand Down
2 changes: 2 additions & 0 deletions qiskit/quantum_info/operators/symplectic/pauli.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ class initialization (``Pauli('-iXYZ')``). A ``Pauli`` object can be

.. math::

\begin{aligned}
P &= P_{n-1} \otimes ... \otimes P_{0} \\
P_k &= (-i)^{z[k] * x[k]} Z^{z[k]}\cdot X^{x[k]}
\end{aligned}

where ``z[k] = P.z[k]``, ``x[k] = P.x[k]`` respectively.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(
kak_basis_gate (Gate): Basis gate for KAK decomposition.
force_consolidate (bool): Force block consolidation.
basis_gates (List(str)): Basis gates from which to choose a KAK gate.
approximation_degree (float): a float between $[0.0, 1.0]$. Lower approximates more.
approximation_degree (float): a float between :math:`[0.0, 1.0]`. Lower approximates more.
target (Target): The target object for the compilation target backend.
"""
super().__init__()
Expand Down