The COND function returns the condition number of a real or complex two-dimensional array A.
By default, COND uses the
norm to compute the condition number. You may use the LNORM keyword to specify the L1, L2, or
norm.
For the L1 and
norms, the condition number is computed form NORM(A)×NORM(INVERT(A)). If A is real and the inverse of A is invalid (due to the singularity of A or floating-point errors in the INVERT function), COND returns -1. If A is complex and the inverse of A is invalid (due to the singularity of A), calling COND results in floating-point errors.
For the L2 norm, the condition number is defined as the ratio of the largest singular value to the smallest. The singular values are computed using SVDC.
This routine is written in the IDL language. Its source code can be found in the file cond.pro in the lib subdirectory of the IDL distribution.
Result = COND( A [, /DOUBLE] [, LNORM={0 | 1 | 2}])
Returns the condition number of an n by n real or complex array A by explicitly computing NORM(A)·NORM(A-1). If A is real and A-1 is invalid (due to the singularity of A or floating-point errors in the INVERT function), COND returns -1. If A is complex and A-1 is invalid (due to the singularity of A), calling COND results in floating-point errors.
The two-dimensional array. For LNORM = 0 or 1, the array A must be a square and can be either real or complex. For LNORM = 2, the array A may be rectangular and can only be real.
Set this keyword to force the computation to be done in double-precision arithmetic.
Set this keyword to an integer value to indicate which norm to use for the computation. The possible values of this keyword are:
; Define a complex array A: A = [[COMPLEX(1, 0), COMPLEX(2,-2), COMPLEX(-3, 1)], $ [COMPLEX(1,-2), COMPLEX(2, 2), COMPLEX(1, 0)], $ [COMPLEX(1, 1), COMPLEX(0, 1), COMPLEX(1, 5)]] ; Compute the condition number of the array using internal ; double-precision arithmetic: PRINT, COND(A, /DOUBLE)
IDL prints:
5.93773
Introduced: Pre 4.0