# Best generic method to solve homogeneous system

**URL:** https://discourse.julialang.org/t/best-generic-method-to-solve-homogeneous-system/43261
**Category:** General Usage
**Tags:** question
**Created:** [July 17, 2020, 9:01pm UTC](https://discourse.julialang.org/t/best-generic-method-to-solve-homogeneous-system/43261 "2020-07-17T21:01:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jebej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jebej/32/1784_2.png) [@jebej](https://discourse.julialang.org/u/jebej)
#### Post date: [July 17, 2020, 9:01pm UTC](https://discourse.julialang.org/t/best-generic-method-to-solve-homogeneous-system/43261/1 "2020-07-17T21:01:12Z")

</div>

What is the best way to solve the homogeneous system A\vec{x}=\vec{0} for either a dense or sparse array (or even GPU array)?

For dense `A`, `nullspace(A)` works, and for a sparse array, `eigs(A,nev=1,which=:SM)` appears to work fine.

Is there a better, generic, method somewhere? I looked at IterativeSolvers with b=\vec{0}, but that doesn’t seem to return the right answer.

---

<div class="post-metadata">

### Author: ![jebej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jebej/32/1784_2.png) [@jebej](https://discourse.julialang.org/u/jebej)
#### Post date: [July 17, 2020, 9:04pm UTC](https://discourse.julialang.org/t/best-generic-method-to-solve-homogeneous-system/43261/2 "2020-07-17T21:04:36Z")

</div>

Note that until now, I had been using NLsolve, but that seems quite wasteful considering that the lu factorization is needlessly recomputed at each step.

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [July 17, 2020, 9:40pm UTC](https://discourse.julialang.org/t/best-generic-method-to-solve-homogeneous-system/43261/3 "2020-07-17T21:40:07Z")

</div>

One simple answer is to compete and store the lu factorization.

---

<div class="post-metadata">

### Author: ![jebej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jebej/32/1784_2.png) [@jebej](https://discourse.julialang.org/u/jebej)
#### Post date: [July 17, 2020, 10:35pm UTC](https://discourse.julialang.org/t/best-generic-method-to-solve-homogeneous-system/43261/4 "2020-07-17T22:35:51Z")

</div>

With NLsolve? How would that work?
