Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow passing ipiv to lu! factorizations #1125

Closed
wants to merge 2 commits into from

Conversation

longemen3000
Copy link
Contributor

@longemen3000 longemen3000 commented Nov 28, 2024

when performing LU factorizations, a Vector{BlasInt} is allocated each time. in conjuction with a matrix A. lu! allows reusing a matrix, but it still allocates the vector. This PR allows passing ipiv as an input to lu!, so no allocations are performed, if required.

src/lu.jl Outdated Show resolved Hide resolved
@stevengj stevengj added enhancement New feature or request needs docs Documentation for this change is required needs tests Unit tests are required for this change labels Nov 29, 2024
@stevengj
Copy link
Member

Should this go in the new LinearAlgeba.jl repo instead?

Co-authored-by: Steven G. Johnson <[email protected]>
@longemen3000
Copy link
Contributor Author

Isn't this the new LinearAlgebra Repo?

@stevengj
Copy link
Member

Whoops, right. Sorry, I thought was looking at JuliaLang/julia.

@stevengj
Copy link
Member

stevengj commented Nov 29, 2024

An alternative API would be:

lu!(F::LU, A::StridedMatrix, ...)

that lets you overwrite an existing LU object. This way we wouldn't have to expose internals like ipiv.

Indeed, it looks like we already have such a method for LU factorization of Tridiagonal matrices, and we also have such a method for sparse arrays. Not only would adding this to StridedMatrix be more consistent, but it is more flexible because the internals of the factorization object may change for different matrix types.

@longemen3000
Copy link
Contributor Author

closing in favor of #1131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs docs Documentation for this change is required needs tests Unit tests are required for this change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants