Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include "defun-dld.h"
00028 #include "error.h"
00029 #include "gripes.h"
00030 #include "oct-obj.h"
00031 #include "utils.h"
00032
00033 DEFUN_DLD (rcond, args, ,
00034 "-*- texinfo -*-\n\
00035 @deftypefn {Loadable Function} {@var{c} =} rcond (@var{A})\n\
00036 Compute the 1-norm estimate of the reciprocal condition number as returned\n\
00037 by @sc{lapack}. If the matrix is well-conditioned then @var{c} will be near\n\
00038 1 and if the matrix is poorly conditioned it will be close to zero.\n\
00039 \n\
00040 The matrix @var{A} must not be sparse. If the matrix is sparse then\n\
00041 @code{condest (@var{A})} or @code{rcond (full (@var{A}))} should be used\n\
00042 instead.\n\
00043 @seealso{cond, condest}\n\
00044 @end deftypefn")
00045 {
00046 octave_value retval;
00047
00048 int nargin = args.length ();
00049
00050 if (nargin != 1)
00051 print_usage ();
00052 else if (args(0).is_sparse_type ())
00053 error ("rcond: for sparse matrices use 'rcond (full (a))' or 'condest (a)' instead");
00054 else if (args(0).is_single_type ())
00055 {
00056 if (args(0).is_complex_type ())
00057 {
00058 FloatComplexMatrix m = args(0).float_complex_matrix_value ();
00059 MatrixType mattyp;
00060 retval = m.rcond (mattyp);
00061 args(0).matrix_type (mattyp);
00062 }
00063 else
00064 {
00065 FloatMatrix m = args(0).float_matrix_value ();
00066 MatrixType mattyp;
00067 retval = m.rcond (mattyp);
00068 args(0).matrix_type (mattyp);
00069 }
00070 }
00071 else if (args(0).is_complex_type ())
00072 {
00073 ComplexMatrix m = args(0).complex_matrix_value ();
00074 MatrixType mattyp;
00075 retval = m.rcond (mattyp);
00076 args(0).matrix_type (mattyp);
00077 }
00078 else
00079 {
00080 Matrix m = args(0).matrix_value ();
00081 MatrixType mattyp;
00082 retval = m.rcond (mattyp);
00083 args(0).matrix_type (mattyp);
00084 }
00085
00086 return retval;
00087 }
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104