mm.math.parameter_set.ParameterSet¶
- class mrmustard.math.parameter_set.ParameterSet[source]¶
Bases:
object
A set of parameters.
ParameterSet
can store both constant and variable parameters. It provides fast access to both classes of parameters, as well as to their names.const1 = Constant(1.2345, "const1") const2 = Constant(2.3456, "const2") var1 = Variable(3.4567, "var1") ps = ParameterSet() ps.add_parameter(const1) ps.add_parameter(const2) ps.add_parameter(var1) ps.names # returns `["const1", "const2", "var1"]` ps.constants # returns `{"const1": const1, "const2": const2}` ps.variable # returns `{"var1": var1}`
Attributes
The constant parameters in this parameter set.
The names of all the parameters in this parameter set, in the order in which they were added.
The variable parameters in this parameter set.
- all_parameters¶
- constants¶
The constant parameters in this parameter set.
- names¶
The names of all the parameters in this parameter set, in the order in which they were added.
- variables¶
The variable parameters in this parameter set.
Methods
add_parameter
(parameter)Adds a parameter to this parameter set.
tagged_variables
(tag)Returns a dictionary whose keys are tagged names of the variables in this parameter set, and whose values are the variables in this parameter set.
to_string
(decimals)Returns a string representation of the parameter values, separated by commas and rounded to the specified number of decimals.