Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for binomial (0.11 sec)

  1. 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));
          }
        }
      }
    
    
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  2. 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));
          }
        }
      }
    
    
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  3. 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,
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 21 10:16:44 UTC 2024
    - 19.7K bytes
    - Viewed (0)
  4. android/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);
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Fri May 17 17:58:33 UTC 2024
    - 27.8K bytes
    - Viewed (0)
  5. android/guava/src/com/google/common/collect/Collections2.java

              permutations = IntMath.saturatedMultiply(permutations, IntMath.binomial(n, r));
              r = 0;
              if (permutations == Integer.MAX_VALUE) {
                return Integer.MAX_VALUE;
              }
            }
            n++;
            r++;
          }
          return IntMath.saturatedMultiply(permutations, IntMath.binomial(n, r));
        }
    
        @Override
        public int size() {
          return size;
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Apr 01 16:15:01 UTC 2024
    - 22.8K bytes
    - Viewed (0)
  6. guava/src/com/google/common/collect/Collections2.java

              permutations = IntMath.saturatedMultiply(permutations, IntMath.binomial(n, r));
              r = 0;
              if (permutations == Integer.MAX_VALUE) {
                return Integer.MAX_VALUE;
              }
            }
            n++;
            r++;
          }
          return IntMath.saturatedMultiply(permutations, IntMath.binomial(n, r));
        }
    
        @Override
        public int size() {
          return size;
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Apr 01 16:15:01 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  7. src/math/big/int.go

    	neg := false
    	if a < 0 {
    		neg = (b-a)&1 == 0
    		a, b = -b, -a
    	}
    
    	z.abs = z.abs.mulRange(uint64(a), uint64(b))
    	z.neg = neg
    	return z
    }
    
    // Binomial sets z to the binomial coefficient C(n, k) and returns z.
    func (z *Int) Binomial(n, k int64) *Int {
    	if k > n {
    		return z.SetInt64(0)
    	}
    	// reduce the number of multiplications by reducing k
    	if k > n-k {
    		k = n - k // C(n, k) == C(n, n-k)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 14 17:02:38 UTC 2024
    - 33.1K bytes
    - Viewed (0)
  8. src/runtime/metrics_test.go

    			// With 100 trials and profile fraction of 2, we expect to capture
    			// 50 samples. Allow the test to pass if we get at least 20 samples;
    			// the CDF of the binomial distribution says there's less than a
    			// 1e-9 chance of that, which is an acceptably low flakiness rate.
    			const samplingSlop = 2.5
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 17:52:17 UTC 2024
    - 45K bytes
    - Viewed (0)
Back to top