annotate libinterp/corefcn/conv2.cc @ 17336:b81b9d079515

Use '##' for comments which stand alone on a line. * libinterp/corefcn/besselj.cc, libinterp/corefcn/conv2.cc, libinterp/corefcn/pinv.cc, libinterp/corefcn/rand.cc, libinterp/corefcn/regexp.cc, libinterp/corefcn/sqrtm.cc, libinterp/dldfcn/qr.cc, libinterp/parse-tree/pt-eval.cc, scripts/general/cplxpair.m, scripts/general/repmat.m, scripts/help/doc.m, scripts/help/doc_cache_create.m, scripts/image/colorcube.m, scripts/image/hsv2rgb.m, scripts/image/image.m, scripts/io/strread.m, scripts/io/textscan.m, scripts/miscellaneous/bzip2.m, scripts/miscellaneous/edit.m, scripts/miscellaneous/gzip.m, scripts/optimization/__all_opts__.m, scripts/optimization/fminbnd.m, scripts/optimization/sqp.m, scripts/pkg/private/get_forge_pkg.m, scripts/plot/area.m, scripts/plot/stemleaf.m, scripts/plot/surfc.m, scripts/plot/uiresume.m, scripts/plot/zlabel.m, scripts/polynomial/mkpp.m, scripts/polynomial/ppval.m, scripts/set/intersect.m, scripts/signal/freqz.m, scripts/sparse/pcg.m, scripts/sparse/pcr.m, scripts/sparse/svds.m, scripts/sparse/treelayout.m, scripts/specfun/ellipke.m, scripts/special-matrix/toeplitz.m, scripts/strings/dec2base.m, scripts/strings/strsplit.m, scripts/testfun/test.m, test/build-sparse-tests.sh, test/index.tst, test/system.tst: Use '##' for comments which stand alone on a line.
author Rik <rik@octave.org>
date Wed, 28 Aug 2013 08:27:38 -0700
parents bc924baa2c4e
children d6f4b01075e0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
1 /*
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13219
diff changeset
3 Copyright (C) 1999-2012 Andy Adler
10498
8615b55b5caf fix & improve cat (bug #29465)
Jaroslav Hajek <highegg@gmail.com>
parents: 10384
diff changeset
4 Copyright (C) 2010 VZLU Prague
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
5
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
7
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
11 option) any later version.
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
12
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
16 for more details.
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
17
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
20 <http://www.gnu.org/licenses/>.
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
21
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
22 */
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
23
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
25 #include <config.h>
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
26 #endif
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
27
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
28 #include "oct-convn.h"
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
29
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14607
diff changeset
30 #include "defun.h"
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
31 #include "error.h"
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
32 #include "oct-obj.h"
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
33 #include "utils.h"
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
34
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
35 enum Shape { SHAPE_FULL, SHAPE_SAME, SHAPE_VALID };
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
36
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14607
diff changeset
37 DEFUN (conv2, args, ,
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
38 "-*- texinfo -*-\n\
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14607
diff changeset
39 @deftypefn {Built-in Function} {} conv2 (@var{A}, @var{B})\n\
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14607
diff changeset
40 @deftypefnx {Built-in Function} {} conv2 (@var{v1}, @var{v2}, @var{m})\n\
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14607
diff changeset
41 @deftypefnx {Built-in Function} {} conv2 (@dots{}, @var{shape})\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
42 Return the 2-D convolution of @var{A} and @var{B}. The size of the result\n\
11085
2beacd515e09 Update docstrings for convolution family of functions (conv, conv2, fftconv)
Rik <octave@nomad.inbox5.com>
parents: 11083
diff changeset
43 is determined by the optional @var{shape} argument which takes the following\n\
2beacd515e09 Update docstrings for convolution family of functions (conv, conv2, fftconv)
Rik <octave@nomad.inbox5.com>
parents: 11083
diff changeset
44 values\n\
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
45 \n\
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
46 @table @asis\n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15241
diff changeset
47 @item @var{shape} = @qcode{\"full\"}\n\
11085
2beacd515e09 Update docstrings for convolution family of functions (conv, conv2, fftconv)
Rik <octave@nomad.inbox5.com>
parents: 11083
diff changeset
48 Return the full convolution. (default)\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10498
diff changeset
49 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15241
diff changeset
50 @item @var{shape} = @qcode{\"same\"}\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
51 Return the central part of the convolution with the same size as @var{A}.\n\
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
52 The central part of the convolution begins at the indices\n\
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
53 @code{floor ([size(@var{B})/2] + 1)}.\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10498
diff changeset
54 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15241
diff changeset
55 @item @var{shape} = @qcode{\"valid\"}\n\
11083
bb8bf77f2242 conv2.cc: style fixes; update docstrings
John W. Eaton <jwe@octave.org>
parents: 10840
diff changeset
56 Return only the parts which do not include zero-padded edges.\n\
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
57 The size of the result is @code{max (size (A) - size (B) + 1, 0)}.\n\
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
58 @end table\n\
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
59 \n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
60 When the third argument is a matrix, return the convolution of the matrix\n\
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
61 @var{m} by the vector @var{v1} in the column direction and by the vector\n\
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
62 @var{v2} in the row direction.\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
63 @seealso{conv, convn}\n\
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
64 @end deftypefn")
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
65 {
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
66 octave_value retval;
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
67 octave_value tmp;
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
68 int nargin = args.length ();
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
69 std::string shape = "full"; // default
10371
dc8637fd7a76 improve conv2 performance
John W. Eaton <jwe@octave.org>
parents: 10368
diff changeset
70 bool separable = false;
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
71 convn_type ct;
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
72
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
73 if (nargin < 2)
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
74 {
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5822
diff changeset
75 print_usage ();
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
76 return retval;
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
77 }
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
78 else if (nargin == 3)
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
79 {
5822
4fdc2515ebad [project @ 2006-05-18 19:31:36 by jwe]
jwe
parents: 5819
diff changeset
80 if (args(2).is_string ())
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
81 shape = args(2).string_value ();
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
82 else
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
83 separable = true;
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
84 }
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
85 else if (nargin >= 4)
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
86 {
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
87 separable = true;
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
88 shape = args(3).string_value ();
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
89 }
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
90
15241
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
91 if (args(0).ndims () > 2 || args(1).ndims () > 2)
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
92 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
93 error ("conv2: A and B must be 1-D vectors or 2-D matrices");
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
94 return retval;
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
95 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
96
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
97 if (shape == "full")
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
98 ct = convn_full;
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
99 else if (shape == "same")
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
100 ct = convn_same;
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
101 else if (shape == "valid")
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
102 ct = convn_valid;
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
103 else
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
104 {
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
105 error ("conv2: SHAPE type not valid");
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5822
diff changeset
106 print_usage ();
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
107 return retval;
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
108 }
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
109
15241
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
110 if (separable)
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
111 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
112 // If user requests separable, check first two params are vectors
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
113
15241
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
114 if (! (1 == args(0).rows () || 1 == args(0).columns ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
115 || ! (1 == args(1).rows () || 1 == args(1).columns ()))
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
116 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
117 print_usage ();
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
118 return retval;
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
119 }
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
120
15241
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
121 if (args(0).is_single_type () || args(1).is_single_type ()
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
122 || args(2).is_single_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
123 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
124 if (args(0).is_complex_type () || args(1).is_complex_type ()
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
125 || args(2).is_complex_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
126 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
127 FloatComplexMatrix a (args(2).float_complex_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
128 if (args(1).is_real_type () && args(2).is_real_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
129 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
130 FloatColumnVector v1 (args(0).float_vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
131 FloatRowVector v2 (args(1).float_vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
132 retval = convn (a, v1, v2, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
133 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
134 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
135 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
136 FloatComplexColumnVector v1 (args(0).float_complex_vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
137 FloatComplexRowVector v2 (args(1).float_complex_vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
138 retval = convn (a, v1, v2, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
139 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
140 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
141 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
142 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
143 FloatColumnVector v1 (args(0).float_vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
144 FloatRowVector v2 (args(1).float_vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
145 FloatMatrix a (args(2).float_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
146 retval = convn (a, v1, v2, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
147 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
148 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
149 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
150 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
151 if (args(0).is_complex_type () || args(1).is_complex_type ()
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
152 || args(2).is_complex_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
153 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
154 ComplexMatrix a (args(2).complex_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
155 if (args(1).is_real_type () && args(2).is_real_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
156 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
157 ColumnVector v1 (args(0).vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
158 RowVector v2 (args(1).vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
159 retval = convn (a, v1, v2, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
160 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
161 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
162 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
163 ComplexColumnVector v1 (args(0).complex_vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
164 ComplexRowVector v2 (args(1).complex_vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
165 retval = convn (a, v1, v2, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
166 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
167 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
168 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
169 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
170 ColumnVector v1 (args(0).vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
171 RowVector v2 (args(1).vector_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
172 Matrix a (args(2).matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
173 retval = convn (a, v1, v2, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
174 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
175 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
176 } // if (separable)
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
177 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
178 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
179 if (args(0).is_single_type () || args(1).is_single_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
180 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
181 if (args(0).is_complex_type () || args(1).is_complex_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
182 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
183 FloatComplexMatrix a (args(0).float_complex_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
184 if (args(1).is_real_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
185 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
186 FloatMatrix b (args(1).float_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
187 retval = convn (a, b, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
188 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
189 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
190 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
191 FloatComplexMatrix b (args(1).float_complex_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
192 retval = convn (a, b, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
193 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
194 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
195 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
196 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
197 FloatMatrix a (args(0).float_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
198 FloatMatrix b (args(1).float_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
199 retval = convn (a, b, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
200 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
201 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
202 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
203 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
204 if (args(0).is_complex_type () || args(1).is_complex_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
205 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
206 ComplexMatrix a (args(0).complex_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
207 if (args(1).is_real_type ())
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
208 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
209 Matrix b (args(1).matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
210 retval = convn (a, b, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
211 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
212 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
213 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
214 ComplexMatrix b (args(1).complex_matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
215 retval = convn (a, b, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
216 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
217 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
218 else
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
219 {
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
220 Matrix a (args(0).matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
221 Matrix b (args(1).matrix_value ());
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
222 retval = convn (a, b, ct);
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
223 }
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
224 }
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
225
15241
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
226 } // if (separable)
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
227
15241
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
228 return retval;
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
229 }
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
230
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
231 /*
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
232 %!test
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
233 %! c = [0,1,2,3;1,8,12,12;4,20,24,21;7,22,25,18];
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
234 %! assert (conv2 ([0,1;1,2], [1,2,3;4,5,6;7,8,9]), c);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
235
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
236 %!test
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
237 %! c = single ([0,1,2,3;1,8,12,12;4,20,24,21;7,22,25,18]);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
238 %! assert (conv2 (single ([0,1;1,2]), single ([1,2,3;4,5,6;7,8,9])), c);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
239
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
240 %!test
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
241 %! c = [1,4,4;5,18,16;14,48,40;19,62,48;15,48,36];
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
242 %! assert (conv2 (1:3, 1:2, [1,2;3,4;5,6]), c);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
243
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
244 %!assert (conv2 (1:3, 1:2, [1,2;3,4;5,6], "full"),
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
245 %! conv2 (1:3, 1:2, [1,2;3,4;5,6]));
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
246
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
247 %% Test shapes
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
248 %!shared A, B, C
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
249 %! A = rand (3, 4);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
250 %! B = rand (4);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
251 %! C = conv2 (A, B);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
252 %!assert (conv2 (A,B, "full"), C)
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
253 %!assert (conv2 (A,B, "same"), C(3:5,3:6))
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
254 %!assert (conv2 (A,B, "valid"), zeros (0, 1))
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
255 %!assert (size (conv2 (B,A, "valid")), [2 1])
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
256
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
257 %!test
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
258 %! B = rand (5);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
259 %! C = conv2 (A, B);
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
260 %!assert (conv2 (A,B, "full"), C)
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
261 %!assert (conv2 (A,B, "same"), C(3:5,3:6))
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
262 %!assert (conv2 (A,B, "valid"), zeros (0, 0))
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
263 %!assert (size (conv2 (B,A, "valid")), [3 2])
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
264
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
265 %% Clear shared variables so they are not reported for tests below
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
266 %!shared
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
267
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
268 %% Test cases from Bug #34893
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14209
diff changeset
269 %!assert (conv2 ([1:5;1:5], [1:2], "same"), [4 7 10 13 10; 4 7 10 13 10])
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14209
diff changeset
270 %!assert (conv2 ([1:5;1:5]', [1:2]', "same"), [4 7 10 13 10; 4 7 10 13 10]')
14607
34f067bcac12 maint: Periodic merge of stable to default
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14501 14597
diff changeset
271 %!assert (conv2 ([1:5;1:5], [1:2], "valid"), [4 7 10 13; 4 7 10 13])
14501
60e5cf354d80 Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents: 14209
diff changeset
272 %!assert (conv2 ([1:5;1:5]', [1:2]', "valid"), [4 7 10 13; 4 7 10 13]')
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
273
14597
6980b0f35df9 conv2.c: Unmark a test as a known failure (bug #34893)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14596
diff changeset
274 %!test
14596
ad1d7a53b1ca perform convolution properly independently of matrix orientation (bug #34893)
Sunghyun Cho <sodomau@gmail.com>
parents: 14209
diff changeset
275 %! rand ("seed", 42);
ad1d7a53b1ca perform convolution properly independently of matrix orientation (bug #34893)
Sunghyun Cho <sodomau@gmail.com>
parents: 14209
diff changeset
276 %! x = rand (100);
ad1d7a53b1ca perform convolution properly independently of matrix orientation (bug #34893)
Sunghyun Cho <sodomau@gmail.com>
parents: 14209
diff changeset
277 %! y = ones (5);
ad1d7a53b1ca perform convolution properly independently of matrix orientation (bug #34893)
Sunghyun Cho <sodomau@gmail.com>
parents: 14209
diff changeset
278 %! A = conv2 (x, y)(5:end-4,5:end-4);
ad1d7a53b1ca perform convolution properly independently of matrix orientation (bug #34893)
Sunghyun Cho <sodomau@gmail.com>
parents: 14209
diff changeset
279 %! B = conv2 (x, y, "valid");
17336
b81b9d079515 Use '##' for comments which stand alone on a line.
Rik <rik@octave.org>
parents: 17281
diff changeset
280 %! assert (B, A); # Yes, this test is for *exact* equivalence.
14596
ad1d7a53b1ca perform convolution properly independently of matrix orientation (bug #34893)
Sunghyun Cho <sodomau@gmail.com>
parents: 14209
diff changeset
281
ad1d7a53b1ca perform convolution properly independently of matrix orientation (bug #34893)
Sunghyun Cho <sodomau@gmail.com>
parents: 14209
diff changeset
282
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
283 %% Test input validation
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
284 %!error conv2 ()
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
285 %!error conv2 (1)
15241
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
286 %!error <must be 1-D vectors or 2-D matrices> conv2 (ones (2), ones (2,2,2))
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
287 %!error <SHAPE type not valid> conv2 (1,2, "NOT_A_SHAPE")
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
288 %% Test alternate calling form which should be 2 vectors and a matrix
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
289 %!error conv2 (ones (2), 1, 1)
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
290 %!error conv2 (1, ones (2), 1)
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
291 */
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
292
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14607
diff changeset
293 DEFUN (convn, args, ,
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
294 "-*- texinfo -*-\n\
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14607
diff changeset
295 @deftypefn {Built-in Function} {@var{C} =} convn (@var{A}, @var{B})\n\
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14607
diff changeset
296 @deftypefnx {Built-in Function} {@var{C} =} convn (@var{A}, @var{B}, @var{shape})\n\
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
297 Return the n-D convolution of @var{A} and @var{B}. The size of the result\n\
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
298 is determined by the optional @var{shape} argument which takes the following\n\
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
299 values\n\
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
300 \n\
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
301 @table @asis\n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15241
diff changeset
302 @item @var{shape} = @qcode{\"full\"}\n\
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
303 Return the full convolution. (default)\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10498
diff changeset
304 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15241
diff changeset
305 @item @var{shape} = @qcode{\"same\"}\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
306 Return central part of the convolution with the same size as @var{A}.\n\
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
307 The central part of the convolution begins at the indices\n\
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
308 @code{floor ([size(@var{B})/2] + 1)}.\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10498
diff changeset
309 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 15241
diff changeset
310 @item @var{shape} = @qcode{\"valid\"}\n\
11083
bb8bf77f2242 conv2.cc: style fixes; update docstrings
John W. Eaton <jwe@octave.org>
parents: 10840
diff changeset
311 Return only the parts which do not include zero-padded edges.\n\
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
312 The size of the result is @code{max (size (A) - size (B) + 1, 0)}.\n\
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
313 @end table\n\
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
314 \n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
315 @seealso{conv2, conv}\n\
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
316 @end deftypefn")
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
317 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
318 octave_value retval;
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
319 octave_value tmp;
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
320 int nargin = args.length ();
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
321 std::string shape = "full"; // default
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
322 convn_type ct;
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
323
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
324 if (nargin < 2 || nargin > 3)
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
325 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
326 print_usage ();
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
327 return retval;
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
328 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
329 else if (nargin == 3)
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
330 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
331 if (args(2).is_string ())
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
332 shape = args(2).string_value ();
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
333 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
334
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
335 if (shape == "full")
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
336 ct = convn_full;
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
337 else if (shape == "same")
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
338 ct = convn_same;
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
339 else if (shape == "valid")
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
340 ct = convn_valid;
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
341 else
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
342 {
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
343 error ("convn: SHAPE type not valid");
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
344 print_usage ();
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
345 return retval;
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
346 }
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
347
11083
bb8bf77f2242 conv2.cc: style fixes; update docstrings
John W. Eaton <jwe@octave.org>
parents: 10840
diff changeset
348 if (args(0).is_single_type () || args(1).is_single_type ())
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
349 {
11083
bb8bf77f2242 conv2.cc: style fixes; update docstrings
John W. Eaton <jwe@octave.org>
parents: 10840
diff changeset
350 if (args(0).is_complex_type () || args(1).is_complex_type ())
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
351 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
352 FloatComplexNDArray a (args(0).float_complex_array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
353 if (args(1).is_real_type ())
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
354 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
355 FloatNDArray b (args(1).float_array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
356 retval = convn (a, b, ct);
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
357 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
358 else
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
359 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
360 FloatComplexNDArray b (args(1).float_complex_array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
361 retval = convn (a, b, ct);
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
362 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
363 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
364 else
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
365 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
366 FloatNDArray a (args(0).float_array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
367 FloatNDArray b (args(1).float_array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
368 retval = convn (a, b, ct);
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
369 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
370 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
371 else
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
372 {
11083
bb8bf77f2242 conv2.cc: style fixes; update docstrings
John W. Eaton <jwe@octave.org>
parents: 10840
diff changeset
373 if (args(0).is_complex_type () || args(1).is_complex_type ())
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
374 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
375 ComplexNDArray a (args(0).complex_array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
376 if (args(1).is_real_type ())
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
377 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
378 NDArray b (args(1).array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
379 retval = convn (a, b, ct);
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
380 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
381 else
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
382 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
383 ComplexNDArray b (args(1).complex_array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
384 retval = convn (a, b, ct);
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
385 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
386 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
387 else
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
388 {
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
389 NDArray a (args(0).array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
390 NDArray b (args(1).array_value ());
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
391 retval = convn (a, b, ct);
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
392 }
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
393 }
5819
e54c11df0524 [project @ 2006-05-17 20:34:52 by jwe]
jwe
parents:
diff changeset
394
15241
2cdace1ba287 Validate conv2 inputs are 2-D matrices (Bug #37200)
Rik <rik@octave.org>
parents: 15195
diff changeset
395 return retval;
10384
978f5c94b11f initial implementation of conv2/convn in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 10371
diff changeset
396 }
14209
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
397
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
398 /*
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
399 FIXME: Need tests for convn in addition to conv2.
846273dae16b Return correct part of convolution for 'same' parameter in conv2, convn (Bug #34893).
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
400 */