Commit 2149722e authored by Vincent Eberle's avatar Vincent Eberle
Browse files

Testing Vdot, conjugation,integration and contraction

parent 66d58966
Pipeline #75252 passed with stages
in 8 minutes and 27 seconds
......@@ -9,10 +9,12 @@ from ..common import setup_function, teardown_function
def test_conjugation_operator():
sp = ift.RGSpace(8)
dom = ift.makeDomain(sp)
f_real = ift.from_random(dom)
f_imag = ift.from_random(dom)
f_complex = f_real + 1.j*f_imag
f = ift.from_random(dom, dtype= np.complex128)
op = ift.ScalingOperator(sp,1).conjugate()
res1 = f_complex.conjugate()
res2 = op(f_complex)
res1 = f.conjugate()
res2 = op(f)
assert_allclose(res1.val, res2.val)
ift.extra.consistency_check(op, domain_dtype=np.float64,
target_dtype=np.float64)
ift.extra.consistency_check(op, domain_dtype=np.complex128,
target_dtype=np.complex128, only_r_linear=True)
import numpy as np
from numpy.testing import assert_allclose
import nifty6 as ift
from ..common import setup_function, teardown_function
def test_vdot_operator():
dom = ift.makeDomain(ift.RGSpace(8))
fa_1 = ift.FieldAdapter(dom, 'f1')
fa_2 = ift.FieldAdapter(dom, 'f2')
op1 = fa_1.vdot(fa_2)
f = ift.from_random(op1.domain, dtype=np.float64)
res1 = f['f1'].vdot(f['f2'])
res2 = op1(f)
assert_allclose(res1.val, res2.val)
ift.extra.check_jacobian_consistency(op1, f)
#another Test for linearization?
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