Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

COND


Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The COND function returns the condition number of a real or complex two-dimensional array A.

By default, COND uses the L¥ norm to compute the condition number. You may use the LNORM keyword to specify the L1, L2, or L¥ norm.

For the L1 and L¥ norms, the condition number is computed form NORM(A)×NORM(INVERT(A)). If the inverse of A is invalid (due to the singularity of A or floating-point errors in the INVERT function), COND returns -1.

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 LA_SVD.

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.

Syntax

Result = COND( A [, /DOUBLE] [, LNORM={0 | 1 | 2}])

Return Value

Returns the condition number of an n by n real or complex array A by explicitly computing NORM(A)×NORM(A-1). If A-1 is invalid (due to the singularity of A or floating-point errors in the INVERT function), COND returns -1.

Arguments

A

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.

Keywords

DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

LNORM

Set this keyword to an integer value to indicate which norm to use for the computation. The possible values of this keyword are:

Value
Description
0
Use the L¥ norm (the maximum absolute row sum norm). This is the default.
1
Use the L1 norm (the maximum absolute column sum norm).
2
Use the L2 norm (the spectral norm).

Examples

; 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 

Version History

Introduced: Pre 4.0

See Also

DETERM, INVERT, NORM, LA_SVD


Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]