Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for binomials (0.2 sec)

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

      }
    
      // Depends on the correctness of BigIntegerMath.binomial.
      public void testBinomial() {
        for (int n = 0; n <= 70; n++) {
          for (int k = 0; k <= n; k++) {
            BigInteger expectedBig = BigIntegerMath.binomial(n, k);
            long expectedLong = fitsInLong(expectedBig) ? expectedBig.longValue() : Long.MAX_VALUE;
            assertEquals(expectedLong, LongMath.binomial(n, k));
          }
        }
      }
    
    
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  2. android/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 May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 24.5K bytes
    - Viewed (0)
  3. guava-tests/test/com/google/common/math/LongMathTest.java

      }
    
      // Depends on the correctness of BigIntegerMath.binomial.
      public void testBinomial() {
        for (int n = 0; n <= 70; n++) {
          for (int k = 0; k <= n; k++) {
            BigInteger expectedBig = BigIntegerMath.binomial(n, k);
            long expectedLong = fitsInLong(expectedBig) ? expectedBig.longValue() : Long.MAX_VALUE;
            assertEquals(expectedLong, LongMath.binomial(n, k));
          }
        }
      }
    
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  4. 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)
  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