LU decomposition: Difference between revisions

Content added Content deleted
(added R)
Line 1,801: Line 1,801:
[0.0, 1.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0]]</pre>
[0.0, 0.0, 0.0, 1.0]]</pre>


=={{header|R}}==
{{Out}}
<pre>
> A <- c(1, 2, 1, 3, 4, 1, 5, 7, 0)
> dim(A) <- c(3, 3)
> library(Matrix)
> expand(lu(A))
$L
3 x 3 Matrix of class "dtrMatrix" (unitriangular)
[,1] [,2] [,3]
[1,] 1.0 . .
[2,] 0.5 1.0 .
[3,] 0.5 -1.0 1.0

$U
3 x 3 Matrix of class "dtrMatrix"
[,1] [,2] [,3]
[1,] 2.0 4.0 7.0
[2,] . 1.0 1.5
[3,] . . -2.0

$P
3 x 3 sparse Matrix of class "pMatrix"
[1,] . | .
[2,] | . .
[3,] . . |
</pre>



=={{header|Racket}}==
=={{header|Racket}}==