26 #if defined (HAVE_CONFIG_H)
71 int nargin = args.length ();
73 if (nargin < 2 || nargin > 4)
76 std::string shape =
"full";
77 bool separable =
false;
82 if (args(2).is_string ())
83 shape = args(2).string_value ();
90 shape = args(3).string_value ();
93 if (args(0).ndims () > 2 || args(1).ndims () > 2)
94 error (
"conv2: A and B must be 1-D vectors or 2-D matrices");
98 else if (shape ==
"same")
100 else if (shape ==
"valid")
103 error (
"conv2: SHAPE type not valid");
110 if (! (1 == args(0).rows () || 1 == args(0).columns ())
111 || ! (1 == args(1).rows () || 1 == args(1).columns ()))
112 error (
"conv2: arguments must be vectors for separable option");
114 if (args(0).is_single_type () || args(1).is_single_type ()
115 || args(2).is_single_type ())
117 if (args(0).iscomplex () || args(1).iscomplex ()
118 || args(2).iscomplex ())
121 if (args(1).isreal () && args(2).isreal ())
125 retval =
convn (a, v1,
v2, ct);
131 retval =
convn (a, v1,
v2, ct);
139 retval =
convn (a, v1,
v2, ct);
144 if (args(0).iscomplex () || args(1).iscomplex ()
145 || args(2).iscomplex ())
148 if (args(1).isreal () && args(2).isreal ())
152 retval =
convn (a, v1,
v2, ct);
158 retval =
convn (a, v1,
v2, ct);
165 Matrix a (args(2).matrix_value ());
166 retval =
convn (a, v1,
v2, ct);
172 if (args(0).is_single_type () || args(1).is_single_type ())
174 if (args(0).iscomplex () || args(1).iscomplex ())
177 if (args(1).isreal ())
180 retval =
convn (a, b, ct);
185 retval =
convn (a, b, ct);
192 retval =
convn (a, b, ct);
197 if (args(0).iscomplex () || args(1).iscomplex ())
200 if (args(1).isreal ())
202 Matrix b (args(1).matrix_value ());
203 retval =
convn (a, b, ct);
208 retval =
convn (a, b, ct);
213 Matrix a (args(0).matrix_value ());
214 Matrix b (args(1).matrix_value ());
215 retval =
convn (a, b, ct);
331 int nargin = args.length ();
333 if (nargin < 2 || nargin > 3)
336 std::string shape =
"full";
340 shape = args(2).xstring_value (
"convn: SHAPE must be a string");
344 else if (shape ==
"same")
346 else if (shape ==
"valid")
349 error (
"convn: SHAPE type not valid");
353 if (args(0).is_single_type () || args(1).is_single_type ())
355 if (args(0).iscomplex () || args(1).iscomplex ())
358 if (args(1).isreal ())
361 retval =
convn (a, b, ct);
366 retval =
convn (a, b, ct);
373 retval =
convn (a, b, ct);
378 if (args(0).iscomplex () || args(1).iscomplex ())
381 if (args(1).isreal ())
383 NDArray b (args(1).array_value ());
384 retval =
convn (a, b, ct);
389 retval =
convn (a, b, ct);
394 NDArray a (args(0).array_value ());
395 NDArray b (args(1).array_value ());
396 retval =
convn (a, b, ct);
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
NDArray convn(const NDArray &a, const NDArray &b, convn_type ct)
const octave_char_matrix & v2