ConditionNumber

Advanced Analysis Library Only

AnalysisLibErrType ConditionNumber (void *inputMatrix, int numberOfRows, int numberOfColumns, int normType, double *conditionNumber);

Purpose

Calculates the condition number of a real input matrix. The normType parameter indicates what type of norm to use to calculate the condition number. The input matrix can be either square or rectangular when normType is 2-norm.

The following formula defines the condition number c of a matrix A:

is the p-norm of the matrix A

The normType value defines the p-norm behavior. For a 2-norm normType, c is the ratio of the largest singular value of A to the smallest singular value of A.

The condition number of a matrix indicates how near to singular the matrix is. A matrix with a large condition number is nearly singular, and a matrix with a condition number close to one is far from singular. The condition number of a matrix is always greater than or equal to one, and it can help assess the accuracy of a solution to a linear system of equations and matrix inversion.

Parameters

Input
Name Type Description
inputMatrix numeric array Input matrix. If normType is 2-norm, the matrix can be square or rectangular; otherwise, it must be square. This matrix must be an array of doubles.
numberOfRows integer Number of rows in inputMatrix.
numberOfColumns integer Number of columns in inputMatrix.
normType integer Norm type to use to calculate the condition number.

The following table shows valid norm type values.

Norm Type Value Meaning
2-norm 0 Largest singular value of inputMatrix.
1-norm 1 Largest column sum of inputMatrix.
Frobenius-norm 2 Square root of the sum of the diagonal elements of ATA, where AT is the complex conjugate transpose of A.
Infinite-norm 3 Largest row sum of inputMatrix.
Output
Name Type Description
conditionNumber double-precision Condition number of the matrix.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.