* Bug #9196 fixed - The threshold level for conditioning in backslash was too
[scilab.git] / scilab / modules / linear_algebra / tests / nonreg_tests / bug_9196.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru
4 // Copyright (C) 2013 - MichaĆ«l Baudin
5 //
6 //  This file is distributed under the same license as the Scilab package.
7 // =============================================================================
8 // <-- CLI SHELL MODE -->
9 // <-- Non-regression test for bug 9196 -->
10 //
11 // <-- Bugzilla URL -->
12 // http://bugzilla.scilab.org/show_bug.cgi?id=9196
13 //
14 // <-- Short Description -->
15 //    The threshold level for conditioning in backslash is too small.
16 // =============================================================================
17 n=9;
18 A = testmatrix("hilb",n);
19 b=ones(n,1);
20 xexpected=[7129/2520
21            4861/2520
22            42131/27720
23            35201/27720
24            395243/360360
25            348911/360360
26            62575/72072
27            113567/144144
28            1768477/2450448];
29 x=A\b;
30 assert_checkalmostequal(x, xexpected);
31 Ac=complex(A,zeros(A));
32 bc=complex(b,zeros(b));
33 xc = Ac\bc;
34 xcexpected=complex(xexpected,zeros(xexpected));
35 assert_checkalmostequal(xc, xexpected);
36 b=(1:n)';
37 xexpected=[9;
38            17819/2520;
39            82609/13860;
40            47959/9240;
41            415567/90090;
42            299737/72072;
43            45533/12012;
44            71761/20592;
45            988277/306306];
46 x=A\b;
47 assert_checkalmostequal(x, xexpected);
48 Ac=complex(A,zeros(A));
49 bc=complex(b,zeros(b));
50 xc = Ac\bc;
51 xcexpected=complex(xexpected,zeros(xexpected));
52 assert_checkalmostequal(xc, xexpected);
53 b=[1;-1;1;-1;1;-1;1;-1;1];
54 xexpected=[1879/2520;
55            893/2520;
56            6557/27720;
57            4993/27720;
58            52901/360360;
59            44911/360360;
60            39173/360360;
61            69659/720720;
62            1068047/12252240];
63 x=A\b;
64 assert_checkalmostequal(x, xexpected);
65 Ac=complex(A,zeros(A));
66 bc=complex(b,zeros(b));
67 xc = Ac\bc;
68 xcexpected=complex(xexpected,zeros(xexpected));
69 assert_checkalmostequal(xc, xexpected);