I just took the abs() of the output from the convolution to get a real valued variable for now. Is there a way to cast a complex variable to a real variable that would just drop the imaginary part? And if there is would it be faster than abs()? -Ranjit
On Thu, Aug 27, 2009 at 2:01 PM, Jonathan Guyer <[email protected]> wrote: > > > On Aug 27, 2009, at 1:46 PM, Ranjit Chacko wrote: > > I figured out where the type error came from. Using the fft's returned >> complex valued arrays. Everything works fine if I use an operation that >> yields a real valued array. >> > > Yes, that was going to be my suggestion. Unfortunately, even if you do > something like > > conv = ConvolutionVariable(var) > eq = ... + conv * conv.conjugate() > > (assuming that's physically appropriate) it still doesn't work because > `conv * conv.conjugate()` is still complex, just with zero imaginary > component everywhere, and things like the Viewers don't understand it (the > solvers probably don't either, but I haven't tested). Of course, it's not > that hard to define a RealVariable() object, but this is something we should > probably integrate in FiPy. > > >
