1 // ============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2007-2008 - Bruno PINCON
4 // Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
6 // This file is distributed under the same license as the Scilab package.
7 // ============================================================================
8 // <-- CLI SHELL MODE -->
9 assert_checkfalse(execstr("umf_luget()" ,"errcatch") == 0);
10 refMsg = msprintf(_("%s: Wrong number of input argument(s): %d expected.\n"), "umf_luget", 1);
11 assert_checkerror("umf_luget()", refMsg);
12 assert_checkfalse(execstr("umf_luget(1)" ,"errcatch") == 0);
13 refMsg = msprintf(_("%s: Wrong type for input argument #%d: A pointer expected.\n"), "umf_luget", 1);
14 assert_checkerror("umf_luget(1)", refMsg);
15 // this is the test matrix from UMFPACK
16 A = sparse( [ 2 3 0 0 0;
22 [L,U,p,q,R] = umf_luget(Lup);
23 assert_checkequal(nnz(L), 9);
24 assert_checkequal(nnz(U), 9);
25 assert_checkfalse(or(p <> [ 3; 4; 1; 5; 2 ]));
26 assert_checkfalse(or(q <> [ 4; 3; 1; 5; 2 ]));
27 assert_checkfalse(or(R <> [ 5; 13; 6; 1; 7 ]));
29 for i=1:5, B(i,:) = B(i,:)/R(i); end // apply the row scaling
30 B(p,q) - L*U; // must be a (quasi) nul matrix
31 assert_checkequal(nnz(L*U), 12);
32 assert_checkequal(nnz(B(p,q)), 12);
33 umf_ludel(Lup); // clear memory
34 // the same with a complex matrix
35 A = sparse( [ 2+%i 3+2*%i 0 0 0;
37 0 -1+%i -3+6*%i 2-%i 0;
41 [L,U,p,q,R] = umf_luget(Lup);
42 assert_checkequal(nnz(L), 9);
43 assert_checkequal(nnz(U), 9);
44 assert_checkfalse(or(p <> [ 3; 4; 1; 5; 2 ]));
45 assert_checkfalse(or(q <> [ 4; 3; 1; 5; 2 ]));
46 assert_checkfalse(or(R <> [ 8; 18; 14; 6; 8 ]));
48 for i=1:5, B(i,:) = B(i,:)/R(i); end // apply the row scaling
49 B(p,q) - L*U; // must be a (quasi) nul matrix
50 assert_checkequal(nnz(B(p,q)), 12);
51 assert_checkequal(nnz(L*U), 12);
52 umf_ludel(Lup) // clear memory