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/6] 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/6] 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/6] 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', ] From da15406a46ceadee4edf4033f49f9f33d58b5c58 Mon Sep 17 00:00:00 2001 From: Aniket Singh Yadav Date: Fri, 12 Dec 2025 19:22:38 +0530 Subject: [PATCH 4/6] Remove docs/conf.py --- docs/conf.py | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 docs/conf.py diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index 85e11d49a..000000000 --- a/docs/conf.py +++ /dev/null @@ -1,8 +0,0 @@ -"""Sphinx configuration for the TensorFlow Quantum docs. - -Adjust extensions and Sphinx options here. -""" - -extensions = [ - 'sphinx.ext.mathjax', -] From 2bfe4c888f0d9c67c8dd69b336678485e3cdf8dd Mon Sep 17 00:00:00 2001 From: Aniket <148300120+Aniketsy@users.noreply.github.com> Date: Sat, 13 Dec 2025 23:43:13 +0530 Subject: [PATCH 5/6] Update tensorflow_quantum/core/ops/math_ops/fidelity_op.py Co-authored-by: Michael Hucka --- tensorflow_quantum/core/ops/math_ops/fidelity_op.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow_quantum/core/ops/math_ops/fidelity_op.py b/tensorflow_quantum/core/ops/math_ops/fidelity_op.py index a8c37a4ba..9e704794d 100644 --- a/tensorflow_quantum/core/ops/math_ops/fidelity_op.py +++ b/tensorflow_quantum/core/ops/math_ops/fidelity_op.py @@ -27,8 +27,8 @@ def fidelity(programs, symbol_names, symbol_values, other_programs): Calculates out[i][j] as: $$ - |\langle \psi_{\text{programs[i]}}(\text{symbol\_values[i]}) \mid - \psi_{\text{other\_programs[j]}} \rangle|^2 + |\langle \psi_{\text{programs[i]}}(\text{symbol_values[i]}) \mid + \psi_{\text{other_programs[j]}} \rangle|^2 $$ From e348fc9d0f29fdb19915dc1566b786123c3cce75 Mon Sep 17 00:00:00 2001 From: Aniket <148300120+Aniketsy@users.noreply.github.com> Date: Sat, 13 Dec 2025 23:43:24 +0530 Subject: [PATCH 6/6] Update tensorflow_quantum/core/ops/math_ops/inner_product_op.py Co-authored-by: Michael Hucka --- tensorflow_quantum/core/ops/math_ops/inner_product_op.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 65f2bd08c..18529ba18 100644 --- a/tensorflow_quantum/core/ops/math_ops/inner_product_op.py +++ b/tensorflow_quantum/core/ops/math_ops/inner_product_op.py @@ -77,8 +77,8 @@ def inner_product(programs, symbol_names, symbol_values, other_programs): Calculates out[i][j] as: $$ - \langle \psi_{\text{programs[i]}}(\text{symbol\_values[i]}) \mid - \psi_{\text{other\_programs[j]}} \rangle + \langle \psi_{\text{programs[i]}}(\text{symbol_values[i]}) \mid + \psi_{\text{other_programs[j]}} \rangle $$