The settings module¶
A class containing various settings that are used by Mr Mustard throughout a session.
>>> from mrmustard import settings
>>> assert settings.HBAR == 1.0 # check the default values
>>> settings.HBAR=2.0 # update globally to new values
>>> assert settings.HBAR == 2.0
>>> with settings(HBAR=3.0): # update with context manager
>>> assert settings.HBAR == 3.0
>>> assert settings.HBAR == 2.0 # previous value remains
- Settings.AUTOSHAPE_PROBABILITY float = 0.99999¶
The minimum l2_norm to reach before automatically stopping the Bargmann-to-Fock conversion.
- Settings.AUTOSHAPE_MAX int = 50¶
The max shape for the autoshape.
- Settings.AUTOSHAPE_MIN int = 1¶
The min shape for the autoshape.
- Settings.ATOL float = 1e-8¶
The absolute tolerance when comparing two values or arrays.
- Settings.CACHE_DIR Path¶
The directory in which serialized MrMustard objects are saved.
- Settings.DEFAULT_FOCK_SIZE int = 50¶
The default size for the Fock representation.
- Settings.DEFAULT_REPRESENTATION Literal["Bargmann", "Fock", None] = "Fock"¶
The representation to use when contracting two circuit components in different representations. Can be
Fock,BargmannorNone. IfNone, aTypeErroris raised instead.
- Settings.DRAW_CIRCUIT_PARAMS bool = True¶
Whether or not to draw the parameters of a circuit.
- Settings.EINSUM_OPTIMIZE bool | Literal["greedy", "optimal", "auto"] = "greedy"¶
Whether to optimize the contraction order when using the Einstein summation convention. Allowed values are True, False, “greedy”, “optimal” or “auto”.
- Settings.HBAR float = 1.0¶
The value of the Planck constant.
- Settings.PROGRESSBAR bool = True¶
Whether or not to display the progress bar when performing training.
- Settings.SEED int¶
Returns the seed value if set, otherwise returns a random seed.
- Settings.STABLE_FOCK_CONVERSION bool = True¶
Whether to use the
stablefunction when computing Fock amplitudes (more stable, but slower).