Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 26 for binomials (0.34 sec)

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

      }
    
      // Depends on the correctness of BigIntegerMath.binomial.
      public void testBinomial() {
        for (int n = 0; n <= 50; n++) {
          for (int k = 0; k <= n; k++) {
            BigInteger expectedBig = BigIntegerMath.binomial(n, k);
            int expectedInt = fitsInInt(expectedBig) ? expectedBig.intValue() : Integer.MAX_VALUE;
            assertEquals(expectedInt, IntMath.binomial(n, k));
          }
        }
      }
    
    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)
  2. guava-tests/benchmark/com/google/common/math/LongMathBenchmark.java

          int j = i & ARRAY_MASK;
          tmp += LongMath.factorial(factorialArguments[j]);
        }
        return tmp;
      }
    
      @Benchmark
      int binomial(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += LongMath.binomial(binomialArguments[j][0], binomialArguments[j][1]);
        }
        return tmp;
      }
    
      @Benchmark
      int isPrime(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
    - 3.5K bytes
    - Viewed (0)
  3. guava-tests/test/com/google/common/math/MathBenchmarking.java

      static final Random RANDOM_SOURCE = new Random(314159265358979L);
      static final int MAX_EXPONENT = 100;
    
      /*
       * Duplicated from LongMath.
       * binomial(biggestBinomials[k], k) fits in a long, but not
       * binomial(biggestBinomials[k] + 1, k).
       */
      static final int[] biggestBinomials = {
        Integer.MAX_VALUE,
        Integer.MAX_VALUE,
        Integer.MAX_VALUE,
        3810779,
        121977,
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 4.1K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/math/MathBenchmarking.java

      static final Random RANDOM_SOURCE = new Random(314159265358979L);
      static final int MAX_EXPONENT = 100;
    
      /*
       * Duplicated from LongMath.
       * binomial(biggestBinomials[k], k) fits in a long, but not
       * binomial(biggestBinomials[k] + 1, k).
       */
      static final int[] biggestBinomials = {
        Integer.MAX_VALUE,
        Integer.MAX_VALUE,
        Integer.MAX_VALUE,
        3810779,
        121977,
    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)
  5. android/guava/src/com/google/common/math/BigIntegerMath.java

      /**
       * Returns {@code n} choose {@code k}, also known as the binomial coefficient of {@code n} and
       * {@code k}, that is, {@code n! / (k! (n - k)!)}.
       *
       * <p><b>Warning:</b> the result can take as much as <i>O(k log n)</i> space.
       *
       * @throws IllegalArgumentException if {@code n < 0}, {@code k < 0}, or {@code k > n}
       */
      public static BigInteger binomial(int n, int k) {
        checkNonNegative("n", n);
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 18.9K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/math/IntMath.java

      };
    
      /**
       * Returns {@code n} choose {@code k}, also known as the binomial coefficient of {@code n} and
       * {@code k}, or {@link Integer#MAX_VALUE} if the result does not fit in an {@code int}.
       *
       * @throws IllegalArgumentException if {@code n < 0}, {@code k < 0} or {@code k > n}
       */
      public static int binomial(int n, int k) {
        checkNonNegative("n", n);
        checkNonNegative("k", k);
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 23.5K bytes
    - Viewed (0)
  7. guava-tests/test/com/google/common/collect/Collections2Test.java

                .size());
    
        // Almost force an overflow in the binomial coefficient calculation
        assertEquals(
            1391975640 /*C(34,14)*/,
            Collections2.orderedPermutations(concat(nCopies(20, 1), nCopies(14, 2))).size());
        // Do force an overflow in the binomial coefficient calculation
        assertEquals(
            Integer.MAX_VALUE,
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Feb 21 10:16:44 GMT 2024
    - 19.7K bytes
    - Viewed (0)
  8. android/guava-tests/test/com/google/common/collect/Collections2Test.java

                .size());
    
        // Almost force an overflow in the binomial coefficient calculation
        assertEquals(
            1391975640 /*C(34,14)*/,
            Collections2.orderedPermutations(concat(nCopies(20, 1), nCopies(14, 2))).size());
        // Do force an overflow in the binomial coefficient calculation
        assertEquals(
            Integer.MAX_VALUE,
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 21 10:16:44 GMT 2024
    - 19.7K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/math/LongMath.java

      };
    
      /**
       * Returns {@code n} choose {@code k}, also known as the binomial coefficient of {@code n} and
       * {@code k}, or {@link Long#MAX_VALUE} if the result does not fit in a {@code long}.
       *
       * @throws IllegalArgumentException if {@code n < 0}, {@code k < 0}, or {@code k > n}
       */
      public static long binomial(int n, int k) {
        checkNonNegative("n", n);
        checkNonNegative("k", k);
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 44.6K bytes
    - Viewed (0)
  10. guava-tests/test/com/google/common/math/BigIntegerMathTest.java

            assertEquals(expected, BigIntegerMath.binomial(n, k));
          }
        }
      }
    
      public void testBinomialOutside() {
        for (int n = 0; n <= 50; n++) {
          try {
            BigIntegerMath.binomial(n, -1);
            fail("Expected IllegalArgumentException");
          } catch (IllegalArgumentException expected) {
          }
          try {
            BigIntegerMath.binomial(n, n + 1);
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 28.2K bytes
    - Viewed (0)
Back to top