I'm looking for a tool or library implementing a fast algorithm in C or JAVA for solving the equation $Ax=b$, where $A$ is a $N*N$ sparse matrix with $5$ non-zero diagonals $(-N,-1,0,1,N)$.
my problem is that $N$ is really big ($N$ can get up to $1-5e7$).
I now solve it in matlab but it is really slow so I'm looking for another methods in other languages to do it faster.
update:
Sorry for the lack of information, I'll update my question and try to clarify my problem.
I'm solving numerically the 2D laplace equation on a rectangular domain (the difficulty may arise from the rectangle dimensions - 1 mm*100 nm) with a mixed boundary conditions.
neumann boundary at left and down sides, dirichlet boundary at the upper side, and at the right side the derivative equal to some function.
by using the finite difference method I get the matrix A with 5 diagonals (each point is coupled with its 4 neighbors and itself).
I tried all the built-in functions in matlab for solving linear equations including "bicgstab" with no success (the solution explode).
the backslash operator with a matrix of N*N (where N=5e7) takes about 13 minutes give or take.