I am trying to compute the null space of a large $n\times n$ sparse matrix. No matter how large the dimension of the matrix is, it will always look like as below:
The figure on the left shows the version of the matrix for with 10-dimension and the right panel is the ~1700 version. As can be seen, it will always be a very sparse matrix and I'm trying to find its null space. Are there any suggestions on what would be the most efficient way to do so? Or at least, is NullSpace[]
the most efficient tool in this case?
In terms of dimensionality, I'm aiming to go as high as the computational power of Mathematica allows me. I have already seen the question here and I also have tried RowReduce as well, but I'm always getting the error "Result for RowReduce of badly conditioned matrix". Nullspace seems to work fine (albeit slow), at least up to n~40000 that I've tried so far.
Update
Link to a notebook that generates the matrix.
NullSpace
should be the way to go. MaybeEigensystem[A, -1, Method->"Arnoldi"]
with suitable shift might also help. But as always, it depends on your concrete matrix. Would you please share the code that generates it? $\endgroup${lambda, u} = Eigensystem[NullMatrix, -1, Method -> {"Arnoldi"}];
works fine.u[[1]]
seems to be the only null vector. Or do you expect more than one? Then you can do, e.g.,{lambda, u} = Eigensystem[NullMatrix, -20, Method -> {"Arnoldi"}];
and check the vectorlambda
of eigenvalues for zero (or near-zero) entries. $\endgroup$top
can be expected to be rather small. However, this matrix here is a square $n \times n$-matrix, soNullspace[top]
will have at least $n$ elements... and I doubt thatNullspace[top]
will be particularly sparse. $\endgroup$