26 #if defined (HAVE_CONFIG_H)
44 template <
typename CHOLT>
51 template <
typename CHOLT>
59 template <
typename CHOLT>
152 int nargin = args.length ();
154 if (nargin < 1 || nargin > 3 || nargout > 3)
156 if (nargout > 2 && ! args(0).issparse ())
157 error (
"chol: using three output arguments, matrix A must be sparse");
165 std::string tmp = args(
n++).xstring_value (
"chol: optional arguments must be strings");
174 error (R
"(chol: optional argument must be one of "vector", "lower", or "upper")");
186 bool natural = (nargout != 3);
187 bool force = nargout > 1;
203 if (nargout >= 2 || info == 0)
212 error (
"chol: input matrix must be positive definite");
228 if (nargout >= 2 || info == 0)
237 error (
"chol: input matrix must be positive definite");
245 error (R
"(chol: A must be sparse for the "vector" option)");
254 if (nargout == 2 || info == 0)
257 error (
"chol: input matrix must be positive definite");
267 if (nargout == 2 || info == 0)
270 error (
"chol: input matrix must be positive definite");
278 error (R
"(chol: A must be sparse for the "vector" option)");
287 if (nargout == 2 || info == 0)
290 error (
"chol: input matrix must be positive definite");
300 if (nargout == 2 || info == 0)
303 error (
"chol: input matrix must be positive definite");
357 DEFUN (cholinv, args, ,
365 if (args.length () != 1)
374 if (nr == 0 || nc == 0)
391 error (
"cholinv: A must be positive definite");
402 error (
"cholinv: A must be positive definite");
418 error (
"cholinv: A must be positive definite");
429 error (
"cholinv: A must be positive definite");
445 error (
"cholinv: A must be positive definite");
456 error (
"cholinv: A must be positive definite");
493 if (args.length () != 1)
503 if (nr == 0 || nc == 0)
593 DEFUN (cholupdate, args, nargout,
625 int nargin = args.length ();
627 if (nargin < 2 || nargin > 3)
634 || (nargin > 2 && ! args(2).is_string ()))
641 std::string op = (nargin < 3) ?
"+" : args(2).string_value ();
643 bool down = (op ==
"-");
645 if (! down && op !=
"+")
646 error (R
"(cholupdate: OP must be "+" or "-")");
649 error (
"cholupdate: dimension mismatch between R and U");
727 error (
"cholupdate: downdate violates positiveness");
729 error (
"cholupdate: singular matrix");
796 DEFUN (cholinsert, args, nargout,
823 if (args.length () != 3)
838 error (
"cholinsert: dimension mismatch between R and U");
840 if (j < 1 || j >
n+1)
841 error (
"cholinsert: index J out of range");
905 error (
"cholinsert: insertion violates positiveness");
907 error (
"cholinsert: singular matrix");
909 error (
"cholinsert: diagonal element must be real");
1051 DEFUN (choldelete, args, ,
1064 if (args.length () != 2)
1080 error (
"choldelete: index J out of range");
1176 DEFUN (cholshift, args, ,
1193 if (args.length () != 3)
1211 if (j < 0 || j >
n+1 || i < 0 || i >
n+1)
1212 error (
"cholshift: index I or J is out of range");
octave_idx_type insert_sym(const VT &u, octave_idx_type j)
octave_idx_type downdate(const VT &u)
void shift_sym(octave_idx_type i, octave_idx_type j)
void delete_sym(octave_idx_type j)
SparseMatrix Q(void) const
RowVector perm(void) const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
bool issparse(void) const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
octave_idx_type rows(void) const
bool isnumeric(void) const
FloatColumnVector float_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type columns(void) const
double scalar_value(bool frc_str_conv=false) const
FloatComplexColumnVector float_complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
ComplexColumnVector complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_single_type(void) const
bool is_real_scalar(void) const
ColumnVector column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
Matrix matrix_value(bool frc_str_conv=false) const
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
bool iscomplex(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
void err_square_matrix_required(const char *fcn, const char *name)
void err_wrong_type_arg(const char *name, const char *s)
static octave_value get_chol_r(const CHOLT &fact)
static octave_value get_chol_l(const CHOLT &fact)
static octave_value get_chol(const CHOLT &fact)
bool strcmpi(const T &str_a, const T &str_b)
True if strings are the same, ignoring case.
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.