[SciPy-dev] New in fastumath ~ (means conjugate on floats and complex numbers)
Travis Oliphant
oliphant.travis at ieee.org
Sun Feb 24 21:07:06 CST 2002
On Sunday 24 February 2002 12:31 am, you wrote:
> > I finally realized that with a simple change we can use the unary
> > operator on floats and complex numbers to mean complex conjugation.
> >
> > I've made the simple change in the CVS version of fastumath.
> >
> > So, in scipy complex-conjugation is as simple as
> >
> > ~a
> >
> > if a is a complex number (or a float).
> >
> > The only problem is that if a is an integer it still means bitwise
> > inversion.
> >
> > Is the added convenience worth the possible confusion? The problem is
> > that complex conjugation happens all the time, but bitwise inversion
> > rarely.
>
> -1
>
> I like the idea of having a conjugate operator, but this introduces a
> dangerous ambiguity. There are many times where arrays are passed around
> without regard for their numeric typecode. If an integer array is passed
> into some function that does a conjugate, a bit inversion occurs instead
> and silently produces invalid results. Are there any other symbols
> available?
No, the other thing we could do in fastumath (remember this isn't in the
default umath in Numeric) is to eliminate the ~ as a bit inversion on Numeric
arrays. That would eliminate the ambiguity.
-Travis
More information about the Scipy-dev
mailing list