Lu factorisation or Lu decomposit of Armadillo)

Source: Internet
Author: User

In the armadillo library, the Lu decomposition (LU factorisation or Lu decomposition) of the matrix uses the Lu function. The Lu function has two versions.

1 Lu (L, U, P, X)

X is the matrix to be decomposed to generate L, U, and P.

1) P is a permutation matrix, so the inverse of P is equal to its transpose (transpose)

2) L is a unit of lower Triangle Matrix (unit lower triangular matrix)

3) U is a strict upper triangular matrix)

4) Px = LU, that is, ptlu = x

Example:

mat m = "2,4,2;1,5,2;4,-1,9;";mat l, u, p;lu(l, u, p, m);cout << "L:" << endl;l.print();cout << "U:" << endl;u.print();cout << "P:" << endl;p.print();

Running result:

2 Lu (L, U, X)

X is the matrix to be decomposed to generate L, and u meets

1) U is a strict upper triangular matrix)

2) x = Lu

Due to the algorithm, the L generated by decomposition using this function is generally not of the lower triangle.

Example:

mat m = "2,4,2;1,5,2;4,-1,9;";mat l, u;lu(l, u, m);cout << "L:" << endl;l.print();cout << "U:" << endl;u.print();

Running result:

NOTE: If matrix X cannot be decomposed, the Lu function returns false and clears the L, U, and P matrices. Returns true if the decomposition is successful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.