File: rtest_dgesv.mac

package info (click to toggle)
maxima 5.44.0-2
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 108,368 kB
  • sloc: lisp: 383,860; fortran: 14,665; perl: 14,369; tcl: 11,147; sh: 4,517; makefile: 2,580; ansic: 447; python: 262; xml: 59; awk: 37; sed: 17
file content (53 lines) | stat: -rw-r--r-- 1,569 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
(if not ?fboundp ('dgesv) then load("lapack"),
  'done);
'done$

(float_approx_equal_tolerance : 1e-12, 'done);
'done$

block([A, b, x],
  (A : matrix ([1, -2.5], [0.375, 5]),
   b : matrix ([1.75], [-0.625]),
   x : dgesv (A, b),
   dlange (inf_norm, b - A.x)));
0.0$

block([A, b, x],
  (A : matrix ([1, -0.15], [1.82, 2]),
   b : matrix ([3.7, 1, 8], [-2.3, 5, -3.9]),
   x : dgesv (A, b),
   dlange (inf_norm, b - A . x)));
1.110223024625157E-15$

block([A, b, x],
  (A : matrix ([5, -%pi], [1b0, 11/17]),
   b : matrix ([%e], [sin(1)]),
   x : dgesv (A, b),
   dlange (inf_norm, b - A . x)));
2.220446049250313E-16$

/*
From Intel Math Kernel Library LAPACK Examples
mkl_lapack_examples/dgesv_ex.c.htm */
block([A, b],
  (A: matrix(
    [     6.80,  -6.05,  -0.45,   8.32,  -9.67],
    [    -2.11,  -3.30,   2.58,   2.71,  -5.14],
    [     5.66,   5.36,  -2.70,   4.35,  -7.26],
    [     5.97,  -4.44,   0.27,  -7.17,   6.08],
    [     8.23,   1.08,   9.04,   2.14,  -6.87]),
   b: matrix(
    [     4.02,  -1.56,   9.81],
    [     6.19,   4.00,  -4.09],
    [    -8.22,  -8.67,  -4.57],
    [    -7.57,   1.75,  -8.61],
    [    -3.03,   2.86,   8.99]),
  dgesv(A, b)));
matrix([-0.8007140257202475,-0.3896213930191952,0.9554649124194904],
       [-0.6952433844403112,-0.554427127353211,0.2206596269817108],
       [0.593914994899136,0.842227385604611,1.900636731558973],
       [1.321725609087391,-0.1038018538074622,5.357661487175357],
       [0.5657561965738039,0.1057109514742748,4.040602658253425])$

(reset(float_approx_equal_tolerance), 'done);
'done$