There is a bug in Matrix package, please check it, thanks!

 

 

Matlab result:

 

x =

     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

 

>> lu(x)

 

ans =

 

   21.0000   22.0000   23.0000   24.0000   25.0000

    0.0476    0.9524    1.9048    2.8571    3.8095

    0.7619    0.2500   -0.0000   -0.0000   -0.0000

    0.5238    0.5000    0.4839         0    0.0000

    0.2857    0.7500   -0.0645         0    0.0000

 

 

Gsl result:

 

21 22 23 24 25 

0.047619 0.952381 1.90476 2.85714 3.80952 

0.761905 0.25 -3.44169e-015 -6.88338e-015 -1.03251e-014 

0.52381 0.5 -0.0322581 -1.77636e-015 -1.66533e-015 

0.285714 0.75 -0.0645161 -0 2.22045e-016

 

 

R result:

$L

5 x 5 Matrix of class "dtrMatrix"

     [,1]       [,2]       [,3]       [,4]       [,5]      

[1,] 1.00000000          .          .          .          .

[2,] 0.04761905 1.00000000          .          .          .

[3,] 0.52380952 0.50000000 1.00000000          .          .

[4,] 0.28571429 0.75000000 0.35400130 1.00000000          .

[5,] 0.76190476 0.25000000 0.50000000 0.00000000 1.00000000

 

$U

5 x 5 Matrix of class "dtrMatrix"

     [,1]          [,2]          [,3]          [,4]          [,5]         

[1,]  2.100000e+01  2.200000e+01  2.300000e+01  2.400000e+01  2.500000e+01

[2,]             .  9.523810e-01  1.904762e+00  2.857143e+00  3.809524e+00

[3,]             .             . -1.919092e-15 -3.711332e-15 -5.614541e-15

[4,]             .             .             .  3.781500e-16  6.288326e-16

[5,]             .             .             .             .  0.000000e+00

 

 

 

 

 


	[[alternative HTML version deleted]]

