probing.py 253 Bytes
Newer Older
Martin Reinecke's avatar
Martin Reinecke committed
1
import nifty4 as ift
Martin Reinecke's avatar
Martin Reinecke committed
2
import numpy as np
Theo Steininger's avatar
Theo Steininger committed
3
4


Martin Reinecke's avatar
Martin Reinecke committed
5
np.random.seed(42)
Martin Reinecke's avatar
Martin Reinecke committed
6
x = ift.RGSpace((8, 8))
Theo Steininger's avatar
Theo Steininger committed
7

Martin Reinecke's avatar
Martin Reinecke committed
8
f = ift.Field.from_random(domain=x, random_type='normal')
Martin Reinecke's avatar
Martin Reinecke committed
9
diagOp = ift.DiagonalOperator(f)
Theo Steininger's avatar
Theo Steininger committed
10

Martin Reinecke's avatar
Martin Reinecke committed
11
12
diag = ift.probe_diagonal(diagOp, 1000)
ift.dobj.mprint((f - diag).norm())