Package com.browseengine.bobo.util

Examples of com.browseengine.bobo.util.SparseFloatArray


        }
      }
      assertTrue("count was bad: "+count, count > 100 && count < orig.length/2);
      System.out.println("float array with "+count+" out of "+orig.length+" non-zero values");
     
      SparseFloatArray sparse = new SparseFloatArray(orig);
     
      for (int i = 0; i < orig.length; i++) {
        float o = orig[i];
        float s = sparse.get(i);
        assertTrue("orig "+o+" wasn't the same as sparse: "+s+" for i = "+i, o == s);
      }
      // things came out correct
     
      long markTime = System.currentTimeMillis();
      for (int i = 0; i < orig.length; i++) {
        float f = orig[i];
      }
      long elapsedTimeOrig = System.currentTimeMillis()-markTime;
     
      markTime = System.currentTimeMillis();
      for (int i = 0;i < orig.length; i++) {
        float f = sparse.get(i);
      }
      long elapsedTimeSparse = System.currentTimeMillis()-markTime;
     
      double ratio = (double)elapsedTimeSparse/(double)elapsedTimeOrig;
      System.out.println("fyi on speed, direct array access took "+elapsedTimeOrig+
View Full Code Here


      }
      assertTrue("count was bad: " + count, count > 100 && count < orig.length / 2);
      System.out.println("float array with " + count + " out of " + orig.length
          + " non-zero values");

      SparseFloatArray sparse = new SparseFloatArray(orig);

      for (int i = 0; i < orig.length; i++) {
        float o = orig[i];
        float s = sparse.get(i);
        assertTrue("orig " + o + " wasn't the same as sparse: " + s + " for i = " + i, o == s);
      }
      // things came out correct

      long markTime = System.currentTimeMillis();
      for (int i = 0; i < orig.length; i++) {
        @SuppressWarnings("unused")
        float f = orig[i];
      }
      long elapsedTimeOrig = System.currentTimeMillis() - markTime;

      markTime = System.currentTimeMillis();
      for (int i = 0; i < orig.length; i++) {
        sparse.get(i);
      }
      long elapsedTimeSparse = System.currentTimeMillis() - markTime;

      double ratio = (double) elapsedTimeSparse / (double) elapsedTimeOrig;
      System.out.println("fyi on speed, direct array access took " + elapsedTimeOrig
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.util.SparseFloatArray

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.