Skip to content

Commit 9a4151b

Browse files
authored
Fix Math Rendering in Fidelity Docstring and Enable MathJax for Sphinx Docs (#903)
Fixes #594. This PR updates the docstring for the fidelity operation to use proper LaTeX block math formatting, ensuring that the fidelity formula renders correctly in the generated documentation.
1 parent f94d2b6 commit 9a4151b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

tensorflow_quantum/core/ops/math_ops/fidelity_op.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ def fidelity(programs, symbol_names, symbol_values, other_programs):
2525
Compute (potentially many) fidelities between the given circuits and
2626
the symbol free comparison circuits.
2727
28-
Calculates out[i][j] = $ | \langle \psi_{\text{programs[i]}} \\
29-
(\text{symbol\_values[i]}) | \psi_{\text{other\_programs[j]}} \rangle \\
30-
|^2 $
28+
Calculates out[i][j] as:
29+
$$
30+
|\langle \psi_{\text{programs[i]}}(\text{symbol_values[i]}) \mid
31+
\psi_{\text{other_programs[j]}} \rangle|^2
32+
$$
3133
3234
3335
>>> symbols = sympy.symbols('alpha beta')

tensorflow_quantum/core/ops/math_ops/inner_product_op.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ def inner_product(programs, symbol_names, symbol_values, other_programs):
7575
Compute (potentially many) inner products between the given circuits and
7676
the symbol free comparison circuits.
7777
78-
Calculates out[i][j] = $ \langle \psi_{\text{programs[i]}} \\
79-
(\text{symbol\_values[i]}) | \psi_{\text{other\_programs[j]}} \rangle $
78+
Calculates out[i][j] as:
79+
$$
80+
\langle \psi_{\text{programs[i]}}(\text{symbol_values[i]}) \mid
81+
\psi_{\text{other_programs[j]}} \rangle
82+
$$
8083
8184
8285
>>> symbols = sympy.symbols('alpha beta')

0 commit comments

Comments
 (0)