odlgroup / odl

Operator Discretization Library https://odlgroup.github.io/odl/
Mozilla Public License 2.0
354 stars 104 forks source link

deformations of complex functions #1521

Open mehrhardt opened 4 years ago

mehrhardt commented 4 years ago

I tried the example below (taken from linearized.py but with dtype='complex') which failed with

TypeError: Cannot cast ufunc add output from dtype('complex128') to dtype('float64') with casting rule 'same_kind'

This can be fixed by disp_field_space = space.tangent_bundle.real_space. Is this the desired behaviour?

import odl

space = odl.uniform_discr(0, 1, 5, dtype='complex')
disp_field_space = space.tangent_bundle
template = space.element([0, 0, 1, 0, 0])
displacement_field = disp_field_space.element([[0, 0, 0, -0.2, 0]])
odl.deform.linear_deform(template, displacement_field)
adler-j commented 4 years ago

Good observation. I'm not 100% sure if the correct solution is to make the tangent bundle itself real, or if we should use real_space here. Perhaps @ozanoktem has the correct mathematical intuition?