Utilities¶
A utility function to turn the input parameters of states and gates into 1-dimensional tensors of length |
|
Check that the given Gaussian representation is consistent with the given modes. |
reshape_params¶
- mrmustard.lab.utils.reshape_params(n_modes, **kwargs)[source]¶
A utility function to turn the input parameters of states and gates into 1-dimensional tensors of length
n_modes.- Parameters:
n_modes (int) – The number of modes.
**kwargs – The parameters to reshape.
- Raises:
ValueError – If a parameter has a length which is neither equal to
1nor n_modes. –
- Return type:
Generator
shape_check¶
- mrmustard.lab.utils.shape_check(mat, vec, dim, name)[source]¶
Check that the given Gaussian representation is consistent with the given modes.
- Parameters:
mat – matrix (e.g. A or cov, etc.)
vec – vector (e.g. b or means, etc.)
dim (int) – The required dimension of the representation
name (str) – The name of the representation for error messages