# Sparse matrix and zero pivots

**URL:** <https://discourse.julialang.org/t/sparse-matrix-and-zero-pivots/39332>\
**Category:** Numerics\
**Tags:** question\
**Created:** [May 12, 2020, 8:00am UTC](https://discourse.julialang.org/t/sparse-matrix-and-zero-pivots/39332 "2020-05-12T08:00:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mirsad\_Cosovic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mirsad_cosovic/32/9887_2.png) [@Mirsad\_Cosovic](https://discourse.julialang.org/u/Mirsad_Cosovic)\
**Post date:** [May 12, 2020, 8:00am UTC](https://discourse.julialang.org/t/sparse-matrix-and-zero-pivots/39332/1 "2020-05-12T08:00:43Z")

</div>

I have a large sparse matrix and I need to find a position of zero pivots, so my matrix is singular. Standard QR factorization for dense matrices without permutations gives the result that I need, the pivots are on the main diagonal of the matrix R. Because I have a sparse matrix I use SPQR, but then I have permutations of columns and rows and I lose the pivot position. Is there a smart way to find pivots, without converting matrix from sparse to dense?

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [May 12, 2020, 8:19am UTC](https://discourse.julialang.org/t/sparse-matrix-and-zero-pivots/39332/2 "2020-05-12T08:19:34Z")

</div>

See [SPQR: allow user-selected ordering by dpo · Pull Request #35599 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/35599). In the next version of Julia, it will be possible to disable pivoting in the sparse QR.

Notice that zero pivots don’t imply singularity, e.g.

```julia
[0 1
 1 1]

```

---

<div class="post-metadata">

**Author:** ![Mirsad\_Cosovic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mirsad_cosovic/32/9887_2.png) [@Mirsad\_Cosovic](https://discourse.julialang.org/u/Mirsad_Cosovic)\
**Post date:** [May 12, 2020, 8:24am UTC](https://discourse.julialang.org/t/sparse-matrix-and-zero-pivots/39332/3 "2020-05-12T08:24:20Z")

</div>

thank you, regarding the note, I agree with you 😃
