コード例 #1
0
  @Before
  public void setUp() throws Exception {

    mF324 = f.matrix(dim324);
    mT324 = mF324.not();
    mF43 = f.matrix(dim43);
    mF4 = f.matrix(dim4);
    Arrays.fill(mCells, FALSE);
  }
コード例 #2
0
  @Test
  public final void testCrossProduct() {
    final BooleanMatrix mT43 = mF43.not();

    fill(mT43, range(0, dim43.capacity() - 1));
    fill(mF4, range(0, dim4.capacity() - 1));

    assertCrossProductFalse(mF324, mT43);
    assertCrossProductFalse(mF324, mF4);

    fill(mT324, range(0, dim324.capacity() - 1));

    BooleanValue[] result = new BooleanValue[dim324.cross(dim43).capacity()];
    Arrays.fill(result, TRUE);

    final int c324 = dim324.capacity(), c43 = dim43.capacity();
    final int c32443 = c324 * c43;

    for (int i = 0; i < c32443; i++) {
      result[i] = f.and(mT324.get(i / c43), mT43.get(i % c43));
    }
    assertTrue(equivalent(mT324.cross(mT43), result));

    mT324.set(1, TRUE);
    for (int i = c43; i < c43 * 2; i++) {
      result[i] = mT43.get(i % c43);
    }

    assertTrue(equivalent(mT324.cross(mT43), result));

    mT43.set(5, TRUE);
    for (int i = 0; i < c324; i++) {
      result[i * c43 + 5] = mT324.get(i);
    }

    assertTrue(equivalent(mT324.cross(mT43), result));

    mT324.set(10, FALSE);
    for (int i = c43 * 10; i < c43 * 11; i++) {
      result[i] = FALSE;
    }

    assertTrue(equivalent(mT324.cross(mT43), result));
    // System.out.println(Arrays.asList(result));
    // System.out.println(mT324.crossProduct(mT43));

  }
コード例 #3
0
  @Test
  public final void testNot() {

    fill(mT324, mCells, mR[1]);
    fill(mT324, mCells, mR[3]);
    for (int i = mR[1].min(); i <= mR[1].max(); i++) {
      mCells[i] = f.not(mCells[i]);
    }
    for (int i = mR[3].min(); i <= mR[3].max(); i++) {
      mCells[i] = f.not(mCells[i]);
    }
    mT324.set(mR[1].max() + 1, FALSE);
    mCells[mR[1].max() + 1] = TRUE;

    BooleanMatrix mNot = mT324.not();

    assertTrue(equivalent(mT324.dimensions(), mNot.dimensions()));
    assertTrue(equivalent(mNot, mCells));

    // System.out.println(mT324);
    // System.out.println(mNot);
  }