Skip to content

[FEATURE REQUEST] Add LU decomposition algorithm for matrix (java) (hactoberfest'25) #6833

@sourav-625

Description

@sourav-625

What would you like to Propose?

I would like to propose the addition of LU decomposition algorithm under src/main/java/com/thealgorithms/matrix

This algorithm is widely used in:

  • Solving systems of linear equations (Ax = b)
  • Finding matrix inverses
  • Computing determinants efficiently

Issue details

The above mentioned algorithm decomposes a square matrix A into product of 2 matrices:

A = L * U

where:

  • L is a lower triangular matrix with 1s on its diagonal
  • U is an upper triangular matrix

Example:
Matrix:
A = {
{2, -1, -2},
{-4, 6, 3},
{-4, -2, 8}
}

Expected Output:
L = {
{1.000, 0.000, 0.000},
{-2.000, 1.000, 0.000},
{-2.000, -1.000, 1.000}
}

U = {
{2.000, -1.000, -2.000},
{0.000, 4.000, -1.000},
{0.000, 0.000, 3.000}
}

Time Complexity: O(n^3)

Reference: https://en.wikipedia.org/wiki/LU_decomposition

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions