46 static typename math::gsvd<T>::Type
49 if (nargout == 0 || nargout == 1)
50 return octave::math::gsvd<T>::Type::sigma_only;
52 return octave::math::gsvd<T>::Type::std;
54 return octave::math::gsvd<T>::Type::economy;
62 bool is_single =
false)
64 math::gsvd<T> result (
A,
B, gsvd_type<T> (nargout, nargin));
73 for (
int i = sigA.
rows () - 1; i >= 0; i--)
75 retval(0) = sigA.
sort ();
79 Matrix sigA = result.singular_values_A ();
80 Matrix sigB = result.singular_values_B ();
81 for (
int i = sigA.
rows () - 1; i >= 0; i--)
83 retval(0) = sigA.
sort ();
91 retval(4) = result.singular_values_B ();
95 retval(3) = result.singular_values_A ();
99 retval(2) = result.right_singular_matrix ();
102 retval(1) = result.left_singular_matrix_B ();
103 retval(0) = result.left_singular_matrix_A ();
164 int nargin = args.length ();
166 if (nargin < 2 || nargin > 3)
168 else if (nargin == 3)
171 warning (
"gsvd: economy-sized decomposition is not yet implemented, returning full decomposition");
181 error (
"gsvd: A and B must have the same number of columns");
191 error (
"gsvd: A cannot have Inf or NaN values");
193 error (
"gsvd: B cannot have Inf or NaN values");
195 retval =
do_gsvd (tmpA, tmpB, nargout, nargin,
true);
205 error (
"gsvd: A cannot have Inf or NaN values");
207 error (
"gsvd: B cannot have Inf or NaN values");
209 retval =
do_gsvd (ctmpA, ctmpB, nargout, nargin,
true);
212 error (
"gsvd: A and B must be real or complex matrices");
222 error (
"gsvd: A cannot have Inf or NaN values");
224 error (
"gsvd: B cannot have Inf or NaN values");
226 retval =
do_gsvd (tmpA, tmpB, nargout, nargin);
234 error (
"gsvd: A cannot have Inf or NaN values");
236 error (
"gsvd: B cannot have Inf or NaN values");
238 retval =
do_gsvd (ctmpA, ctmpB, nargout, nargin);
241 error (
"gsvd: A and B must be real or complex matrices");
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type rows(void) const
OCTARRAY_API Array< T, Alloc > sort(int dim=0, sortmode mode=ASCENDING) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API T & xelem(octave_idx_type n)
Size of the specified dimension.
OCTAVE_API bool any_element_is_inf_or_nan(void) const
OCTAVE_API bool any_element_is_inf_or_nan(void) const
OCTAVE_API bool any_element_is_inf_or_nan(void) const
OCTAVE_API bool any_element_is_inf_or_nan(void) const
OCTINTERP_API Matrix xmatrix_value(const char *fmt,...) const
OCTINTERP_API FloatMatrix xfloat_matrix_value(const char *fmt,...) const
octave_idx_type columns(void) const
OCTINTERP_API FloatComplexMatrix xfloat_complex_matrix_value(const char *fmt,...) const
OCTINTERP_API ComplexMatrix xcomplex_matrix_value(const char *fmt,...) const
bool is_single_type(void) const
bool iscomplex(void) const
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 warning(const char *fmt,...)
void error(const char *fmt,...)
static math::gsvd< T >::Type gsvd_type(int nargout, int nargin)
static octave_value_list do_gsvd(const T &A, const T &B, const octave_idx_type nargout, const octave_idx_type nargin, bool is_single=false)
F77_RET_T const F77_INT F77_CMPLX const F77_INT F77_CMPLX * B
F77_RET_T const F77_INT F77_CMPLX * A