isIllConditioned

Determine whether matrix is ill conditioned

Description

example

tf = isIllConditioned(dA) returns logical 1 (true) if the original coefficient matrix A used to create decomposition dA is ill conditioned; otherwise, it returns logical 0 (false).

The test used depends on the type of decomposition:

  • 'qr' and 'cod' decompositions — The coefficient matrix is ill conditioned if rank(dA) < min(size(A)).

  • All other decompositions — The coefficient matrix is ill conditioned if rcond(dA) < eps.

If isIllConditioned returns logical 1 (true), then solving a linear system with either dA\b or b/dA displays a warning. Use the CheckCondition property of the decomposition object dA to turn off these warnings.

Examples

collapse all

Create a matrix decomposition object for a 25-by-25 Hilbert coefficient matrix and then check to see whether the underlying coefficient matrix is ill conditioned.

A = hilb(25);
dA = decomposition(A)
dA = 
  decomposition with properties:

    MatrixSize: [25 25]
          Type: 'ldl'

  Show all properties

tf = isIllConditioned(dA)
tf = logical
   1

Check the reciprocal condition number of the coefficient matrix. In this case isIllConditioned determines that the coefficient matrix A is ill conditioned because rcond(dA) is smaller than eps.

rcond(dA)
ans = 2.3569e-20

Input Arguments

collapse all

Input decomposition, specified as a decomposition object.

Example: dA = decomposition(A,'qr')

Tips

  • isIllConditioned uses rank and condition number estimates of the decomposition object. These estimates can differ compared to calling rank(A) or rcond(A) on the coefficient matrix directly.

Introduced in R2017b