mm.math.parameters.Variable¶
- class mrmustard.math.parameters.Variable(value, name, bounds=(None, None), update_fn=<function update_euclidean>)[source]¶
Bases:
object
A parameter whose value can change.
my_var = Variable(1, "my_var")
- Parameters:
value (
any
) – The value of this variable.name (
str
) – The name of this variable.bounds (
Tuple
[Optional
[float
],Optional
[float
]]) – The numerical bounds of this variable.update_fn (
Callable
) – The function used to update this variable during training.
Attributes
The numerical bounds of this variable.
The name of this constant.
The function used to update this variable during training.
The value of this variable.
- bounds¶
The numerical bounds of this variable.
- name¶
The name of this constant.
- update_fn¶
The function used to update this variable during training.
- value¶
The value of this variable.
Methods
orthogonal
(value, name[, bounds, N])Initializes a variable with
update_fn
for orthogonal optimization.symplectic
(value, name[, bounds, N])Initializes a variable with
update_fn
for simplectic optimization.unitary
(value, name[, bounds, N])Initializes a variable with
update_fn
for unitary optimization.- static orthogonal(value, name, bounds=(None, None), N=1)[source]¶
Initializes a variable with
update_fn
for orthogonal optimization.- Parameters:
value (
Optional
[any
]) – The value of the returned variable. IfNone
, a random orthogonal matrix of dimensionN
is initialized.name (
str
) – The name of the returned variable.bounds (
Tuple
[Optional
[float
],Optional
[float
]]) – The numerical bounds of the returned variable.N (
int
) – The dimension of the random orthogonal matrix. This value is ignored ifvalue
is notNone
.
- Returns:
A variable with
update_fn
for orthogonal optimization.
- static symplectic(value, name, bounds=(None, None), N=1)[source]¶
Initializes a variable with
update_fn
for simplectic optimization.- Parameters:
value (
any
) – The value of the returned variable. IfNone
, a random symplectic matrix of dimensionN
is initialized.name (
str
) – The name of the returned variable.bounds (
Tuple
[Optional
[float
],Optional
[float
]]) – The numerical bounds of the returned variable.N (
int
) – The dimension of the random symplectic matrix. This value is ignored ifvalue
is notNone
.
- Returns:
A variable with
update_fn
for simplectic optimization.
- static unitary(value, name, bounds=(None, None), N=1)[source]¶
Initializes a variable with
update_fn
for unitary optimization.- Parameters:
value (
any
) – The value of the returned variable. IfNone
, a random unitary matrix of dimensionN
is initialized.name (
str
) – The name of the returned variable.bounds (
Tuple
[Optional
[float
],Optional
[float
]]) – The numerical bounds of the returned variable.N (
int
) – The dimension of the random unitary matrix. This value is ignored ifvalue
is notNone
.
- Returns:
A variable with
update_fn
for unitary optimization.