Skip to content

numpy.conjugate and numpy.ndarray.conjugate behave inconsistently #4730

@andyjost

Description

@andyjost

If x is an ndarray of objects that define a method "conjugate", then numpy.conjugate(x) takes the conjugate of each element, but x.conjugate() does nothing.

> > > numpy.version.git_revision
> > > '697316a867a32e9f72778a29226c9febbf867ee8'
> > > numpy.version.version
> > > '1.7.1'
> > > numpy.version.release
> > > True
> > > 
> > > class Object(object):
> > > ...   def conjugate(self, _args, *_kwds):
> > > ...     print 'Calling conjugate'
> > > ...     return self
> > > ...
> > > o = Object()
> > > o.conjugate()
> > > Calling conjugate
> > > <**main**.Object object at 0x18db1c90>
> > > oo = numpy.array([o,o])
> > > numpy.conjugate(oo)
> > > Calling conjugate
> > > Calling conjugate
> > > array([<**main**.Object object at 0x18db1c90>,
> > >        <**main**.Object object at 0x18db1c90>], dtype=object)
> > > oo.conjugate()
> > > array([<**main**.Object object at 0x18db1c90>,
> > >        <**main**.Object object at 0x18db1c90>], dtype=object)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions