source: git/Tst/Short/bug_358.tst @ b672d2

fieker-DuValspielwiese
Last change on this file since b672d2 was d0bdb6, checked in by Hans Schoenemann <hannes@…>, 9 years ago
format
  • Property mode set to 100644
File size: 978 bytes
Line 
1LIB "tst.lib";
2tst_init();
3
4
5
6proc verifyLUSolveResult(A, RHS, solutionData)
7{
8        if (solutionData[1])
9        {
10                def solutionPoint = solutionData[2];
11                def kernelA = solutionData[3];
12                ASSUME(0, A*solutionPoint == RHS );
13                ASSUME(0, rank(kernelA) + rank(A) == ncols(A) );
14                ASSUME(0, A*kernelA==0 );
15        }
16}
17
18// test lusolve() for corner case A = 0
19
20ring r= 0,z,dp;
21
22matrix A;
23
24def LD  = ludecomp(A);
25def P,L,U = LD[1],LD[2],LD[3];
26
27ASSUME(0, (P*A)==(L*U) );
28def RHS = matrix(0);
29
30
31list solutionData = lusolve(P,L,U,RHS );
32
33ASSUME(0, solutionData[1]==1 );
34
35verifyLUSolveResult(A, RHS, solutionData);
36
37
38// test lusolve() for the case that the first columns in U are zero.
39
40matrix B[1][2] = 0,1;
41LD =  ludecomp(B);
42P,L,U = LD[1],LD[2],LD[3];
43
44RHS = matrix(10);
45
46
47solutionData = lusolve( P,L,U, RHS );
48
49ASSUME(0, solutionData[1]==1 );
50
51verifyLUSolveResult(B, RHS, solutionData);
52
53
54
55tst_status(1); $
56
Note: See TracBrowser for help on using the repository browser.