Esempio n. 1
0
  @Override
  public IValue visit_dyadic(IDoubleArray a, IIntArray b, int axis) {
    DoubleSet seta = new DoubleOpenHashSet();
    DoubleSet setb = new DoubleOpenHashSet();
    for (int i = 0; i < a.length(); i++) seta.add(a.get(i));
    for (int i = 0; i < b.length(); i++) setb.add(b.get(i));

    seta.retainAll(setb);
    double[] result = seta.toDoubleArray();

    return new DoubleArray(new Dimensions(result.length), result);
  }
Esempio n. 2
0
  @Override
  public IValue visit_dyadic(IIntArray a, IIntArray b, int axis) {
    LongSet seta = new LongOpenHashSet();
    LongSet setb = new LongOpenHashSet();
    for (int i = 0; i < a.length(); i++) seta.add(a.get(i));
    for (int i = 0; i < b.length(); i++) setb.add(b.get(i));

    seta.retainAll(setb);
    long[] result = seta.toLongArray();

    return new IntArray(new Dimensions(result.length), result);
  }