From f9be8f7a466abaa75334c3e5a58ef173e889cb7d Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Sun, 14 Sep 2025 11:14:35 +0530 Subject: [PATCH 1/3] Enable MathJax for Sphinx documentation to fix math rendering --- docs/conf.py | 3 +++ tensorflow_quantum/core/ops/math_ops/fidelity_op.py | 8 +++++--- tensorflow_quantum/core/ops/math_ops/inner_product_op.py | 7 +++++-- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 docs/conf.py diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..dafa3502e --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,3 @@ +extensions = [ + 'sphinx.ext.mathjax', +] \ No newline at end of file diff --git a/tensorflow_quantum/core/ops/math_ops/fidelity_op.py b/tensorflow_quantum/core/ops/math_ops/fidelity_op.py index 8f2e87e44..a8c37a4ba 100644 --- a/tensorflow_quantum/core/ops/math_ops/fidelity_op.py +++ b/tensorflow_quantum/core/ops/math_ops/fidelity_op.py @@ -25,9 +25,11 @@ def fidelity(programs, symbol_names, symbol_values, other_programs): Compute (potentially many) fidelities between the given circuits and the symbol free comparison circuits. - Calculates out[i][j] = $ | \langle \psi_{\text{programs[i]}} \\ - (\text{symbol\_values[i]}) | \psi_{\text{other\_programs[j]}} \rangle \\ - |^2 $ + Calculates out[i][j] as: + $$ + |\langle \psi_{\text{programs[i]}}(\text{symbol\_values[i]}) \mid + \psi_{\text{other\_programs[j]}} \rangle|^2 + $$ >>> symbols = sympy.symbols('alpha beta') diff --git a/tensorflow_quantum/core/ops/math_ops/inner_product_op.py b/tensorflow_quantum/core/ops/math_ops/inner_product_op.py index 5d92b7b92..65f2bd08c 100644 --- a/tensorflow_quantum/core/ops/math_ops/inner_product_op.py +++ b/tensorflow_quantum/core/ops/math_ops/inner_product_op.py @@ -75,8 +75,11 @@ def inner_product(programs, symbol_names, symbol_values, other_programs): Compute (potentially many) inner products between the given circuits and the symbol free comparison circuits. - Calculates out[i][j] = $ \langle \psi_{\text{programs[i]}} \\ - (\text{symbol\_values[i]}) | \psi_{\text{other\_programs[j]}} \rangle $ + Calculates out[i][j] as: + $$ + \langle \psi_{\text{programs[i]}}(\text{symbol\_values[i]}) \mid + \psi_{\text{other\_programs[j]}} \rangle + $$ >>> symbols = sympy.symbols('alpha beta') From 0f068a1e83b62bde9dff3be4256be7845c6c5ab7 Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Sat, 27 Sep 2025 09:54:24 +0530 Subject: [PATCH 2/3] Enable MathJax for Sphinx documentation to fix math rendering --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index dafa3502e..4a2daa300 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,3 @@ extensions = [ 'sphinx.ext.mathjax', -] \ No newline at end of file +] From 6cf47f44de890e9e7ba9d1616136be285b24ed79 Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Sat, 27 Sep 2025 10:01:51 +0530 Subject: [PATCH 3/3] Enable MathJax for Sphinx documentation to fix math rendering --- docs/conf.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 4a2daa300..85e11d49a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,8 @@ +"""Sphinx configuration for the TensorFlow Quantum docs. + +Adjust extensions and Sphinx options here. +""" + extensions = [ 'sphinx.ext.mathjax', ]