Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
apchytr committed Oct 7, 2024
1 parent 3080a6c commit 640259b
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions doc/code/physics/utils/bargmann_calculations.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Calculations on Bargmann objects
================================

.. currentmodule:: mrmustard.physics.bargmann
.. currentmodule:: mrmustard.physics.bargmann_utils

.. automodapi:: mrmustard.physics.bargmann
.. automodapi:: mrmustard.physics.bargmann_utils
:no-heading:
:include-all-objects:
4 changes: 2 additions & 2 deletions doc/code/physics/utils/fock_calculations.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Calculations on Fock objects
============================

.. currentmodule:: mrmustard.physics.fock
.. currentmodule:: mrmustard.physics.fock_utils

.. automodapi:: mrmustard.physics.fock
.. automodapi:: mrmustard.physics.fock_utils
:no-heading:
:include-all-objects:
2 changes: 1 addition & 1 deletion mrmustard/math/backend_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def hermite_renormalized_binomial(

def reorder_AB_bargmann(self, A: np.ndarray, B: np.ndarray) -> tuple[np.ndarray, np.ndarray]:
r"""In mrmustard.math.numba.compactFock~ dimensions of the Fock representation are ordered like [mode0,mode0,mode1,mode1,...]
while in mrmustard.physics.bargmann the ordering is [mode0,mode1,...,mode0,mode1,...]. Here we reorder A and B.
while in mrmustard.physics.bargmann_utils the ordering is [mode0,mode1,...,mode0,mode1,...]. Here we reorder A and B.
"""
ordering = np.arange(2 * A.shape[0] // 2).reshape(2, -1).T.flatten()
A = self.gather(A, ordering, axis=1)
Expand Down
2 changes: 1 addition & 1 deletion mrmustard/math/backend_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def grad(dLdGconj):

def reorder_AB_bargmann(self, A: tf.Tensor, B: tf.Tensor) -> tuple[tf.Tensor, tf.Tensor]:
r"""In mrmustard.math.compactFock.compactFock~ dimensions of the Fock representation are ordered like [mode0,mode0,mode1,mode1,...]
while in mrmustard.physics.bargmann the ordering is [mode0,mode1,...,mode0,mode1,...]. Here we reorder A and B.
while in mrmustard.physics.bargmann_utils the ordering is [mode0,mode1,...,mode0,mode1,...]. Here we reorder A and B.
"""
ordering = (
np.arange(2 * A.shape[0] // 2).reshape(2, -1).T.flatten()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def use_offDiag_pivot(
"""
Apply recurrence relation for pivot of type [a+1,a,b,b,c,c,...] / [a,a,b+1,b,c,c,...] / [a,a,b,b,c+1,c,...]
Args:
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of modes
cutoffs (tuple): upper bounds for the number of photons in each mode
params (tuple): (a,b,c,...)
Expand Down Expand Up @@ -88,7 +88,7 @@ def use_diag_pivot(A, B, M, cutoffs, params, arr0, arr1): # pragma: no cover
"""
Apply recurrence relation for pivot of type [a,a,b,b,c,c...]
Args:
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of modes
cutoffs (tuple): upper bounds for the number of photons in each mode
params (tuple): (a,b,c,...)
Expand Down Expand Up @@ -139,7 +139,7 @@ def fock_representation_diagonal_amps_NUMBA(
Returns the PNR probabilities of a mixed state according to algorithm 1 of:
https://doi.org/10.22331/q-2023-08-29-1097
Args:
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of modes
cutoffs (tuple): upper bounds for the number of photons in each mode
arr0 (array): submatrix of the fock representation that contains Fock amplitudes of the type [a,a,b,b,c,c...]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def calc_dA_dB(i, G_in_dA, G_in_dB, G_in, A, B, K_l, K_i, M, pivot_val, pivot_va
Args:
i (int): the element of the multidim index that is increased
G_in, G_in_dA, G_in_dB (array, array, array): all Fock amplitudes from the 'read' group in the recurrence relation and their derivatives w.r.t. A and B
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
K_l, K_i (vector, vector): SQRT[pivot], SQRT[pivot + 1]
M (int): number of modes
pivot_val, pivot_val_dA, pivot_val_dB (array, array, array): Fock amplitude at the position of the pivot and its derivatives w.r.t. A and B
Expand Down Expand Up @@ -63,7 +63,7 @@ def use_offDiag_pivot_grad(
"""
Apply recurrence relation for pivot of type [a+1,a,b,b,c,c,...] / [a,a,b+1,b,c,c,...] / [a,a,b,b,c+1,c,...]
Args:
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of modes
cutoffs (tuple): upper bounds for the number of photons in each mode
params (tuple): (a,b,c,...)
Expand Down Expand Up @@ -201,7 +201,7 @@ def use_diag_pivot_grad(A, B, M, cutoffs, params, arr0, arr1, arr0_dA, arr1_dA,
"""
Apply recurrence relation for pivot of type [a,a,b,b,c,c...]
Args:
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of modes
cutoffs (tuple): upper bounds for the number of photons in each mode
params (tuple): (a,b,c,...)
Expand Down Expand Up @@ -265,7 +265,7 @@ def fock_representation_diagonal_grad_NUMBA(
Returns the gradients of the PNR probabilities of a mixed state according to algorithm 1 of
https://doi.org/10.22331/q-2023-08-29-1097
Args:
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of modes
cutoffs (tuple): upper bounds for the number of photons in each mode
arr0 (array): submatrix of the fock representation that contains Fock amplitudes of the type [a,a,b,b,c,c...]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def use_offDiag_pivot(
"""
Apply recurrence relation for pivot of type [a+1,a,b,b,c,c,...] / [a,a,b+1,b,c,c,...] / [a,a,b,b,c+1,c,...]
Args:
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of detected modes
cutoffs (tuple): upper bounds for the number of photons in each mode
params (tuple): (a,b,c,...)
Expand Down Expand Up @@ -202,7 +202,7 @@ def use_diag_pivot(A, B, M, cutoff_leftoverMode, cutoffs_tail, params, arr0, arr
"""
Apply recurrence relation for pivot of type [a,a,b,b,c,c...]
Args:
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of detected modes
cutoffs (tuple): upper bounds for the number of photons in each mode
params (tuple): (a,b,c,...)
Expand Down Expand Up @@ -281,7 +281,7 @@ def fock_representation_1leftoverMode_amps_NUMBA(
Returns the density matrices in the upper, undetected mode of a circuit when all other modes are PNR detected
according to algorithm 2 of https://doi.org/10.22331/q-2023-08-29-1097
Args:
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of modes
cutoffs (tuple): upper bounds for the number of photons in each mode
arr0 (array): submatrix of the fock representation that contains Fock amplitudes of the type [a,a,b,b,c,c...]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def use_offDiag_pivot_grad(
"""
Apply recurrence relation for pivot of type [a+1,a,b,b,c,c,...] / [a,a,b+1,b,c,c,...] / [a,a,b,b,c+1,c,...]
Args:
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of detected modes
cutoffs (tuple): upper bounds for the number of photons in each mode
params (tuple): (a,b,c,...)
Expand Down Expand Up @@ -499,7 +499,7 @@ def use_diag_pivot_grad(
"""
Apply recurrence relation for pivot of type [a,a,b,b,c,c...]
Args:
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of detected modes
cutoffs (tuple): upper bounds for the number of photons in each mode
params (tuple): (a,b,c,...)
Expand Down Expand Up @@ -594,7 +594,7 @@ def fock_representation_1leftoverMode_grad_NUMBA(
Returns the gradients of the density matrices in the upper, undetected mode of a circuit when all other modes
are PNR detected (according to algorithm 2 of https://doi.org/10.22331/q-2023-08-29-1097)
Args:
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, Vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
M (int): number of modes
cutoffs (tuple): upper bounds for the number of photons in each mode
arr0 (array): submatrix of the fock representation that contains Fock amplitudes of the type [a,a,b,b,c,c...]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function calc_dA_dB(i, G_in_dA, G_in_dB, G_in, A, B, K_l, K_i, M, pivot_val, piv
Args:
i (int): the element of the multidim index that is increased
G_in, G_in_dA, G_in_dB (array, array, array): all Fock amplitudes from the 'read' group in the recurrence relation and their derivatives w.r.t. A and B
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock.ABC)
A, B (array, vector): required input for recurrence relation (given by mrmustard.physics.fock_utils.ABC)
K_l, K_i (vector, vector): SQRT[pivot], SQRT[pivot + 1]
M (int): number of modes
pivot_val, pivot_val_dA, pivot_val_dB (array, array, array): Fock amplitude at the position of the pivot and its derivatives w.r.t. A and B
Expand Down

0 comments on commit 640259b

Please sign in to comment.