Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/QR-decomposition/Scala/qr-decomposition.scala
Normal file
22
Task/QR-decomposition/Scala/qr-decomposition.scala
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import java.io.{PrintWriter, StringWriter}
|
||||
|
||||
import Jama.{Matrix, QRDecomposition}
|
||||
|
||||
object QRDecomposition extends App {
|
||||
val matrix =
|
||||
new Matrix(
|
||||
Array[Array[Double]](Array(12, -51, 4),
|
||||
Array(6, 167, -68),
|
||||
Array(-4, 24, -41)))
|
||||
val d = new QRDecomposition(matrix)
|
||||
|
||||
def toString(m: Matrix): String = {
|
||||
val sw = new StringWriter
|
||||
m.print(new PrintWriter(sw, true), 8, 6)
|
||||
sw.toString
|
||||
}
|
||||
|
||||
print(toString(d.getQ))
|
||||
print(toString(d.getR))
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue