changeset 25028:acb7094aebb3 stable

Fix ilu when type is ilutp and two output arguments are required (#53440). * __ilu__.cc (__ilutp__): Add the *transposed* permuted identity matrix to output L. * ilu.m: Change documentation to note that default is "nofill". Add a BIST test for bug #53440.
author Marco Caliari <marco.caliari@univr.it>
date Fri, 23 Mar 2018 15:28:08 +0100
parents c3cc9677db98
children 91671d57817e
files libinterp/corefcn/__ilu__.cc scripts/sparse/ilu.m
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/__ilu__.cc	Tue Mar 27 14:56:09 2018 -0700
+++ b/libinterp/corefcn/__ilu__.cc	Fri Mar 23 15:28:08 2018 +0100
@@ -34,7 +34,7 @@
 #include "builtin-defun-decls.h"
 
 // This function implements the IKJ and JKI variants of Gaussian elimination to
-// perform the ILUTP decomposition.  The behavior is controlled by milu
+// perform the ILU0 decomposition.  The behavior is controlled by milu
 // parameter.  If milu = ['off'|'col'] the JKI version is performed taking
 // advantage of CCS format of the input matrix.  If milu = 'row' the input
 // matrix has to be transposed to obtain the equivalent CRS structure so we can
@@ -951,7 +951,7 @@
               retval(2) = speye.index (perm, idx_vector::colon);
             }
           else
-            retval(0) = L + speye.index (perm, idx_vector::colon);
+            retval(0) = L + speye.index (idx_vector::colon, perm);
         }
     }
   else
@@ -992,7 +992,7 @@
               retval(2) = speye.index (perm, idx_vector::colon);
             }
           else
-            retval(0) = L + speye.index (perm, idx_vector::colon);
+            retval(0) = L + speye.index (idx_vector::colon, perm);
         }
     }
 
--- a/scripts/sparse/ilu.m	Tue Mar 27 14:56:09 2018 -0700
+++ b/scripts/sparse/ilu.m	Fri Mar 23 15:28:08 2018 +0100
@@ -42,7 +42,7 @@
 ## Type of factorization.
 ##
 ## @table @asis
-## @item @qcode{"nofill"}
+## @item @qcode{"nofill"} (default)
 ## ILU factorization with no fill-in (ILU(0)).
 ##
 ## Additional supported options: @code{milu}.
@@ -52,7 +52,7 @@
 ##
 ## Additional supported options: @code{milu}, @code{droptol}.
 ##
-## @item @qcode{"ilutp"} (default)
+## @item @qcode{"ilutp"}
 ## ILU factorization with threshold and pivoting.
 ##
 ## Additional supported options: @code{milu}, @code{droptol}, @code{udiag},
@@ -539,3 +539,8 @@
 %! fail ("ilu (A_tiny, opts)", "THRESH must be a scalar");
 %! opts.thresh = [];
 %! fail ("ilu (A_tiny, opts)", "THRESH must be a scalar");
+%!test <*53440>
+%! A = sparse (magic (4));
+%! opts.type = "ilutp";
+%! [L, U] = ilu (A, opts);
+%! assert (L * U, A, eps)