Set operations in Numeric

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George Sakkis

    #1

    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

  • Robert Kern

    #2
    Re: Set operations in Numeric

    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:



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



    --
    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

    Comment

    • George Sakkis

      #3
      Re: Set operations in Numeric

      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:
      >

      >
      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

      Comment

      Working...