25 #if defined (HAVE_CONFIG_H) 43 template <
typename MT>
48 if (R.issquare () && fact.
regular ())
267 int nargin = args.length ();
276 bool economy =
false;
277 bool is_cmplx =
false;
286 if (args(
nargin-1).is_scalar_type ())
297 else if (args(
nargin-1).is_string ())
302 else if (
str !=
"matrix")
303 error (
"qr: type for P must be 'matrix' or 'vector', not %s",
307 else if (! args(
nargin-1).is_matrix_type ())
312 if (have_b && args(1).iscomplex ())
319 error (
"qr: Permutation output is not supported for sparse input");
327 retval =
ovl (q.C (args(1).complex_matrix_value ()),
330 warning (
"qr: non minimum norm solution for under-determined " 344 retval =
ovl (q.C (args(1).matrix_value ()), q.R (economy));
346 warning (
"qr: non minimum norm solution for under-determined " 362 = qr_type<FloatMatrix> (
nargout, economy);
384 * args(1).float_complex_matrix_value ();
387 * args(1).float_matrix_value ();
396 if (economy || vector_p)
407 = qr_type<FloatComplexMatrix> (
nargout, economy);
427 * args(1).float_complex_matrix_value ();
434 if (economy || vector_p)
448 = qr_type<Matrix> (
nargout, economy);
470 * args(1).complex_matrix_value ();
473 * args(1).matrix_value ();
481 if (economy || vector_p)
492 = qr_type<ComplexMatrix> (
nargout, economy);
512 * args(1).complex_matrix_value ();
519 if (economy || vector_p)
913 bool allow_ecf =
false)
919 && (m ==
k || (allow_ecf &&
k == n &&
k < m)));
923 bool check_index (
const octave_value&
i,
bool vector_allowed =
false)
925 return ((
i.isreal () ||
i.isinteger ())
926 && (
i.is_scalar_type () || vector_allowed));
951 if (args.length () != 4)
963 if (! check_qr_dims (argq, argr,
true))
964 error (
"qrupdate: Q and R dimensions don't match");
1122 int nargin = args.length ();
1134 || (
nargin > 4 && ! args(4).is_string ()))
1138 bool col = (orient ==
"col");
1140 if (! col && orient !=
"row")
1141 error (R
"(qrinsert: ORIENT must be "col" or "row")"); 1143 if (! check_qr_dims (argq, argr, col) || (! col && argx.
rows () != 1))
1144 error (
"qrinsert: dimension mismatch");
1146 if (! check_index (argj, col))
1147 error (
"qrinsert: invalid index J");
1168 fact.insert_col (
x, j-one);
1170 fact.insert_row (
x.row (0), j(0)-one);
1183 fact.insert_col (
x, j-one);
1185 fact.insert_row (
x.row (0), j(0)-one);
1206 fact.insert_col (
x, j-one);
1208 fact.insert_row (
x.row (0), j(0)-one);
1221 fact.insert_col (
x, j-one);
1223 fact.insert_row (
x.row (0), j(0)-one);
1320 int nargin = args.length ();
1330 || (
nargin > 3 && ! args(3).is_string ()))
1334 bool col = orient ==
"col";
1336 if (! col && orient !=
"row")
1337 error (R
"(qrdelete: ORIENT must be "col" or "row")"); 1339 if (! check_qr_dims (argq, argr, col))
1340 error (
"qrdelete: dimension mismatch");
1343 if (! check_index (argj, col))
1344 error (
"qrdelete: invalid index J");
1361 fact.delete_col (j-one);
1363 fact.delete_row (j(0)-one);
1375 fact.delete_col (j-one);
1377 fact.delete_row (j(0)-one);
1395 fact.delete_col (j-one);
1397 fact.delete_row (j(0)-one);
1409 fact.delete_col (j-one);
1411 fact.delete_row (j(0)-one);
1555 if (args.length () != 4)
1566 if (! check_qr_dims (argq, argr,
true))
1567 error (
"qrshift: dimensions mismatch");
1572 if (! check_index (argi) || ! check_index (argj))
1573 error (
"qrshift: invalid index I or J");
1587 fact.shift_cols (
i-1, j-1);
1597 fact.shift_cols (
i-1, j-1);
1612 fact.shift_cols (
i-1, j-1);
1622 fact.shift_cols (
i-1, j-1);
FloatComplexMatrix transpose(void) const
octave_idx_type idx_type_value(bool req_int=false, bool frc_str_conv=false) const
OCTINTERP_API void print_usage(void)
identity matrix If supplied two scalar respectively For allows like xample val
static octave_value get_qr_r(const octave::math::qr< MT > &fact)
void error(const char *fmt,...)
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
ComplexMatrix transpose(void) const
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
Matrix transpose(void) const
ComplexColumnVector conj(const ComplexColumnVector &a)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
octave_idx_type columns(void) const
static octave::math::qr< T >::type qr_type(int nargout, bool economy)
bool is_single_type(void) const
octave_idx_type rows(void) const
bool issparse(void) const
Array< octave_idx_type > octave_idx_type_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
FloatMatrix transpose(void) const
void err_wrong_type_arg(const char *name, const char *s)
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
void warning(const char *fmt,...)
F77_RET_T const F77_INT const F77_INT const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE * Q
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
bool iscomplex(void) const
#define DEFUN_DLD(name, args_name, nargout_name, doc)
Macro to define an at run time dynamically loadable builtin function.
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
bool isnumeric(void) const
Matrix matrix_value(bool frc_str_conv=false) const
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x