# Result changes depending on whether matrix is sparse or not

**URL:** https://discourse.julialang.org/t/result-changes-depending-on-whether-matrix-is-sparse-or-not/30669
**Category:** General Usage
**Tags:** linearalgebra
**Created:** [November 3, 2019, 11:01pm UTC](https://discourse.julialang.org/t/result-changes-depending-on-whether-matrix-is-sparse-or-not/30669 "2019-11-03T23:01:29Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![John\_Gibson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_gibson/32/5321_2.png) [@John\_Gibson](https://discourse.julialang.org/u/John_Gibson)
#### Post date: [November 4, 2019, 3:40am UTC](https://discourse.julialang.org/t/result-changes-depending-on-whether-matrix-is-sparse-or-not/30669/6 "2019-11-04T03:40:13Z")

</div>

Hmmm, my suggestion to use `pinv` is not a practical one. It’s never a good idea to compute an inverse to solve an Ax=b problem.

Is there any special reason in your application why one solution for x is better than another?

Regarding pseudo-inverse and QR, this thread is relevant.

> [@Moore-Penrose Generalized Inverse of Sparse Matrix](https://discourse.julialang.org/t/moore-penrose-generalized-inverse-of-sparse-matrix/17414/3):
>
> You almost never compute the inverse (pseudo or otherwise) of a sparse matrix because the inverse is generally dense. On the other hand, you do compute the application of the inverse to a vector, and you often precompute factorizations that let you apply the inverse more quickly. In the case of the ordinary inverse, you can apply a sparse inverse with A \ b and compute the factorization with lu(A) etcetera. In the case of the pseudoinverse, applying it computes the least-squares solution, and …

---

_[View the full topic](https://discourse.julialang.org/t/result-changes-depending-on-whether-matrix-is-sparse-or-not/30669)._
