471,853 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

Set operations in Numeric

Is there a way to handle numeric (or numarray or numpy) arrays as sets
and compute efficiently their intersection, union, etc. ? I hope there
is a faster way than s = array(set(A) & set(B)). Can this be done with
masked arrays maybe ? I've never used them though and browsing through
the docs didn't make clear if it is possible.

Thanks,
George

Oct 23 '06 #1
2 1080
George Sakkis wrote:
Is there a way to handle numeric (or numarray or numpy) arrays as sets
and compute efficiently their intersection, union, etc. ? I hope there
is a faster way than s = array(set(A) & set(B)). Can this be done with
masked arrays maybe ? I've never used them though and browsing through
the docs didn't make clear if it is possible.
You'll probably want to ask such questions on the numpy list:

http://www.scipy.org/Mailing_Lists

Robert Cimrman has implemented a number of set operations based on sorting.

http://svn.scipy.org/svn/scipy/trunk...arraysetops.py

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Oct 23 '06 #2
Robert Kern wrote:
George Sakkis wrote:
Is there a way to handle numeric (or numarray or numpy) arrays as sets
and compute efficiently their intersection, union, etc. ? I hope there
is a faster way than s = array(set(A) & set(B)). Can this be done with
masked arrays maybe ? I've never used them though and browsing through
the docs didn't make clear if it is possible.

You'll probably want to ask such questions on the numpy list:

http://www.scipy.org/Mailing_Lists

Robert Cimrman has implemented a number of set operations based on sorting.

http://svn.scipy.org/svn/scipy/trunk...arraysetops.py
Thank you so much, these fit the bill perfectly !

George

Oct 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Travis Oliphant | last post: by
2 posts views Thread by Johannes Nix |Johannes.Nix | last post: by
8 posts views Thread by Fabrício de Novaes Kucinskis | last post: by
8 posts views Thread by Sam Fisher | last post: by
reply views Thread by robert | last post: by
7 posts views Thread by Flavio | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.