[Numpy-discussion] Multiplicity of an entry
Tue Oct 27 14:31:39 CDT 2009
Christopher Barker wrote:
> Nadav Horesh wrote:
>> but, for unknown reason, np.equal operates only on "normal" arrays.
> In : a
> array(['abc', 'def', 'abc', 'ghij'],
> In : np.equal(a,a)
> Out: NotImplemented
> In : a == a
> Out: array([ True, True, True, True], dtype=bool)
> don't they use the same code? or is "==" reverting to plain old generic
> python sequence comparison, which would partly explain why it is so slow.
It looks as if "a == a" (that is array_richcompare) is triggering
special case code for strings, so it is fast. However, IMHO np.equal
should be made to work as well. Can you file a bug and assign it to me
(I'm dealing with a number of other string-related things, so I might as
well take this too).
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
More information about the NumPy-Discussion