QR decomposition: Difference between revisions
Content added Content deleted
(Realize in F#) |
|||
Line 1,469: | Line 1,469: | ||
[[1], [2], [3]]</pre> |
[[1], [2], [3]]</pre> |
||
=={{header|F_Sharp|F#}}== |
|||
<lang fsharp> |
|||
// QR decomposition. Nigel Galloway: January 11th., 2022 |
|||
let n=[[12.0;-51.0;4.0];[6.0;167.0;-68.0];[-4.0;24.0;-41.0]]|>MathNet.Numerics.LinearAlgebra.MatrixExtensions.matrix |
|||
let g=n|>MathNet.Numerics.LinearAlgebra.Matrix.qr |
|||
printfn $"Matrix\n------\n%A{n}\nQ\n-\n%A{g.Q}\nR\n-\n%A{g.R}" |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
Matrix |
|||
------ |
|||
DenseMatrix 3x3-Double |
|||
12 -51 4 |
|||
6 167 -68 |
|||
-4 24 -41 |
|||
Q |
|||
- |
|||
DenseMatrix 3x3-Double |
|||
-0.857143 0.394286 -0.331429 |
|||
-0.428571 -0.902857 0.0342857 |
|||
0.285714 -0.171429 -0.942857 |
|||
R |
|||
- |
|||
DenseMatrix 3x3-Double |
|||
-14 -21 14 |
|||
0 -175 70 |
|||
0 0 35 |
|||
</pre> |
|||
=={{header|Fortran}}== |
=={{header|Fortran}}== |
||