46 static typename math::gsvd<T>::Type
47 gsvd_type (
int nargout,
int nargin)
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;
60 do_gsvd (
const T&
A,
const T&
B,
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");
519 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type rows() const
Array< T, Alloc > sort(int dim=0, sortmode mode=ASCENDING) const
Size of the specified dimension.
T & xelem(octave_idx_type n)
Size of the specified dimension.
bool any_element_is_inf_or_nan() const
bool any_element_is_inf_or_nan() const
bool any_element_is_inf_or_nan() const
bool any_element_is_inf_or_nan() const
FloatMatrix xfloat_matrix_value(const char *fmt,...) const
ComplexMatrix xcomplex_matrix_value(const char *fmt,...) const
bool is_single_type() const
FloatComplexMatrix xfloat_complex_matrix_value(const char *fmt,...) const
Matrix xmatrix_value(const char *fmt,...) const
octave_idx_type columns() const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
void() error(const char *fmt,...)
F77_RET_T const F77_INT F77_CMPLX const F77_INT F77_CMPLX * B
F77_RET_T const F77_INT F77_CMPLX * A