Codota Logo
QuickSort_F64
Code IndexAdd Codota to your IDE (free)

How to use
QuickSort_F64
in
org.ddogleg.sorting

Best Java code snippets using org.ddogleg.sorting.QuickSort_F64 (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: lessthanoptimal/ddogleg

@Override
public void computeStatistics() {
  int size = allPoints.size();
  if (errors.length < size) {
    errors = new double[size * 3 / 2];
    origErrors = new double[errors.length];
  }
  Iterator<PointIndex<Point>> iter = allPoints.iterator();
  int index = 0;
  while( iter.hasNext() ) {
    Point pt = iter.next().data;
    errors[index++] = modelError.computeDistance(pt);
  }
  System.arraycopy(errors, 0, origErrors, 0, size);
  int where = (int) (size * pruneThreshold);
  sorter.sort(errors, size);
  medianError = errors[size / 2];
  pruneVal = errors[where];
}
origin: lessthanoptimal/ddogleg

  @Test
  public void testSortingRandom_indexes() {
    int offset = 10;
    for( int a = 0; a < 20; a++ ) {
      double[] normal = BenchMarkSort.createRandom_F64(rand,20);
      double[] original = normal.clone();
      double[] withIndexes = new double[offset+normal.length];;
      int[] indexes = new int[ withIndexes.length ];

      System.arraycopy(normal,0,withIndexes,offset,normal.length);

      QuickSort_F64 sorter = new QuickSort_F64();

      sorter.sort(normal,normal.length);
      sorter.sort(withIndexes,offset,normal.length,indexes);

      for( int i = 0; i < normal.length; i++ ) {
        // make sure the original hasn't been modified
        assertEquals(original[i],withIndexes[i+offset], UtilEjml.TEST_F64);
        // see if it produced the same results as the normal one
        assertEquals(normal[i],withIndexes[indexes[i]],UtilEjml.TEST_F64);
      }
    }
  }
}
origin: lessthanoptimal/ddogleg

@Test
public void testSortingRandom() {
  double[] ret = BenchMarkSort.createRandom_F64(rand,200);
  double preTotal = UtilDouble.sum(ret);
  QuickSort_F64 sorter = new QuickSort_F64();
  sorter.sort(ret,ret.length);
  double postTotal = UtilDouble.sum(ret);
  // make sure it didn't modify the list, in an unexpected way
  assertEquals(preTotal,postTotal,UtilEjml.TEST_F64);
  double prev = ret[0];
  for( int i = 1; i < ret.length; i++ ) {
    if( ret[i] < prev )
      fail("Not ascending");
    prev = ret[i];
  }
}
origin: org.ddogleg/ddogleg

@Override
public void computeStatistics() {
  int size = allPoints.size();
  if (errors.length < size) {
    errors = new double[size * 3 / 2];
    origErrors = new double[errors.length];
  }
  Iterator<PointIndex<Point>> iter = allPoints.iterator();
  int index = 0;
  while( iter.hasNext() ) {
    Point pt = iter.next().data;
    errors[index++] = modelError.computeDistance(pt);
  }
  System.arraycopy(errors, 0, origErrors, 0, size);
  int where = (int) (size * pruneThreshold);
  sorter.sort(errors, size);
  medianError = errors[size / 2];
  pruneVal = errors[where];
}
origin: org.boofcv/feature

@Override
public double compute(double c_x, double c_y) {
  double period = scale*this.period;
  // top left corner of the region being sampled
  double tl_x = c_x - sampleRadius *period;
  double tl_y = c_y - sampleRadius *period;
  computeGradient(tl_x,tl_y,period);
  // apply weight to each gradient dependent on its position
  if( weights != null ) {
    for( int i = 0; i < total; i++ ) {
      double w = weights.data[i];
      derivX[i] *= w;
      derivY[i] *= w;
    } 
  }
  
  for( int i = 0; i < total; i++ ) {
    angles[i] = Math.atan2(derivY[i],derivX[i]);
  }
  // order points from lowest to highest
  sorter.sort(angles, angles.length, order);
  return estimateAngle();
}
org.ddogleg.sortingQuickSort_F64

Javadoc

An implementation of the quick sort algorithm from Numerical Recipes Third Edition that is specified for arrays of doubles. A small amount of memory is declared for this sorting algorithm. This implementation seems to often perform slower than Shell sort. A comment in Numerical recipes about unnecessary array checks makes me think this is slow because java always does a bounds check on arrays. This has slightly better performance than Arrays.sort(double[]). Not noticeable in most applications.

Most used methods

  • sort
  • <init>

Popular in Java

  • Parsing JSON documents to java classes using gson
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now