pub struct FullPivLu<T> { /* private fields */ }
Expand description

LU decomposition with complete pivoting.

For any square matrix A, there exist two permutation matrices P and Q, a lower triangular matrix L and an upper triangular matrix U such that

PAQ = LU.

Unlike the LU decomposition computed with partial pivoting, this decomposition is stable for singular matrices. It is also a rank- revealing decomposition.

See PartialPivLu for applications of LU decompositions in general.

Implementations

Performs the decomposition.

Solves the linear system Ax = b.

Here, A is the decomposed matrix satisfying PAQ = LU. Note that this method is particularly well suited to solving multiple such linear systems involving the same A but different b.

Errors

If the matrix is very ill-conditioned, the function might fail to obtain the solution to the system.

Panics

The right-hand side vector b must have compatible size.

Examples
let x = Matrix::identity(4);
let lu = FullPivLu::decompose(x).unwrap();
let b = vector![3.0, 4.0, 2.0, 1.0];
let y = lu.solve(b)
          .expect("Matrix is invertible.");
assert_vector_eq!(y, vector![3.0, 4.0, 2.0, 1.0], comp = float);

Computes the inverse of the matrix which this LUP decomposition represents.

Errors

The inversion might fail if the matrix is very ill-conditioned. The inversion fails if the matrix is not invertible.

Computes the determinant of the decomposed matrix.

Empty matrices are considered to have a determinant of 1.0.

Panics

If the underlying matrix is non-square.

Computes the rank of the decomposed matrix.

Examples
let x = matrix![1.0, 2.0, 3.0;
                4.0, 5.0, 6.0;
                5.0, 7.0, 9.0];
let lu = FullPivLu::decompose(x).unwrap();
assert_eq!(lu.rank(), 2);

Returns whether the matrix is invertible.

Empty matrices are considered to be invertible for the sake of this function.

Examples
let x = Matrix::<f64>::identity(4);
let lu = FullPivLu::decompose(x).unwrap();
assert!(lu.is_invertible());

let y = matrix![1.0, 2.0, 3.0;
                4.0, 5.0, 6.0;
                5.0, 7.0, 9.0];
let lu = FullPivLu::decompose(y).unwrap();
assert!(!lu.is_invertible());

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The type representing the ordered set of factors that when multiplied yields the decomposed matrix. Read more
Extract the individual factors from this decomposition.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.