I would like to fix the fftconvolve() bug for the PDL-2.4.6
release:

http://sourceforge.net/tracker/?func=detail&aid=2630369&group_id=612&atid=100612

but I'm having problems since it appears that our PDL conv1d()
routine actually calculated the 1D correlation of the arguments.

First set up simple arguments:

   perldl> $a = zeroes(11);
   perldl> $a(5) .= 1;
   perldl> p $a
   [0 0 0 0 0 1 0 0 0 0 0]

   perldl> $b = pdl(2,0,-1);
   perldl> p $b
   [2 0 -1]

The analytic convolution is calculated to be:

   perldl> $ctrue = $a->zeroes;
   perldl> $ctrue(4) .= 2;
   perldl> $ctrue(6) .= -1;
   perldl> p $ctrue
   [0 0 0 0 2 0 -1 0 0 0 0]

Here are the various PDL convolution outputs:

   perldl> p $c1d = conv1d $a, $b;     # wrong!
   [0 0 0 0 -1 0 2 0 0 0 0]

   perldl> use PDL::Image2D
   perldl> p $c2d = conv2d $a, $b;      # right!
   [
    [ 0  0  0  0  2  0 -1  0  0  0  0]
   ]

   perldl> use PDL::ImageND
   perldl> p $cNd = convolveND $a, $b;  # right!
   [0 0 0 0 2 0 -1 0 0 0 0]

The good news is that the conv2d() and convolveND() routines
appear to be calculating a convolution so the only "broken"
routine appears to be the conv1d().  My plan is to add a
test for the bug, fix the code/docs, and update the Release_Notes

--Chris

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to