Recently, I have met a question that
a saying goes that for large linear system: iterative methods are required because of memory problem of direct methods.
But when I implement some experiments in Matlab, I find a strange phenomenon: I used the Poisson equation in 2D and use Q1 element, grid input is 10, and I got a system: $$Ax = f$$ where $A$ is $1050625\times 1050625$, which is large and sparse.
In principle, we should use iterative methods, such as PCG or minres built-in Matlab, with AMG preconditioner. But when I input A\f
in the command window, Matlab direct method only costs $4.588234$ seconds, which is fast.
Then, I want to test PCG with AMG preconditioner. I find the time for setup of the AMG preconditioner to be very very long. First, I thought this is because the size of system is not large enough, then I use the grid input =11, and the memory breaks down, the system matrix $A$ cannot be generated, so in my PC, I can not get the result that iterative method is better than direct method for large sparse system. Why? Is it the reason that the size is not enough? but the larger system cannot be generated in our personal computer.
I also believe that for large sparse system, iterative methods are necessary, but the numerical results are contrary: Matlab's A\b
is so fast.
How should we understand the saying "iterative methods are better than direct methods for large sparse system"? Could you please give me some suggestions?
A\f
in Matlab. $\endgroup$