39 DEFUN (inv, args, nargout,
41 @deftypefn {Built-in Function} {@var{x} =} inv (@var{A})\n\
42 @deftypefnx {Built-in Function} {[@var{x}, @var{rcond}] =} inv (@var{A})\n\
43 Compute the inverse of the square matrix @var{A}.\n\
45 Return an estimate of the reciprocal condition number if requested,\n\
46 otherwise warn of an ill-conditioned matrix if the reciprocal condition\n\
49 In general it is best to avoid calculating the inverse of a matrix directly.\n\
50 For example, it is both faster and more accurate to solve systems of\n\
51 equations (@var{A}*@math{x} = @math{b}) with\n\
52 @code{@var{y} = @var{A} \\ @math{b}}, rather than\n\
53 @code{@var{y} = inv (@var{A}) * @math{b}}.\n\
55 If called with a sparse matrix, then in general @var{x} will be a full\n\
56 matrix requiring significantly more storage. Avoid forming the inverse of a\n\
57 sparse matrix if possible.\n\
58 @seealso{ldivide, rdivide}\n\
63 int nargin = args.
length ();
76 int arg_is_empty =
empty_arg (
"inverse", nr, nc);
80 else if (arg_is_empty > 0)
144 result = m.
inverse (mattyp, info, frcond, 1);
145 args(0).matrix_type (mattyp);
154 result = m.
inverse (mattyp, info, frcond, 1);
155 args(0).matrix_type (mattyp);
169 result = m.
inverse (mattyp, info, rcond, 1);
170 args(0).matrix_type (mattyp);
179 result = m.
inverse (mattyp, info, rcond, 1);
180 args(0).matrix_type (mattyp);
192 result = m.
inverse (mattyp, info, rcond, 1);
193 args(0).matrix_type (mattyp);
202 result = m.
inverse (mattyp, info, rcond, 1);
203 args(0).matrix_type (mattyp);
218 bool rcond_plus_one_eq_one =
false;
222 volatile float xrcond = frcond;
223 rcond_plus_one_eq_one = xrcond + 1.0F == 1.0F;
227 volatile double xrcond = rcond;
228 rcond_plus_one_eq_one = xrcond + 1.0 == 1.0;
231 if (nargout < 2 && (info == -1 || rcond_plus_one_eq_one))
261 DEFUN (inverse, args, nargout,
263 @deftypefn {Built-in Function} {@var{x} =} inverse (@var{A})\n\
264 @deftypefnx {Built-in Function} {[@var{x}, @var{rcond}] =} inverse (@var{A})\n\
265 Compute the inverse of the square matrix @var{A}.\n\
267 This is an alias for @code{inv}.\n\
271 return Finv (args, nargout);
FloatComplexDiagMatrix float_complex_diag_matrix_value(bool force=false) const
bool is_real_type(void) const
void gripe_wrong_type_arg(const char *name, const char *s, bool is_error)
OCTAVE_EXPORT octave_value_list Finv(const octave_value_list &args, int nargout)
octave_idx_type rows(void) const
ComplexMatrix inverse(void) const
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
OCTINTERP_API void print_usage(void)
SparseComplexMatrix inverse(void) const
octave_idx_type length(void) const
SparseMatrix inverse(void) const
#define DEFUN(name, args_name, nargout_name, doc)
bool is_perm_matrix(void) const
int empty_arg(const char *, octave_idx_type nr, octave_idx_type nc)
DiagMatrix inverse(void) const
FloatComplexMatrix inverse(void) const
void gripe_square_matrix_required(const char *name)
ComplexDiagMatrix complex_diag_matrix_value(bool force=false) const
octave_idx_type columns(void) const
PermMatrix inverse(void) const
bool is_sparse_type(void) const
FloatDiagMatrix float_diag_matrix_value(bool force=false) const
bool is_complex_type(void) const
void gripe_singular_matrix(double rcond)
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
Matrix matrix_value(bool frc_str_conv=false) const
DiagMatrix diag_matrix_value(bool force=false) const
FloatDiagMatrix inverse(void) const
FloatMatrix inverse(void) const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
PermMatrix perm_matrix_value(void) const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
ComplexDiagMatrix inverse(octave_idx_type &info) const
bool is_single_type(void) const
FloatComplexDiagMatrix inverse(octave_idx_type &info) const
bool is_diag_matrix(void) const
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
Matrix inverse(void) const