[SciPy-user] help about sparse matrix
Anne Archibald
peridot.faceted at gmail.com
Thu Mar 6 15:27:27 EST 2008
On 06/03/2008, jose luis Lopez Martinez <lopmart at gmail.com> wrote:
> i am working in my thesis of master and i will work with sparse matrix and
> solve equations of lineal algebra of
> A . x = B
>
> the size of matrix is 128^4(268,435,456 rows)x 128^4(268,435,456 colums).
> the matrix have diagonald dominancies that is a sufficient condition
> for convergence of Jacobi iteration , gauss seidel and xor(relaxion method),
> but is slow for converge.
> it exist a command in scipy that solve sparse matrix using at the
> Gauss-Seidel iteration method o krylov iterative methods?
Scipy does have iterative solvers for sparse matrices, but your matrix
is enormous. You will need to use a 64-bit machine at the least, and
the one I tried it on ran out of memory with even a simple array that
large. It may be possible though, if you are already able to
manipulate this matrix:
In [85]: n=128**3; A = scipy.sparse.speye(n,n) +
0.01*scipy.sparse.speye(n,n,1) - 0.01*scipy.sparse.speye(n,n,-1);
scipy.linsolve.spsolve(A,numpy.random.randn(n))
Out[85]:
array([ 0.98303453, 0.41739294, -0.94134509, ..., -0.44176429,
-0.72973676, -1.39742764])
If your matrix is actually band-diagonal, as the one I construct here
is, there is a special-purpose solver available which will probably
save you some pain.
Good luck,
Anne
More information about the SciPy-User
mailing list