Set Operations on floating point arrays

From: Graham (GrahamWilsonCA_at_yahoo.ca)
Date: 03/31/04


Date: 31 Mar 2004 07:24:39 -0800

Does anyone have a quick reference or snippet of code that describes a
quick way of performing set operations on arrays of doubles? In
particular, I need the union and intersection of a bunch of epoch
timestamps, i.e. seconds (including the fractional part) since May 24,
1968. Each array is already guaranteed to be sorted in time so my
thought was to brute force it:

i.e. for the union:
- initialise union set to the one of the double arrays
- check for the presence of each new timestamp and append to the end
if not present
- resort

The trouble is that the arrays are large and it is taking quite a
while. Any ideas or pointers (other than 'void *v') would be much
appreciated.

Graham



Relevant Pages

  • Re: Set Operations on floating point arrays
    ... > quick way of performing set operations on arrays of doubles? ... I need the union and intersection of a bunch of epoch ...
    (comp.lang.c)
  • Re: Set union
    ... > What is the recommended way to compute set union efficiently in Fortran? ... and what data representation you're using to store ... Then the union involves combining the two arrays and removing ...
    (comp.lang.fortran)
  • Re: incompatible types in assignment
    ... Pointers, structs and unions, as well as arrays, are all derived (not ... Alright, if you insist, go ahead and make assignments to arrays. ... Note that aggregate type does not include union type because an ...
    (comp.lang.c)
  • Re: Intersection for each pair of arrays
    ... Computes the union and intersection of two arrays ... my $a = shift; ... push @isect, $k if $v>1; ... is to prevent the case where the arrays may have duplicates. ...
    (perl.beginners)
  • Re: How to compare two arrays by using perl script?
    ... I need to get the ratio ... You can either compare it by hand or use a module. ... A search for 'Arrays' brought me ... You can use length and union to find out how many elements in ...
    (freebsd-questions)