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);
339 int nargin = args.length ();
341 if (nargin < 2 || nargin > 3)
344 std::string shape =
"full";
348 shape = args(2).xstring_value (
"convn: SHAPE must be a string");
352 else if (shape ==
"same")
354 else if (shape ==
"valid")
357 error (
"convn: SHAPE type not valid");
361 if (args(0).is_single_type () || args(1).is_single_type ())
363 if (args(0).iscomplex () || args(1).iscomplex ())
366 if (args(1).isreal ())
369 retval =
convn (a, b, ct);
374 retval =
convn (a, b, ct);
381 retval =
convn (a, b, ct);
386 if (args(0).iscomplex () || args(1).iscomplex ())
389 if (args(1).isreal ())
391 NDArray b (args(1).array_value ());
392 retval =
convn (a, b, ct);
397 retval =
convn (a, b, ct);
402 NDArray a (args(0).array_value ());
403 NDArray b (args(1).array_value ());
404 retval =
convn (a, b, ct);
602 OCTAVE_END_NAMESPACE(
octave)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#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