Skip to content

Commit

Permalink
docstring improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
arsalan-motamedi committed Oct 18, 2024
1 parent 6e33985 commit 2902e70
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
20 changes: 20 additions & 0 deletions mrmustard/lab_dev/transformations/grn.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@
class GRN(Channel):
r"""
The Gaussian random noise channel.
Y_train determines whether or not the Y matrix is trainable.
The number of modes must match half of the size of the Y matrix.
.. code-block ::
>>> import numpy as np
>>> from mrmustard.lab_dev import GRN
>>> channel = GRN(modes=[1, 2], Y = .2 * np.eye(4))
>>> assert channel.modes == [1, 2]
>>> assert np.allclose(channel.Y.value, .2 * np.eye(4))
Args:
modes: The modes the channel is applied to
Y: The Y matrix of the Gaussian random noise
Y_train: whether the Y matrix is a trainable variable
..details::
The Bargmann representation of the channel is computed via the formulas provided in the paper:
https://arxiv.org/pdf/2209.06069
"""

short_name = "GRN"
Expand Down
8 changes: 7 additions & 1 deletion mrmustard/physics/triples.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,13 @@ def fock_damping_Abc(

def gaussian_random_noise_Abc(Y: RealMatrix) -> Union[Matrix, Vector, Scalar]:
r"""
The (A, b, c) for the gaussian random noise channel.
The triple (A, b, c) for the gaussian random noise channel.
Args:
Y: the Y matrix of the Gaussian random noise channel.
Returns:
The ``(A, b, c)`` triple of the Gaussian random noise channel.
"""
m = Y.shape[-1] // 2
xi = math.eye(2 * m) + Y / settings.HBAR
Expand Down

0 comments on commit 2902e70

Please sign in to comment.