Package de.lmu.ifi.dbs.elki.utilities.pairs

Examples of de.lmu.ifi.dbs.elki.utilities.pairs.DoubleIntPair


      seed = iter.next();
      for(int i = 0; iter.hasNext(); i++) {
        assert (i < len);
        Vector p = iter.next();
        // Pair with distance, list-position
        sort[i] = new DoubleIntPair(quadraticEuclidean(seed, p), i + 1);
      }
      assert (sort[len - 1] != null);
      Arrays.sort(sort);
    }
    assert (sort[0].first > 0);
    // final Vector seed2 = points.get(sort[0].second);
    final int seed2id = sort[0].second;
    int start = 1;

    // Find minimal triangle for these two points:
    Triangle besttri = new Triangle(seedid, seed2id, -1);
    {
      besttri.r2 = Double.MAX_VALUE;
      Triangle testtri = new Triangle(seedid, seed2id, -1);
      int besti = -1;
      for(int i = start; i < len; i++) {
        // Update test triad
        testtri.c = sort[i].second;
        if(testtri.updateCircumcircle(points) && testtri.r2 < besttri.r2) {
          besttri.copyFrom(testtri);
          besti = i;
        }
        else if(besttri.r2 * 4 < sort[i].first) {
          // Stop early, points are too far away from seed.
          break;
        }
      }
      assert (besti != -1);
      // Rearrange - remove third seed point.
      if(besti > 1) {
        DoubleIntPair tmp = sort[besti];
        System.arraycopy(sort, 1, sort, 2, besti - 1);
        sort[1] = tmp;
      }
    }
    start = 2; // First two points have already been processed.
View Full Code Here


        for(int i = 0; i < neighbors.size(); i++) {
          DistanceResultPair<D> r = neighbors.get(i);
          if(i + 1 < neighbors.size() && r.getDistance().compareTo(neighbors.get(i + 1).getDistance()) == 0) {
            continue;
          }
          cdist.add(new DoubleIntPair(r.getDistance().doubleValue(), i));
          final double ri = r.getDistance().doubleValue() / alpha;
          if(ri <= rmax.doubleValue()) {
            cdist.add(new DoubleIntPair(ri, Integer.MIN_VALUE));
          }
        }
      }
      Collections.sort(cdist);
      // fill the gaps to have fast lookups of number of neighbors at a given
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.utilities.pairs.DoubleIntPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.