Return the intersection of two or more sets as a new set.

        >>> from ngram import NGram
        >>> a = NGram(['spam', 'eggs'])
        >>> b = NGram(['spam', 'ham'])
        >>> list(a.intersection(b))
        ['spam']
779686
def intersection(self, *others):
        
        return self.copy(super(NGram, self).intersection(*others))
359350
def intersection(other)
      if other.is_a?(RelativeComplement)
        # A ∩ ¬B = ¬B ∩ A
        other.intersection(self)
      elsif other.is_a?(AbstractSet)
        if other.is_a?(RelativeSet) and size > other.size
          # For efficiency, iterate the smaller of the two sets: A ∩ B = B ∩ A
          other.intersection(self)
        elsif other.empty?
          # A ∩ ∅ = ∅
          NullSet.build
        else
          hash = @hash.clone.delete_if{|o,_| not other.include?(o) }

          if hash.empty?
            NullSet.build
          else
            RelativeSet.new(hash)
          end
        end
      else
        intersection(Cantor.build(other))
      end
    end
921071
def get_intersection(self, range_):
        
        result = []

        for entry in self.entries:
            package, value = entry

            if value is None:
                continue  # package was blocked by package filters

            if package.version not in range_:
                continue

            if isinstance(value, list):
                variants = value
                entry_ = _PackageEntry(package, variants, self.solver)
                result.append(entry_)
                continue

            # apply package filter
            if self.solver.package_filter:
                rule = self.solver.package_filter.excludes(package)
                if rule:
                    if config.debug_package_exclusions:
                        print_debug("Package '%s' was excluded by rule '%s'"
                                    % (package.qualified_name, str(rule)))
                    entry[1] = None
                    continue

            # expand package entry into list of variants
            if self.solver.package_load_callback:
                self.solver.package_load_callback(package)

            variants_ = []
            for var in package.iter_variants():
                variant = PackageVariant(var, self.solver.building)
                variants_.append(variant)

            entry[1] = variants_
            entry_ = _PackageEntry(package, variants_, self.solver)
            result.append(entry_)

        return result or None
313386
def __matches(s1, s2, ngrams_fn, n=3):
    
    ngrams1, ngrams2 = set(ngrams_fn(s1, n=n)), set(ngrams_fn(s2, n=n))
    return ngrams1.intersection(ngrams2)
1175155
public static double[] intersection(double[] kb1, double[] kb2) {
    double[] interp = new double[2];
    if (kb1[0] == 1) {
      interp[0] = kb1[1];
      interp[1] = kb2[1] * interp[0] + kb2[2];
    } else if (kb2[0] == 1) {
      interp[0] = kb2[1];
      interp[1] = kb1[1] * interp[0] + kb1[2];
    } else {
      interp[0] = (kb2[2] - kb1[2]) / (kb1[1] - kb2[1]);
      interp[1] = kb1[1] * interp[0] + kb1[2];
    }
    return interp;

  }
1119698
def dims_intersect(self):
        
        return set.intersection(*map(
            set, (getattr(arr, 'dims_intersect', arr.dims) for arr in self)))
252775
public static <T> Set<T> intersection(Set<T>... sets) {
		return intersection(Arrays.asList(sets));
	}
91270
public AsciiSet intersection(AsciiSet set) {
    final boolean[] intersectionMembers = new boolean[128];
    for (int i = 0; i < intersectionMembers.length; ++i) {
      intersectionMembers[i] = members[i] && set.members[i];
    }
    return new AsciiSet(intersectionMembers);
  }
1052733
def generate_intersect_subparser(subparsers):
    """"""
    parser = subparsers.add_parser(
        'intersect', description=constants.INTERSECT_DESCRIPTION,
        epilog=constants.INTERSECT_EPILOG, formatter_class=ParagraphFormatter,
        help=constants.INTERSECT_HELP)
    parser.set_defaults(func=ngram_intersection)
    utils.add_common_arguments(parser)
    utils.add_db_arguments(parser)
    utils.add_corpus_arguments(parser)
    utils.add_query_arguments(parser)
391096
def intersection(self, *iterables):
        
        comb = self._set.intersection(*iterables)
        return self._fromset(comb, key=self._key)
914582
function(or1, or2) {
			var c = or2.values[0],
				d = or2.values[1];

			var intersection1 = set.intersection(or1, c);
			var intersection2 = set.intersection(or1, d);

			if (!isOr(intersection1) || !isOr(intersection2)) {
				return set.union(intersection1, intersection2);
			}
			intersection1 = set.union(or2, or1.values[0]);
			intersection2 = set.union(or2, or1.values[1]);

			if (!isOr(intersection1) || !isOr(intersection2)) {
				return set.union(intersection1, intersection2);
			} else {
				return new is.Or([or1, or2]);
			}
		}
605565
def intersection(self, other):
        
        #NOTE: This is a work around 
        # Python 3 return as the result of set.intersection a new set instance.
        # Python 2 however returns as a the result a ClusterShell.RangeSet.RangeSet instance.
        # ORIGINAL CODE: return self._wrap_set_op(set.intersection, other)
        copy = self.copy()
        copy.intersection_update(other)
        return copy
653007
def intersection(self, other):
        

        inter = MOC()

        for (order, cells) in other:
            for cell in cells:
                for i in self._compare_operation(order, cell, True, 'inter'):
                    inter.add(*i)

        return inter
451744
def intersection(self, other):
        
        if self.capacity != other.capacity or \
            self.error_rate != other.error_rate:
            raise ValueError("Intersecting filters requires both filters to \
have equal capacity and error rate")
        new_bloom = self.copy()
        new_bloom.bitarray = new_bloom.bitarray & other.bitarray
        return new_bloom
415475
def ngram_intersection(args, parser):
    """"""
    store = utils.get_data_store(args)
    corpus = utils.get_corpus(args)
    catalogue = utils.get_catalogue(args)
    store.validate(corpus, catalogue)
    store.intersection(catalogue, sys.stdout)
26416
def _is_intersect_results(results):
        
        sample = results.iloc[0]
        ngram = sample[constants.NGRAM_FIELDNAME]
        label = sample[constants.LABEL_FIELDNAME]
        return not(results[
            (results[constants.NGRAM_FIELDNAME] == ngram) &
            (results[constants.LABEL_FIELDNAME] != label)].empty)
272278
public List<Type> intersect(List<Type> cl1, List<Type> cl2) {
        if (cl1 == cl2)
            return cl1;
        if (cl1.isEmpty() || cl2.isEmpty())
            return List.nil();
        if (cl1.head.tsym.precedes(cl2.head.tsym, this))
            return intersect(cl1.tail, cl2);
        if (cl2.head.tsym.precedes(cl1.head.tsym, this))
            return intersect(cl1, cl2.tail);
        if (isSameType(cl1.head, cl2.head))
            return intersect(cl1.tail, cl2.tail).prepend(cl1.head);
        if (cl1.head.tsym == cl2.head.tsym &&
            cl1.head.hasTag(CLASS) && cl2.head.hasTag(CLASS)) {
            if (cl1.head.isParameterized() && cl2.head.isParameterized()) {
                Type merge = merge(cl1.head,cl2.head);
                return intersect(cl1.tail, cl2.tail).prepend(merge);
            }
            if (cl1.head.isRaw() || cl2.head.isRaw())
                return intersect(cl1.tail, cl2.tail).prepend(erasure(cl1.head));
        }
        return intersect(cl1.tail, cl2.tail);
    }