smile.math.matrix

## Class FloatBandMatrix.LU

• java.lang.Object
• smile.math.matrix.FloatBandMatrix.LU
• All Implemented Interfaces:
java.io.Serializable
Enclosing class:
FloatBandMatrix

```public static class FloatBandMatrix.LU
extends java.lang.Object
implements java.io.Serializable```
The LU decomposition. For an m-by-n matrix A with m ≥ n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv,:) = L*U. If m < n, then L is m-by-m and U is m-by-n.

The LU decomposition with pivoting always exists, even if the matrix is singular. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations if it is not singular. The decomposition can also be used to calculate the determinant.

Serialized Form
• ### Field Summary

Fields
Modifier and Type Field and Description
`int` `info`
If info = 0, the LU decomposition was successful.
`int[]` `ipiv`
The pivot vector.
`FloatBandMatrix` `lu`
The LU decomposition.
• ### Constructor Summary

Constructors
Constructor and Description
```LU(FloatBandMatrix lu, int[] ipiv, int info)```
Constructor.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`float` `det()`
Returns the matrix determinant.
`FloatMatrix` `inverse()`
Returns the matrix inverse.
`boolean` `isSingular()`
Returns if the matrix is singular.
`float[]` `solve(float[] b)`
Solve A * x = b.
`void` `solve(FloatMatrix B)`
Solve A * X = B.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### lu

`public final FloatBandMatrix lu`
The LU decomposition.
• #### ipiv

`public final int[] ipiv`
The pivot vector.
• #### info

`public final int info`
If info = 0, the LU decomposition was successful. If info = i > 0, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
• ### Constructor Detail

• #### LU

```public LU(FloatBandMatrix lu,
int[] ipiv,
int info)```
Constructor.
Parameters:
`lu` - LU decomposition matrix
`ipiv` - the pivot vector
`info` - info > 0 if the matrix is singular
• ### Method Detail

• #### isSingular

`public boolean isSingular()`
Returns if the matrix is singular.
• #### det

`public float det()`
Returns the matrix determinant.
• #### inverse

`public FloatMatrix inverse()`
Returns the matrix inverse. For pseudo inverse, use QRDecomposition.
• #### solve

`public float[] solve(float[] b)`
Solve A * x = b.
Parameters:
`b` - right hand side of linear system. On output, b will be overwritten with the solution matrix.
Throws:
`java.lang.RuntimeException` - if matrix is singular.
• #### solve

`public void solve(FloatMatrix B)`
Solve A * X = B. B will be overwritten with the solution matrix on output.
Parameters:
`B` - right hand side of linear system. On output, B will be overwritten with the solution matrix.
Throws:
`java.lang.RuntimeException` - if matrix is singular.