25 #if defined (HAVE_CONFIG_H)
38 template <
typename MT>
43 if (R.is_square () && fact.
regular ())
53 return ((nargout == 0 || nargout == 1)
220 if (nargin < 1 || nargin > 3)
227 bool economy =
false;
228 bool is_cmplx =
false;
237 if (
args(nargin-1).is_scalar_type ())
239 int val =
args(nargin-1).int_value ();
243 have_b = (nargin > 2);
245 else if (nargin == 3)
248 else if (
args(nargin-1).is_string ())
250 if (
args(nargin-1).string_value () ==
"vector")
252 else if (
args(nargin-1).string_value () !=
"matrix")
253 error (
"qr: type for P must be 'matrix' or 'vector', not %s",
254 args(nargin-1).string_value ().c_str ());
255 have_b = (nargin > 2);
257 else if (!
args(nargin-1).is_matrix_type ())
259 else if (nargin == 3)
262 if (have_b &&
args(1).is_complex_type ())
269 error (
"qr: Permutation output is not supported for sparse input");
277 retval =
ovl (q.C (
args(1).complex_matrix_value ()),
280 warning (
"qr: non minimum norm solution for under-determined "
284 retval =
ovl (q.Q (), q.R (economy));
286 retval =
ovl (q.R (economy));
294 retval =
ovl (q.C (
args(1).matrix_value ()), q.R (economy));
296 warning (
"qr: non minimum norm solution for under-determined "
300 retval =
ovl (q.Q (), q.R (economy));
302 retval =
ovl (q.R (economy));
322 retval =
ovl (fact.
R ());
334 *
args(1).float_complex_matrix_value ();
337 *
args(1).float_matrix_value ();
367 retval =
ovl (fact.
R ());
377 *
args(1).float_complex_matrix_value ();
407 retval =
ovl (fact.
R ());
419 *
args(1).complex_matrix_value ();
422 *
args(1).matrix_value ();
451 retval =
ovl (fact.
R ());
461 *
args(1).complex_matrix_value ();
862 bool allow_ecf =
false)
868 && (m == k || (allow_ecf && k == n && k < m)));
872 bool check_index (
const octave_value&
i,
bool vector_allowed =
false)
898 if (
args.length () != 4)
910 if (! check_qr_dims (argq, argr,
true))
911 error (
"qrupdate: Q and R dimensions don't match");
1068 if (nargin < 4 || nargin > 5)
1078 || (nargin > 4 && !
args(4).is_string ()))
1082 bool col = (orient ==
"col");
1084 if (! col && orient !=
"row")
1085 error (
"qrinsert: ORIENT must be \"col\" or \"row\"");
1087 if (! check_qr_dims (argq, argr, col) || (! col && argx.
rows () != 1))
1088 error (
"qrinsert: dimension mismatch");
1090 if (! check_index (argj, col))
1091 error (
"qrinsert: invalid index J");
1112 fact.insert_col (x, j-one);
1114 fact.insert_row (x.
row (0), j(0)-one);
1127 fact.insert_col (x, j-one);
1129 fact.insert_row (x.
row (0), j(0)-one);
1150 fact.insert_col (x, j-one);
1152 fact.insert_row (x.
row (0), j(0)-one);
1165 fact.insert_col (x, j-one);
1167 fact.insert_row (x.
row (0), j(0)-one);
1262 int nargin =
args.length ();
1264 if (nargin < 3 || nargin > 4)
1272 || (nargin > 3 && !
args(3).is_string ()))
1276 bool col = orient ==
"col";
1278 if (! col && orient !=
"row")
1279 error (
"qrdelete: ORIENT must be \"col\" or \"row\"");
1281 if (! check_qr_dims (argq, argr, col))
1282 error (
"qrdelete: dimension mismatch");
1285 if (! check_index (argj, col))
1286 error (
"qrdelete: invalid index J");
1303 fact.delete_col (j-one);
1305 fact.delete_row (j(0)-one);
1317 fact.delete_col (j-one);
1319 fact.delete_row (j(0)-one);
1337 fact.delete_col (j-one);
1339 fact.delete_row (j(0)-one);
1351 fact.delete_col (j-one);
1353 fact.delete_row (j(0)-one);
1495 if (
args.length () != 4)
1506 if (! check_qr_dims (argq, argr,
true))
1507 error (
"qrshift: dimensions mismatch");
1512 if (! check_index (argi) || ! check_index (argj))
1513 error (
"qrshift: invalid index I or J");
1527 fact.shift_cols (i-1, j-1);
1537 fact.shift_cols (i-1, j-1);
1552 fact.shift_cols (i-1, j-1);
1562 fact.shift_cols (i-1, j-1);
FloatComplexMatrix transpose(void) const
bool is_real_type(void) const
octave_idx_type rows(void) const
static octave::math::qr< T >::type qr_type(int nargin, int nargout)
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
identity matrix If supplied two scalar respectively For allows like xample val
bool is_scalar_type(void) const
FloatMatrix transpose(void) const
bool is_numeric_type(void) const
static octave_value get_qr_r(const octave::math::qr< MT > &fact)
void error(const char *fmt,...)
RowVector row(octave_idx_type i) const
ComplexRowVector row(octave_idx_type i) const
FloatRowVector row(octave_idx_type i) const
octave_idx_type idx_type_value(bool req_int=false, bool frc_str_conv=false) const
octave_idx_type columns(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)
bool is_sparse_type(void) const
nd deftypefn *octave_map m
Array< octave_idx_type > octave_idx_type_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_complex_type(void) const
Matrix transpose(void) const
ComplexMatrix transpose(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
Matrix matrix_value(bool frc_str_conv=false) const
void err_wrong_type_arg(const char *name, const char *s)
void warning(const char *fmt,...)
=val(i)}if ode{val(i)}occurs in table i
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
#define DEFUN_DLD(name, args_name, nargout_name, doc)
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
bool is_single_type(void) const
FloatComplexRowVector row(octave_idx_type i) 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
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &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 F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
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
bool is_integer_type(void) const