From 2902e70a3dd61551602426c6d68a4983dc33f4f5 Mon Sep 17 00:00:00 2001 From: Arsalan Motamedi Date: Fri, 18 Oct 2024 11:22:54 -0400 Subject: [PATCH] docstring improvement --- mrmustard/lab_dev/transformations/grn.py | 20 ++++++++++++++++++++ mrmustard/physics/triples.py | 8 +++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/mrmustard/lab_dev/transformations/grn.py b/mrmustard/lab_dev/transformations/grn.py index d13b9f33b..d43be4597 100644 --- a/mrmustard/lab_dev/transformations/grn.py +++ b/mrmustard/lab_dev/transformations/grn.py @@ -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" diff --git a/mrmustard/physics/triples.py b/mrmustard/physics/triples.py index d8ffbcc04..ef6a805eb 100644 --- a/mrmustard/physics/triples.py +++ b/mrmustard/physics/triples.py @@ -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