diff src/DLD-FUNCTIONS/conv2.cc @ 14596:ad1d7a53b1ca stable

perform convolution properly independently of matrix orientation (bug #34893) * cconv2.f (cconv2i), csconv2.f (csconv2i), dconv2.f (dconv2i), sconv2.f (sconv2i), zconv2.f (zconv2i), zdconv2.f (zdconv2i): Fix iteration over the a matrix, so it's properly reversed. * conv2.cc: Uncomment test to check for this, and add a new xtest.
author Sunghyun Cho <sodomau@gmail.com>
date Tue, 17 Apr 2012 12:47:34 +0100
parents 846273dae16b
children 6980b0f35df9
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/conv2.cc	Wed May 02 17:29:40 2012 -0400
+++ b/src/DLD-FUNCTIONS/conv2.cc	Tue Apr 17 12:47:34 2012 +0100
@@ -262,9 +262,18 @@
 %% Test cases from Bug #34893
 %!assert (conv2 ([1:5;1:5], [1:2], 'same'), [4 7 10 13 10; 4 7 10 13 10])
 %!assert (conv2 ([1:5;1:5]', [1:2]', 'same'), [4 7 10 13 10; 4 7 10 13 10]')
-%!#assert (conv2 ([1:5;1:5], [1:2], 'valid'), [4 7 10 13; 4 7 10 13])
+%!assert (conv2 ([1:5;1:5], [1:2], 'valid'), [4 7 10 13; 4 7 10 13])
 %!assert (conv2 ([1:5;1:5]', [1:2]', 'valid'), [4 7 10 13; 4 7 10 13]')
 
+%!xtest
+%! rand ("seed", 42);
+%! x = rand (100);
+%! y = ones (5);
+%! A = conv2 (x, y)(5:end-4,5:end-4);
+%! B = conv2 (x, y, "valid");
+%! assert (B, A); ## Yes, this test is for *exact* equivalence.
+
+
 %% Test input validation
 %!error conv2 ()
 %!error conv2 (1)