# fixed.realConditionNumberUpperBound

Estimate of upper bound for 2-norm condition number of real-valued matrix

## Syntax

``C = fixed.realConditionNumberUpperBound(m,n,max_abs_A,noiseStandardDeviation)``
``C = fixed.realConditionNumberUpperBound(___,p_s)``
``C = fixed.realConditionNumberUpperBound(___,regularizationParameter)``

## Description

example

````C = fixed.realConditionNumberUpperBound(m,n,max_abs_A,noiseStandardDeviation)` returns an estimate of an upper bound for the 2-norm condition number of a real-valued `m`-by-`n` matrix `A`, where `max_abs_A >= max(abs(A(:)))` and `noiseStandardDeviation` is the standard deviation of the additive random noise in `A`.```

example

````C = fixed.realConditionNumberUpperBound(___,p_s)` uses the probability `p_s` that the estimate of the lower bound of the smallest singular value is larger than the actual smallest singular value. `p_s` is an optional parameter. If not supplied or empty, then the default value is used.```

example

````C = fixed.realConditionNumberUpperBound(___,regularizationParameter)` returns an estimate of an upper bound for the 2-norm condition number of a real-valued matrix $\left[\begin{array}{c}\lambda {I}_{n}\\ A\end{array}\right]$, where λ is the `regularizationParameter`, A is an m-by-n matrix with m >= n, and In = `eye(n)`. `regularizationParameter` is an optional parameter. If not supplied or empty, then the default value is used.```

## Examples

collapse all

Estimate an upper bound for the 2-norm condition number of a low rank, real-valued matrix with additive noise.

Define a real matrix `A` with additive noise.

```m = 300; n = 10; rankA = 3; A = fixed.example.realRandomLowRankMatrix(m,n,rankA); noiseStandardDeviation = sqrt(10^(-50/10)); A = A + fixed.example.realNormalRandomArray(0,noiseStandardDeviation,m,n); ```

Estimate an upper bound for the condition number of the matrix `A`.

`C = fixed.realConditionNumberUpperBound(m,n,max(abs(A(:))),noiseStandardDeviation)`
```C = 1.4780e+03```

Compare to the actual condition number of the matrix.

`C_actual = cond(A)`
```C_actual = 275.5870```

Estimate an upper bound for the 2-norm condition number of a low rank, real-valued matrix with additive noise, using the regularization parameter.

Define a real matrix `A` with additive noise.

```m = 300; n = 10; rankA = 3; A = fixed.example.realRandomLowRankMatrix(m,n,rankA); noiseStandardDeviation = sqrt(10^(-50/10)); A = A + fixed.example.realNormalRandomArray(0,noiseStandardDeviation,m,n);```

Define the regularization parameter.

```regularizationParameter = 0.01; A = [regularizationParameter*eye(n);A];```

Estimate an upper bound for the condition number of the matrix `A` with the regularization parameter. Use the default value for `p_s`.

`C = fixed.realConditionNumberUpperBound(m,n,max(abs(A(:))),noiseStandardDeviation,[],regularizationParameter)`
```C = 1.4343e+03```

Compare to the actual condition number of the matrix.

`C_actual = cond(A)`
```C_actual = 293.4647```

Estimate an upper bound for the 2-norm condition number of a full rank random matrix with normally distributed elements.

Define a full rank, random, real matrix `A` with normally distributed elements.

```m = 300; n = 10; noiseStandardDeviation = 1; A = fixed.example.realNormalRandomArray(0,noiseStandardDeviation,m,n);```

Estimate an upper bound for the condition number of the matrix `A`.

`C = fixed.realConditionNumberUpperBound(m,n,max(abs(A(:))),noiseStandardDeviation)`
```C = 19.0850```

Compare to the actual condition number of the matrix.

`C_actual = cond(A)`
```C_actual = 1.2801```

## Input Arguments

collapse all

Number of rows in matrix `A`, specified as a positive integer-valued scalar. The number of rows, `m`, must be greater than or equal to the number of columns, `n`.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64`

Number of columns in matrix `A`, specified as a positive integer-valued scalar. The number of rows, `m`, must be greater than or equal to the number of columns, `n`.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64`

Maximum of absolute value of matrix `A`, specified as a scalar.

Example: `max_abs_A >= max(abs(A(:)))`

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64`

Standard deviation of additive random noise in matrix `A`, specified as a scalar.

If `noiseStandardDeviation` is not supplied or empty, then the default value is used, which is the standard deviation of the quantization noise,

`${\sigma }_{q}=\frac{{2}^{-precisionBits}}{\sqrt{12}}.$`

This value is calculated by the function `fixed.realQuantizationNoiseStandardDeviation`.

If `noiseStandardDeviation` is zero, then `fixed.singularValueLowerBound` will return zero for the estimate of the smallest singular value, and `fixed.realConditionNumberUpperBound` will return an infinite condition number.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64`

Probability that estimate of lower bound of smallest singular value is larger than actual smallest singular value of matrix `A`, specified as a scalar.

If `p_s` is not supplied or empty, then the default of `p_s = (1/2)*(1+erf(-5/sqrt(2))) = 2.8665e-07` is used, which is five standard deviations below the mean. So, the probability that the estimated lower bound for the smallest singular value is less than the actual smallest singular value is `1 - p_s = 0.99999971 - p_s = 0.9999997`.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64`

Regularization parameter, specified as a nonnegative scalar. Small, positive values of the regularization parameter can improve the conditioning of the problem and reduce the variance of the estimates. While biased, the reduced variance of the estimate often results in a smaller mean squared error when compared to least-squares estimates.

`regularizationParameter` is the Tikhonov regularization parameter of the matrix ```[regularizationParameter*eye(n); A]```, where `A` is an `m`-by-`n` matrix with `m` >= `n`.

Data Types: `single` | `double`

collapse all

### Condition Number for Inversion

A condition number for a matrix and computational task measures how sensitive the answer is to changes in the input data and roundoff errors in the solution process. The condition number for inversion of a matrix measures the sensitivity of the solution of a system of linear equations to errors in the data. The condition number for inversion gives an indication of the accuracy of the results from matrix inversion and the linear equation solution.

A large condition number indicates that a small change in the coefficient matrix `A` can lead to larger changes in the output b in the linear equation Ax = b. The extreme case is when `A` is so poorly conditioned that it is singular (an infinite condition number), in which case it has no inverse and the linear equation has no unique solution.

## Algorithms

The condition number with respect to the inversion of matrix `A` is the ratio of the largest singular value of `A` to the smallest singular value of `A`. The `fixed.realSingularValueLowerBound` function estimates the lower bound of the smallest singular value, `s_n`, of `A`. The `fixed.singularValueUpperBound` function determines an upper bound for the largest singular value, `svdUpperBound`, of `A`. A bound on the condition number of `A` is then ```cond(A) = max(svd(A))/min(svd(A)) <= svdUpperBound/s_n``` [1][2][3].

## References

[1] Bryan, Thomas A., Jenna L. Warren, Brenda Zhuang, and Jessica Clayton. Continuation in Part for "Systems and Methods for Design Parameter Selection." U.S. Patent Application No. 16/947, 130. 2022.

[2] Bryan, Thomas A. and Jenna L. Warren. "Systems and Methods for Design Parameter Selection." U.S. Patent Application No. 16/947, 130. 2020.

[3] Chen, Zizhong and Jack J. Dongarra. "Condition Numbers of Gaussian Random Matrices." SIAM Journal on Matrix Analysis and Applications 27, no. 3 (July 2005): 603-620. https://doi.org/10.1137/040616413.

## Version History

Introduced in R2022b