Commit ba78fbd1 authored by Theo Steininger's avatar Theo Steininger
Browse files

Added probing.py

parent 6698f9c7
# -*- coding: utf-8 -*-
from nifty import Field, RGSpace, DiagonalProberMixin, TraceProberMixin,\
Prober, DiagonalOperator
class DiagonalProber(DiagonalProberMixin, Prober):
pass
class MultiProber(DiagonalProberMixin, TraceProberMixin, Prober):
pass
x = RGSpace((8, 8))
f = Field.from_random(domain=x, random_type='normal')
diagOp = DiagonalOperator(domain=x, diagonal=f)
diagProber = DiagonalProber(domain=x)
diagProber(diagOp)
print (f - diagProber.diagonal).norm()
multiProber = MultiProber(domain=x)
multiProber(diagOp)
print (f - multiProber.diagonal).norm()
print f.sum() - multiProber.trace
Markdown is supported
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