23 #if defined (HAVE_CONFIG_H) 122 int nargin = args.length ();
127 bool autocomp =
true;
157 args(0).sparse_complex_matrix_value ();
160 args(0).matrix_type (mattyp);
172 args(0).matrix_type (mattyp);
176 int typ = mattyp.
type ();
215 std::string str_typ = args(1).xstring_value (
"matrix_type: TYPE must be a string");
225 str_typ.begin (), tolower);
227 if (str_typ ==
"diagonal")
229 if (str_typ ==
"permuted diagonal")
231 else if (str_typ ==
"upper")
233 else if (str_typ ==
"lower")
235 else if (str_typ ==
"banded" 236 || str_typ ==
"banded positive definite")
239 error (
"matrix_type: banded matrix type requires 4 arguments");
241 nl = args(2).xnint_value (
"matrix_type: band size NL, NU must be integers");
242 nu = args(3).xnint_value (
"matrix_type: band size NL, NU must be integers");
244 if (nl == 1 && nu == 1)
249 if (str_typ ==
"banded positive definite")
252 else if (str_typ ==
"positive definite")
257 else if (str_typ ==
"singular")
259 else if (str_typ ==
"full")
261 else if (str_typ ==
"unknown")
264 error (
"matrix_type: Unknown matrix type %s", str_typ.c_str ());
267 && (str_typ ==
"upper" || str_typ ==
"lower"))
269 const ColumnVector perm = args(2).vector_value (
"matrix_type: Invalid permutation vector PERM");
275 error (
"matrix_type: Invalid permutation vector PERM");
280 p[
i] = static_cast<octave_idx_type> (perm (
i)) - 1;
285 && str_typ !=
"banded positive definite" 286 && str_typ !=
"banded")
287 error (
"matrix_type: Invalid number of arguments");
310 if (args(0).is_single_type ())
313 m = args(0).float_complex_matrix_value ();
316 args(0).matrix_type (mattyp);
323 args(0).matrix_type (mattyp);
333 if (args(0).is_single_type ())
338 args(0).matrix_type (mattyp);
342 Matrix m = args(0).matrix_value ();
345 args(0).matrix_type (mattyp);
350 int typ = mattyp.
type ();
377 std::string str_typ = args(1).xstring_value (
"matrix_type: TYPE must be a string");
384 str_typ.begin (), tolower);
386 if (str_typ ==
"upper")
388 else if (str_typ ==
"lower")
390 else if (str_typ ==
"positive definite")
395 else if (str_typ ==
"singular")
397 else if (str_typ ==
"full")
399 else if (str_typ ==
"unknown")
402 error (
"matrix_type: Unknown matrix type %s", str_typ.c_str ());
404 if (
nargin == 3 && (str_typ ==
"upper" || str_typ ==
"lower"))
406 const ColumnVector perm = args(2).vector_value (
"matrix_type: Invalid permutation vector PERM");
412 error (
"matrix_type: Invalid permutation vector PERM");
417 p[
i] = static_cast<octave_idx_type> (perm (
i)) - 1;
422 error (
"matrix_type: Invalid number of arguments");
void mark_as_lower_triangular(void)
void mark_as_diagonal(void)
std::string string_value(bool force=false) const
OCTINTERP_API void print_usage(void)
void mark_as_symmetric(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void mark_as_permuted_diagonal(void)
void error(const char *fmt,...)
bool is_unknown(void) const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
int type(bool quiet=true)
octave_idx_type columns(void) const
bool is_single_type(void) const
void mark_as_permuted(const octave_idx_type np, const octave_idx_type *p)
void mark_as_upper_triangular(void)
octave_idx_type rows(void) const
bool issparse(void) const
void mark_as_rectangular(void)
void invalidate_type(void)
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
MatrixType matrix_type(void) const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
ColumnVector transform(const Matrix &m, double x, double y, double z)
bool iscomplex(void) const
bool is_string(void) const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
octave_idx_type numel(void) const
Number of elements in the array.
Vector representing the dimensions (size) of an Array.
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
void mark_as_tridiagonal(void)
void mark_as_banded(const octave_idx_type ku, const octave_idx_type kl)
bool is_scalar_type(void) const
Matrix matrix_value(bool frc_str_conv=false) const