From 4e7050baf9ae0af29b9e7a786fe17d2a223835fe Mon Sep 17 00:00:00 2001 From: ferhat Date: Fri, 5 Apr 2013 14:52:49 +0200 Subject: [PATCH] Use ilu with type=ilutp instead of nofill Contrary to luinc command ilu with nofill option doesn't not allow for partial pivoting --- mex/sources/bytecode/SparseMatrix.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mex/sources/bytecode/SparseMatrix.cc b/mex/sources/bytecode/SparseMatrix.cc index 6fb6f02b7..3fba0082d 100644 --- a/mex/sources/bytecode/SparseMatrix.cc +++ b/mex/sources/bytecode/SparseMatrix.cc @@ -4589,15 +4589,17 @@ dynSparseMatrix::Solve_Matlab_GMRES(mxArray *A_m, mxArray *b_m, int Size, double throw FatalExceptionHandling(tmp.str()); #endif size_t n = mxGetM(A_m); - const char *field_names[] = {"droptol"}; + const char *field_names[] = {"droptol", "type"}; mwSize dims[1] = { 1 }; - mxArray *Setup = mxCreateStructArray(1, dims, 1, field_names); + mxArray *Setup = mxCreateStructArray(1, dims, 2, field_names); mxSetFieldByNumber(Setup, 0, 0, mxCreateDoubleScalar(lu_inc_tol)); + mxSetFieldByNumber(Setup, 0, 1, mxCreateString("ilutp")); mxArray *lhs0[2]; mxArray *rhs0[2]; rhs0[0] = A_m; rhs0[1] = Setup; - mexCallMATLAB(2, lhs0, 2, rhs0, "ilu"); + if (mexCallMATLAB(2, lhs0, 2, rhs0, "ilu")) + throw FatalExceptionHandling("In GMRES, the incomplet LU decomposition (ilu) ahs failed."); mxArray *L1 = lhs0[0]; mxArray *U1 = lhs0[1]; /*[za,flag1] = gmres(g1a,b,Blck_size,1e-6,Blck_size*periods,L1,U1);*/