Exemplo n.º 1
0
  @Test
  public void elementMultConjB() {
    InterleavedF64 a = new InterleavedF64(width, height, 2);
    InterleavedF64 b = new InterleavedF64(width, height, 2);
    InterleavedF64 c = new InterleavedF64(width, height, 2);

    ImageMiscOps.fillUniform(a, rand, -10, 10);
    ImageMiscOps.fillUniform(b, rand, -10, 10);
    ImageMiscOps.fillUniform(c, rand, -10, 10);

    CirculantTracker.elementMultConjB(a, b, c);

    for (int y = 0; y < height; y++) {
      for (int x = 0; x < width; x++) {
        Complex64F aa = new Complex64F(a.getBand(x, y, 0), a.getBand(x, y, 1));
        Complex64F bb = new Complex64F(b.getBand(x, y, 0), b.getBand(x, y, 1));

        Complex64F cc = new Complex64F();
        ComplexMath64F.conj(bb, bb);
        ComplexMath64F.mult(aa, bb, cc);

        double foundReal = c.getBand(x, y, 0);
        double foundImg = c.getBand(x, y, 1);

        assertEquals(cc.real, foundReal, 1e-4);
        assertEquals(cc.imaginary, foundImg, 1e-4);
      }
    }
  }