# 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:** 7

<div class="post-metadata">

**Author:** ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Post date:** [November 4, 2019, 4:22am UTC](https://discourse.julialang.org/t/result-changes-depending-on-whether-matrix-is-sparse-or-not/30669/7 "2019-11-04T04:22:12Z")

</div>

Why do you think it is not a good idea?  
Computationally wise it might be better use direct methods to find the solution.  
But accuracy wise and certainly if one needs the Least Norm solution of the Least Squares there is nothing wrong about it.

Could it be that the Myth about “Don’t compute the inverse” is overblown?  
See [How Accurate is inv(A)\*b](https://arxiv.org/abs/1201.6035)?

By the way, MATLAB has the function [`lsqminnorm()`](https://www.mathworks.com/help/matlab/ref/lsqminnorm.html) which uses the complete orthogonal decomposition (COD) to compute the minimum norm least squares solution.  
If it is available in Julia one could use it as well as it should be faster than `pinv()` which uses the SVD.

---

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