Commit f4501a5e authored by Reimar Leike's avatar Reimar Leike
Browse files

Updated docstrings and changelog to reflect new behaviour

parent b99e06c0
...@@ -58,6 +58,19 @@ print(met) ...@@ -58,6 +58,19 @@ print(met)
print(met.draw_sample()) print(met.draw_sample())
``` ```
New approach for sampling complex numbers
=========================================
When calling draw_sample_with_dtype with a complex dtype,
the variance is now used for the imaginary part and real part separately.
This is done in order to be consistent with the Hamiltonian.
Note that by this,
```
np.std(ift.from_random(domain, 'normal', dtype=np.complex128).val)
````
does not give 1, but sqrt(2) as a result.
MPI parallelisation over samples in MetricGaussianKL MPI parallelisation over samples in MetricGaussianKL
==================================================== ====================================================
...@@ -73,6 +86,7 @@ the generation of reproducible random numbers in the presence of MPI parallelism ...@@ -73,6 +86,7 @@ the generation of reproducible random numbers in the presence of MPI parallelism
and leads to cleaner code overall. Please see the documentation of and leads to cleaner code overall. Please see the documentation of
`nifty6.random` for details. `nifty6.random` for details.
Interface Change for from_random and OuterProduct Interface Change for from_random and OuterProduct
================================================= =================================================
......
...@@ -135,6 +135,8 @@ class Field(Operator): ...@@ -135,6 +135,8 @@ class Field(Operator):
The domain of the output random Field. The domain of the output random Field.
dtype : type dtype : type
The datatype of the output random Field. The datatype of the output random Field.
If the datatype is complex, each real and imaginary part
have variance 1
Returns Returns
------- -------
......
...@@ -112,6 +112,8 @@ class MultiField(Operator): ...@@ -112,6 +112,8 @@ class MultiField(Operator):
The domain of the output random Field. The domain of the output random Field.
dtype : type dtype : type
The datatype of the output random Field. The datatype of the output random Field.
If the datatype is complex, each real an imaginary part have
variance 1.
Returns Returns
------- -------
......
...@@ -266,6 +266,8 @@ def from_random(domain, random_type='normal', dtype=np.float64, **kwargs): ...@@ -266,6 +266,8 @@ def from_random(domain, random_type='normal', dtype=np.float64, **kwargs):
The random distribution to use. The random distribution to use.
dtype : type dtype : type
data type of the output field (e.g. numpy.float64) data type of the output field (e.g. numpy.float64)
If the datatype is complex, each real an imaginary part have
variance 1.
**kwargs : additional parameters for the random distribution **kwargs : additional parameters for the random distribution
('mean' and 'std' for 'normal', 'low' and 'high' for 'uniform') ('mean' and 'std' for 'normal', 'low' and 'high' for 'uniform')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment