# Searching solution for solving huge linear system in MATLAB or C

I am encountering a problem that my MATLAB code ran and an error occurs and shows that it is out of memory. My code is using finite element method to solve some complicated kind of integral equation and the number of elements can reach more than 100,000. I use the sparse to store the stiffness matrix and ran the code in parallel on our school cluster. I am not sure whether the data is too big or my code is not well programmed that caused the out-of-memory problem. I also have the c version of the code and same problem occured(the error showed to be segmentaion fault). For small data my code does not have anything wrong. Since it is a 2d FEM code, suppose the number of unknown in each coordinate is n(so that the total is n^2), then the bandwidth of the matrix is approximately less than 2*n. It is symmetric positive definite. When I use MATLAB, I just use \ to solve the linear system. For c version, I use the subroutine for banded matrix in CLAPACK. It is the big data problem and my code does not work, so is there anybody who would like to help me and tell me what I should do to fix it, no matter in c or MATLAB? And for c, is there any package available for solving linear system with big data? Thanks so much!

• You say you have 100000 elements. Is the number of equations also around 100000? If so, this is not a particularly large system if I understand your description of the sparsity. That you got an out-of-memory error makes me think you are running on a 32-bit OS. If so, try to find a version of MATLAB running on a 64-bit OS. Commented Dec 8, 2014 at 21:24
• Even if the cluster is running a 64-bit version of Linux or Windows, if they're using a 32-bit version of Matlab you could see this too (would be strange for a campus cluster). Commented Dec 9, 2014 at 0:15
• I created a 100000-equation system from a FEM discretization of the 2d Laplace equation. I can solve this in MATLAB in around a half second using backslash on a modest five-year-old 64-bit windows 7 computer. So the issue is not the MATLAB direct sparse solvers but rather the address-space limitations of a 32-bit operating system. Commented Dec 10, 2014 at 1:53
• Thanks for everybody's suggestions. I made a mistake when I was explaining the problem. The problem already occurs when I add each entry to the sparse matrix. And the problem I solved is an integral equation rather than PDE. The matrix is sparse but not that sparse. And I am a student, I do not have much money spent on some commercial software. Commented Dec 11, 2014 at 19:30

• Past versions of MATLAB have linked to MKL for BLAS and LAPACK. To determine the BLAS and LAPACK libraries MATLAB is using, type version -blas or version -lapack at the MATLAB command prompt. Commented Dec 10, 2014 at 1:42