-
Notifications
You must be signed in to change notification settings - Fork 13
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
Way to invert matrix? #23
Comments
This isn't implemented yet. Note that the LU factorisation of a |
Is there anything I could do to help? |
If you want to try implementing it that would be great. The goal is to have
_lu!(_, A, pivot, check) = LinearAlgebra.lu!(A, pivot; check=check) # Fall back to standard `lu!`
function _lu!(::AbstractColumnMajor, A::AbstractMatrix{<:BlasFloat}, pivot, check)
if pivot === Val(false)
return generic_lufact!(A, pivot; check = check)
end
lpt = LAPACK.getrf!(A)
check && checknonsingular(lpt[3])
return LU{T,typeof(A)}(lpt[1], lpt[2], lpt[3])
end
lu!(A::AbstractMatrix, pivot::Union{Val{false}, Val{true}} = Val(true);
check::Bool = true) = _lu!(MemoryLayout(A), A, pivot, check)
|
Would the solver described in the following discourse post be useful for any of this? |
I believe doing a hierarchical solver with block matrix inversion can be used to reduce the complexity from That said, the first step is a proper standard LU decomposition, which while it is |
Putting the hierarchical matrices aside, how exactly is the LU decomposition not leveraging LAPack? Is this like a 2 line fix or something much deeper? // also, this segue should have probably gone on BandedMatrices... sorry about that 😬 |
Not two lines, I outlined what needs to be done above. |
Sounds good. Just wanted to know if there was a difference now that we're focused on BandedMatrices and not BandedBlockBandedMatrices.
… On Feb 13, 2019, at 5:57 AM, Sheehan Olver ***@***.***> wrote:
Not two lines, I outlined what needs to be done above.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Oh, BandedMatrices.jl already has a fast LU using LAPack, so I'm not sure I understand the point of block inversion except for BlockBandedMatrices.jl |
This was two separate issues. At first, I wanted a black-box solution to quickly solving After realizing this wasn't possible, I setup my matrix so that it has 4 blocks:
Then using blockwise inversion, I setup a package that should in theory quickly do this. However I'm not getting the speedup I thought I'd get. That's why I posted to discourse and thought it might be related to this issue. Apologies again for the confusion. |
This is the sort of thing |
It seemed like you could get a win in the limit of |
For a well-conditioned banded matrix, UMFPack is almost as fast as LAPack, especially with OpenBLAS which has very slow banded solvers. My blog post https://approximatelyfunctioning.blogspot.com/2018/12/banded-matrices-and-ordinary.html gives some timing examples but these are with MKL. But even if you get a 4x speedup using a banded solver, that gain will probably be lost in a blockwise inversion. |
Can't it be done for |
For example, for |
Are you imagining an increasingly complicated operator tree? I don't think that's viable, and if it is LazyArrays.jl won't help since it templates the arguments, meaning having complicated operator trees requires excessive compiling. For |
My blocks are 1000 x 1000 so I am not sure I want to fill them in with a LU decomposition. Also the matrice |
I forgot to say that you were right, this is what I intended to do until I read your answer... |
Do you need to calculate the factorisation fast, or just invert systems fast? That is, are you using the same matrix with multiple right hand side? The LU factors should be practically banded-block-banded (they’ll have exponential decay in the bands) so one option is to calculate the factorisation using dense LU and then compress the results. But really this is a case where iterative methods are the go to solution. |
I need to invert systems fast. More precisely, I need to solve I tried iterative methods but I dont have a good preconditioner. The convergence is way too slow. |
Right. What you are asking for may not currently be possible. I don't think hierarchical solvers will help much here either as the involve dense inverses, that is, for an I have some vague ideas on using the fact that the inverse of banded matrices is banded + semi-separable, hence can be represented using a small amount of memory and I believe form an algebra, but I don't have time to pursue this at the moment (I'm hoping for an interested student at some point). |
Is there a way to invert BandedBlockBandedMatrix? I'm getting the following error from:
A \ b
The text was updated successfully, but these errors were encountered: