Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 92 for logs (0.13 sec)

  1. android/guava-tests/test/com/google/common/math/MathBenchmarking.java

        return result;
      }
    
      /**
       * Generates a number in [0, 2^numBits) with an exponential distribution. The floor of the log2 of
       * the result is chosen uniformly at random in [0, numBits), and then the result is chosen in that
       * range uniformly at random. Zero is treated as having log2 == 0.
       */
      static BigInteger randomNonNegativeBigInteger(int numBits) {
        int digits = RANDOM_SOURCE.nextInt(numBits);
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 4.1K bytes
    - Viewed (0)
  2. guava-tests/benchmark/com/google/common/collect/ImmutableSetHashFloodingDetectionBenchmark.java

                tables[i][index] = o;
                break;
              }
            }
          }
        }
      }
    
      enum Impl {
        EXHAUSTIVE {
          int maxRunBeforeFallback(int tableSize) {
            return 12 * IntMath.log2(tableSize, RoundingMode.UNNECESSARY);
          }
    
          @Override
          boolean hashFloodingDetected(Object[] hashTable) {
            int maxRunBeforeFallback = maxRunBeforeFallback(hashTable.length);
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Thu Jun 03 20:16:35 GMT 2021
    - 6.8K bytes
    - Viewed (0)
  3. guava-tests/benchmark/com/google/common/math/DoubleMathBenchmark.java

          doubles[i] = randomDouble(Long.SIZE);
          factorials[i] = RANDOM_SOURCE.nextInt(100);
        }
      }
    
      @Benchmark
      long log2(int reps) {
        long tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += Double.doubleToRawLongBits(DoubleMath.log2(positiveDoubles[j]));
        }
        return tmp;
      }
    
      @Benchmark
      long factorial(int reps) {
        long tmp = 0;
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.5K bytes
    - Viewed (0)
  4. guava-tests/benchmark/com/google/common/math/BigIntegerMathRoundingBenchmark.java

          nonzero1[i] = randomNonZeroBigInteger(1024);
          nonzero2[i] = randomNonZeroBigInteger(1024);
        }
      }
    
      @Benchmark
      int log2(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += BigIntegerMath.log2(positive[j], mode);
        }
        return tmp;
      }
    
      @Benchmark
      int log10(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Tue Jun 30 13:06:20 GMT 2020
    - 2.8K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/math/IntMathTest.java

            }
          }
        }
      }
    
      // Relies on the correctness of BigIntegerMath.log2 for all modes except UNNECESSARY.
      public void testLog2MatchesBigInteger() {
        for (int x : POSITIVE_INTEGER_CANDIDATES) {
          for (RoundingMode mode : ALL_SAFE_ROUNDING_MODES) {
            assertEquals(BigIntegerMath.log2(valueOf(x), mode), IntMath.log2(x, mode));
          }
        }
      }
    
      // Relies on the correctness of isPowerOfTwo(int).
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 24.5K bytes
    - Viewed (0)
  6. guava-tests/benchmark/com/google/common/math/BigIntegerMathBenchmark.java

        }
      }
    
      /** Returns the product of {@code n1} exclusive through {@code n2} inclusive. */
      private static BigInteger oldSlowFactorial(int n1, int n2) {
        assert n1 <= n2;
        if (IntMath.log2(n2, CEILING) * (n2 - n1) < Long.SIZE - 1) {
          // the result will definitely fit into a long
          long result = 1;
          for (int i = n1 + 1; i <= n2; i++) {
            result *= i;
          }
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 3.3K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/collect/TopKSelectorTest.java

        top.offer(1);
        for (int i = 1; i < n; i++) {
          top.offer(0);
        }
        assertThat(top.topK()).containsExactlyElementsIn(Collections.nCopies(k, 0));
        assertThat(compareCalls[0]).isAtMost(10L * n * IntMath.log2(k, RoundingMode.CEILING));
      }
    
      public void testExceedMaxIteration() {
        /*
         * Bug #5692 occurred when TopKSelector called Arrays.sort incorrectly.
         */
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Thu Mar 07 18:34:03 GMT 2024
    - 3.9K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/math/DoubleUtils.java

        // This is an extremely fast implementation of BigInteger.doubleValue(). JDK patch pending.
        BigInteger absX = x.abs();
        int exponent = absX.bitLength() - 1;
        // exponent == floor(log2(abs(x)))
        if (exponent < Long.SIZE - 1) {
          return x.longValue();
        } else if (exponent > MAX_EXPONENT) {
          return x.signum() * POSITIVE_INFINITY;
        }
    
        /*
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Apr 28 15:37:52 GMT 2021
    - 5.1K bytes
    - Viewed (0)
  9. guava-tests/benchmark/com/google/common/math/LongMathRoundingBenchmark.java

      private static final long[] longs = new long[ARRAY_SIZE];
    
      @BeforeExperiment
      void setUp() {
        for (int i = 0; i < ARRAY_SIZE; i++) {
          positive[i] = randomPositiveBigInteger(Long.SIZE - 2).longValue();
          nonzero[i] = randomNonZeroBigInteger(Long.SIZE - 2).longValue();
          longs[i] = RANDOM_SOURCE.nextLong();
        }
      }
    
      @Benchmark
      int log2(int reps) {
        int tmp = 0;
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.6K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/collect/TopKSelector.java

     * offering expected O(n + k log k) performance (worst case O(n log k)) for n calls to {@link
     * #offer} and a call to {@link #topK}, with O(k) memory. In comparison, quickselect has the same
     * asymptotics but requires O(n) memory, and a {@code PriorityQueue} implementation takes O(n log
     * k). In benchmarks, this implementation performs at least as well as either implementation, and
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Apr 01 16:15:01 GMT 2024
    - 11.2K bytes
    - Viewed (0)
Back to top