Mercurial > hg > octave-nkf
comparison src/DLD-FUNCTIONS/conv2.cc @ 11553:01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Use same variable names in error() strings and in documentation.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 16 Jan 2011 22:13:23 -0800 |
parents | fd0a3ac60b0e |
children | cf5ebc0e47e4 |
comparison
equal
deleted
inserted
replaced
11552:6b6e9051ecb8 | 11553:01f703952eff |
---|---|
52 */ | 52 */ |
53 | 53 |
54 | 54 |
55 DEFUN_DLD (conv2, args, , | 55 DEFUN_DLD (conv2, args, , |
56 "-*- texinfo -*-\n\ | 56 "-*- texinfo -*-\n\ |
57 @deftypefn {Loadable Function} {} conv2 (@var{a}, @var{b})\n\ | 57 @deftypefn {Loadable Function} {} conv2 (@var{A}, @var{B})\n\ |
58 @deftypefnx {Loadable Function} {} conv2 (@var{v1}, @var{v2}, @var{m})\n\ | 58 @deftypefnx {Loadable Function} {} conv2 (@var{v1}, @var{v2}, @var{m})\n\ |
59 @deftypefnx {Loadable Function} {} conv2 (@dots{}, @var{shape})\n\ | 59 @deftypefnx {Loadable Function} {} conv2 (@dots{}, @var{shape})\n\ |
60 Return the 2-D convolution of @var{a} and @var{b}. The size of the result\n\ | 60 Return the 2-D convolution of @var{A} and @var{B}. The size of the result\n\ |
61 is determined by the optional @var{shape} argument which takes the following\n\ | 61 is determined by the optional @var{shape} argument which takes the following\n\ |
62 values\n\ | 62 values\n\ |
63 \n\ | 63 \n\ |
64 @table @asis\n\ | 64 @table @asis\n\ |
65 @item @var{shape} = \"full\"\n\ | 65 @item @var{shape} = \"full\"\n\ |
66 Return the full convolution. (default)\n\ | 66 Return the full convolution. (default)\n\ |
67 \n\ | 67 \n\ |
68 @item @var{shape} = \"same\"\n\ | 68 @item @var{shape} = \"same\"\n\ |
69 Return the central part of the convolution with the same size as @var{a}.\n\ | 69 Return the central part of the convolution with the same size as @var{A}.\n\ |
70 \n\ | 70 \n\ |
71 @item @var{shape} = \"valid\"\n\ | 71 @item @var{shape} = \"valid\"\n\ |
72 Return only the parts which do not include zero-padded edges.\n\ | 72 Return only the parts which do not include zero-padded edges.\n\ |
73 @end table\n\ | 73 @end table\n\ |
74 \n\ | 74 \n\ |
75 When the third argument\n\ | 75 When the third argument is a matrix, return the convolution of the matrix\n\ |
76 is a matrix, return the convolution of the matrix @var{m} by the vector\n\ | 76 @var{m} by the vector @var{v1} in the column direction and by the vector\n\ |
77 @var{v1} in the column direction and by vector @var{v2} in the row direction\n\ | 77 @var{v2} in the row direction\n\ |
78 @seealso{conv, fftconv}\n\ | 78 @seealso{conv, convn}\n\ |
79 @end deftypefn") | 79 @end deftypefn") |
80 { | 80 { |
81 octave_value retval; | 81 octave_value retval; |
82 octave_value tmp; | 82 octave_value tmp; |
83 int nargin = args.length (); | 83 int nargin = args.length (); |
109 ct = convn_same; | 109 ct = convn_same; |
110 else if (shape == "valid") | 110 else if (shape == "valid") |
111 ct = convn_valid; | 111 ct = convn_valid; |
112 else | 112 else |
113 { | 113 { |
114 error ("conv2: shape type not valid"); | 114 error ("conv2: SHAPE type not valid"); |
115 print_usage (); | 115 print_usage (); |
116 return retval; | 116 return retval; |
117 } | 117 } |
118 | 118 |
119 if (separable) | 119 if (separable) |
237 return retval; | 237 return retval; |
238 } | 238 } |
239 | 239 |
240 DEFUN_DLD (convn, args, , | 240 DEFUN_DLD (convn, args, , |
241 "-*- texinfo -*-\n\ | 241 "-*- texinfo -*-\n\ |
242 @deftypefn {Loadable Function} {y =} conv2 (@var{a}, @var{b}, @var{shape})\n\ | 242 @deftypefn {Loadable Function} {@var{C} =} convn (@var{A}, @var{B}, @var{shape})\n\ |
243 Return the n-D convolution of @var{a} and @var{b} where the size\n\ | 243 Return the n-D convolution of @var{A} and @var{B} where the size\n\ |
244 of @var{c} is given by\n\ | 244 of @var{C} is given by\n\ |
245 \n\ | 245 \n\ |
246 @table @asis\n\ | 246 @table @asis\n\ |
247 @item @var{shape} = \"full\"\n\ | 247 @item @var{shape} = \"full\"\n\ |
248 Return the full convolution.\n\ | 248 Return the full convolution.\n\ |
249 \n\ | 249 \n\ |
250 @item @var{shape} = \"same\"\n\ | 250 @item @var{shape} = \"same\"\n\ |
251 Return central part of the convolution with the same size as @var{a}.\n\ | 251 Return central part of the convolution with the same size as @var{A}.\n\ |
252 \n\ | 252 \n\ |
253 @item @var{shape} = \"valid\"\n\ | 253 @item @var{shape} = \"valid\"\n\ |
254 Return only the parts which do not include zero-padded edges.\n\ | 254 Return only the parts which do not include zero-padded edges.\n\ |
255 @end table\n\ | 255 @end table\n\ |
256 \n\ | 256 \n\ |
257 By default @var{shape} is @samp{\"full\"}.\n\ | 257 By default @var{shape} is @samp{\"full\"}.\n\ |
258 @seealso{conv2, conv}\n\ | |
258 @end deftypefn") | 259 @end deftypefn") |
259 { | 260 { |
260 octave_value retval; | 261 octave_value retval; |
261 octave_value tmp; | 262 octave_value tmp; |
262 int nargin = args.length (); | 263 int nargin = args.length (); |
283 ct = convn_same; | 284 ct = convn_same; |
284 else if (shape == "valid") | 285 else if (shape == "valid") |
285 ct = convn_valid; | 286 ct = convn_valid; |
286 else | 287 else |
287 { | 288 { |
288 error ("convn: shape type not valid"); | 289 error ("convn: SHAPE type not valid"); |
289 print_usage (); | 290 print_usage (); |
290 return retval; | 291 return retval; |
291 } | 292 } |
292 | 293 |
293 if (args(0).is_single_type () || args(1).is_single_type ()) | 294 if (args(0).is_single_type () || args(1).is_single_type ()) |