# Getting a subdecomposition (LU) of a submatrix

**URL:** <https://discourse.julialang.org/t/getting-a-subdecomposition-lu-of-a-submatrix/96906>\
**Category:** General Usage\
**Tags:** linearalgebra\
**Created:** [March 31, 2023, 6:13pm UTC](https://discourse.julialang.org/t/getting-a-subdecomposition-lu-of-a-submatrix/96906 "2023-03-31T18:13:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fgerick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fgerick/32/13228_2.png) [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Post date:** [March 31, 2023, 6:13pm UTC](https://discourse.julialang.org/t/getting-a-subdecomposition-lu-of-a-submatrix/96906/1 "2023-03-31T18:13:21Z")

</div>

Assuming that a LU decomposition exists for all desired submatrices of a matrix `a`, is there an easy way to extract the decomposition for the submatrix from the decomposition of `a`? It is easy in this example:

```julia
julia> using LinearAlgebra

julia> a = randn(10,10);

julia> a2 = a[1:5,1:5];

julia> P = lu(a, NoPivot());

julia> P2 = lu(a2, NoPivot());

julia> P.factors[1:5,1:5] ≈ P2.factors
true

```

In that way I can compute the decomposition of the large matrix `a` once and then simply view the decomposition for each desired submatrix.

My question is: Can I do the same when I do not want the submatrix with indices `1:n`, but arbitrary subindices. It would be good also, I guess, if `NoPivot()` is not a requirement. And most importantly: can I do this for the UMFPACK LU for sparse matrices?

Thank you for any help.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 31, 2023, 6:34pm UTC](https://discourse.julialang.org/t/getting-a-subdecomposition-lu-of-a-submatrix/96906/2 "2023-03-31T18:34:24Z")

</div>

> [@fgerick](#):
>
> Can I do the same when I do not want the submatrix with indices `1:n`, but arbitrary subindices.

No. For example, consider the block matrix A = \begin{pmatrix} I & B \\ 0 & I \end{pmatrix}. An LU decomposition of A is simply L=I, U=A. Clearly, however, this provides no help at all in computing `lu(B)`.
