gf_linsolve

Purpose

Use one of the linear solvers provided by getfem. For large linear systems, these solvers with the adequate preconditioner are often faster than their Matlab equivalent. For small linear systems, the SuperLU solver is also typically faster than the Matlab "slash" operator.

Synopsis

gf_linsolve('gmres', spmat M, vec b [, int restart=50][, precond P][, 'noisy'][,'res', r][,'maxiter', n])
gf_linsolve('cg', spmat M, vec b [, precond P][, 'noisy'][,'res', r][,'maxiter', n])
gf_linsolve('bicgstab', spmat M, vec b [, precond P][, 'noisy'][,'res', r][,'maxiter', n])[U,cond] = gf_linsolve('lu'|'superlu', spmat M, vec b [, precond P])

Description

gf_linsolve('gmres', M, b [, restart][, P]) : solve MX=b with the generalized minimum residuals method, using P as a preconditioner. The restart parameter is the usual gmres max size of the Krylov basis. The noisy option will cause the solver to display a message after each iteration. The 'res' option can be used to change the default target residual value. The 'maxiter' option can be used to change the default maximum number of iterations.

gf_linsolve('cg', M, b [, P]) : solve MX=b with the conjugated gradient method, using P as a preconditioner.

gf_linsolve('bicgstab', M, b [, P]) : solve MX=b with the bi-conjugated gradient stabilized method, using P as a preconditioner.

[U,cond] = gf_linsolve('lu', M, b [, P]) or [U,cond] = gf_linsolve('superlu', M, b [, P]) apply the SuperLU solver (sparse LU factorization). The condition number estimate is returned with the solution.