Examples of countSetBits()


Examples of ivory.lsh.data.NBitSignature.countSetBits()

  public void testPermuteBit() throws IOException {
    PermutationByBit p = new PermutationByBit(D);

    NBitSignature s = getRandomSignature();

    int cntBits = s.countSetBits();

    int loopcnt = 0;
    NBitSignature permutedS = new NBitSignature(D);
    while (loopcnt++ < 100) {
      ArrayListOfIntsWritable a = p.nextPermutation();
View Full Code Here

Examples of ivory.lsh.data.NBitSignature.countSetBits()

    int loopcnt = 0;
    NBitSignature permutedS = new NBitSignature(D);
    while (loopcnt++ < 100) {
      ArrayListOfIntsWritable a = p.nextPermutation();
      s.perm(a, permutedS);
      System.out.println(permutedS.countSetBits());
      assertTrue(cntBits == permutedS.countSetBits());
      // System.out.println(permutedS);
    }
  }
View Full Code Here

Examples of ivory.lsh.data.NBitSignature.countSetBits()

    NBitSignature permutedS = new NBitSignature(D);
    while (loopcnt++ < 100) {
      ArrayListOfIntsWritable a = p.nextPermutation();
      s.perm(a, permutedS);
      System.out.println(permutedS.countSetBits());
      assertTrue(cntBits == permutedS.countSetBits());
      // System.out.println(permutedS);
    }
  }

  @Test
View Full Code Here

Examples of ivory.lsh.data.NBitSignature.countSetBits()

    int tempD = D;
    D = 64;
    NBitSignature s = getRandomSignature();
    System.out.println(s + "\n========================");

    int cntBits = s.countSetBits();
    System.out.println(s.countSetBits());

    int loopcnt = 0;
    NBitSignature permutedS = new NBitSignature(D);
    while (true) {
View Full Code Here

Examples of ivory.lsh.data.NBitSignature.countSetBits()

    D = 64;
    NBitSignature s = getRandomSignature();
    System.out.println(s + "\n========================");

    int cntBits = s.countSetBits();
    System.out.println(s.countSetBits());

    int loopcnt = 0;
    NBitSignature permutedS = new NBitSignature(D);
    while (true) {
      try {
View Full Code Here

Examples of ivory.lsh.data.NBitSignature.countSetBits()

    while (true) {
      try {
        ArrayListOfIntsWritable a = p.nextPermutation();
        s.perm(a, permutedS);
        System.out.println((loopcnt++) + "\n" + permutedS);
        assertTrue(cntBits == permutedS.countSetBits());
        // System.out.println(permutedS);
      } catch (RuntimeException e) {
        D = tempD;
        return;
      }
View Full Code Here

Examples of org.uncommons.maths.binary.BitString.countSetBits()

     * @return The number of successful outcomes from {@literal n} trials.
     */
    private int binomialWithEvenProbability(int n)
    {
        BitString bits = new BitString(n, rng);
        return bits.countSetBits();
    }
}
View Full Code Here

Examples of org.uncommons.maths.binary.BitString.countSetBits()

        List<BitString> population = Arrays.asList(original);
        population = mutation.apply(population, FrameworkTestUtils.getRNG());
        BitString mutated = population.get(0);
        assert !mutated.equals(original) : "Mutation should be different from original.";
        assert mutated.getLength() == 9 : "Mutated bit string changed length.";
        int set = mutated.countSetBits();
        int unset = mutated.countUnsetBits();
        assert set == 5 || set == 7 : "Mutated bit string has wrong number of 1s: " + set;
        assert unset == 2 || unset == 4 : "Mutated bit string has wrong number of 0s: " + unset;
    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.