177 int nargin = args.
length ();
179 if (nargin < 1 || nargin > 2 || nargout > 3)
184 if (arg.
ndims () != 2)
185 error (
"svd: A must be a 2-D matrix");
198 error (
"svd: cannot take SVD of matrix containing Inf or NaN values");
200 math::svd<FloatMatrix> result
202 svd_type<FloatMatrix> (nargin, nargout, args, tmp),
203 svd_driver<FloatMatrix> ());
207 if (nargout == 0 || nargout == 1)
209 else if (nargout == 2)
210 retval =
ovl (result.left_singular_matrix (),
213 retval =
ovl (result.left_singular_matrix (),
215 result.right_singular_matrix ());
222 error (
"svd: cannot take SVD of matrix containing Inf or NaN values");
224 math::svd<FloatComplexMatrix> result
226 svd_type<FloatComplexMatrix> (nargin, nargout, args, ctmp),
227 svd_driver<FloatComplexMatrix> ());
231 if (nargout == 0 || nargout == 1)
233 else if (nargout == 2)
234 retval =
ovl (result.left_singular_matrix (),
237 retval =
ovl (result.left_singular_matrix (),
239 result.right_singular_matrix ());
249 error (
"svd: cannot take SVD of matrix containing Inf or NaN values");
251 math::svd<Matrix> result
253 svd_type<Matrix> (nargin, nargout, args, tmp),
254 svd_driver<Matrix> ());
258 if (nargout == 0 || nargout == 1)
260 else if (nargout == 2)
261 retval =
ovl (result.left_singular_matrix (),
264 retval =
ovl (result.left_singular_matrix (),
266 result.right_singular_matrix ());
273 error (
"svd: cannot take SVD of matrix containing Inf or NaN values");
275 math::svd<ComplexMatrix> result
277 svd_type<ComplexMatrix> (nargin, nargout, args, ctmp),
278 svd_driver<ComplexMatrix> ());
282 if (nargout == 0 || nargout == 1)
284 else if (nargout == 2)
285 retval =
ovl (result.left_singular_matrix (),
288 retval =
ovl (result.left_singular_matrix (),
290 result.right_singular_matrix ());
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.