Mathematica uses the ILU0 procedures automatically to precondition large sparse linear systems; e.g.
LinearSolve[mat, rhs,
Method -> {Krylov, Preconditioner -> ILU0}]; // Timing
I wish to have the incomplete factorization of the large sparse matrix A in a standalone procedure.
I would be grateful if someone could give some tips or written code to provide the ILU0 or ILUT approximate inverses as standalone procedures.
?*`*ILU*will reveal which internal functions do this. You might want to experiment with them and figure out their calling syntax. – Szabolcs Jun 14 '12 at 8:21SparseArray[]object toSparseArray`SparseMatrixILU[]; one can then set theMethodoption to either"ILU0"or"ILUT"as needed. One can then useLowerTriangularize[]andUpperTriangularize[]to extract the needed factors from the compressedSparseArray[]representation. – J. M.♦ Jun 14 '12 at 8:43SparseArray`SparseMatrixILU[]is similar to the output ofLUDecomposition[]as expected: the compressed matrix where the $\mathbf L$ and $\mathbf U$ factors are packed, and a permutation matrix represented as an integer permutation... – J. M.♦ Jun 14 '12 at 8:53