# Not enough memory for GMRES

After realizing that Gauss-Seidel is extremely slow for my simulation, i wanted to try GMRES and luckily found the C++ code here without diving into the theory. The size of the matrix in my case is nxn where n=50,000. However, I even cannot initialize the matrix to zero because the computer freezes while initializing it. Is there a memory friendly version of GMRES?

• The example you linked is for dense matrices, which it is no surprise that your matrix takes too much RAM. You are going to want to hunt for a sparse implementation, which should be fairly common (and better performing) than the dense version. – Godric Seer May 17 '14 at 23:46
• FYI, initializing a 50000x50000 double precision matrix requires about 18.6 GB of memory. – Doug Lipinski May 18 '14 at 16:13
• If your implementation uses a full matrix (as opposed to a sparse matrix) and you only have bad preconditioners, why not use Gauß elimination? – Guido Kanschat May 18 '14 at 18:04