summaryrefslogtreecommitdiff
path: root/src/main/scala/com/nsrddyn/FPU
diff options
context:
space:
mode:
authornasr <nsrddyn@gmail.com>2025-11-26 23:11:25 +0100
committernasr <nsrddyn@gmail.com>2025-11-26 23:11:25 +0100
commit5c90505fe7b6566049bead5e36a5e3f73d844413 (patch)
treed65a6402dd93d0e8ccb464eb5eab382e625a67d1 /src/main/scala/com/nsrddyn/FPU
parentd6f99d058b34d5b6fbc3f630bf491b302cdf324f (diff)
chore: file refactor, imported zio
next steps are running the threads multithreaded and measuring for errors
Diffstat (limited to 'src/main/scala/com/nsrddyn/FPU')
-rw-r--r--src/main/scala/com/nsrddyn/FPU/CholeskyDecomposition.scala46
-rw-r--r--src/main/scala/com/nsrddyn/FPU/FPU.scala6
-rw-r--r--src/main/scala/com/nsrddyn/FPU/Matrix.scala5
3 files changed, 0 insertions, 57 deletions
diff --git a/src/main/scala/com/nsrddyn/FPU/CholeskyDecomposition.scala b/src/main/scala/com/nsrddyn/FPU/CholeskyDecomposition.scala
deleted file mode 100644
index 895473a..0000000
--- a/src/main/scala/com/nsrddyn/FPU/CholeskyDecomposition.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.nsrddyn.fpu
-
-import scala.math._
-import scala.collection.immutable.ListSet
-import scala.collection.mutable.ArrayBuffer
-
-class CholeskyDecomposition {
-
- /*
- * Floating point operation to stress the cpu
- * Calculate the number of KFLOPS / FLOPS
- * implementation of the Cholesky decomposition
- * More information on the Cholesky decomposition at:
- * https://en.wikipedia.org/wiki/Cholesky_decomposition
- *
- * Linpack uses the cholesky decomposition
- * https://www.netlib.org/linpack/
- *
- * https://www.geeksforgeeks.org/dsa/cholesky-decomposition-matrix-decomposition/
- *
- * The Cholesky decomposition maps matrix A into the product of A = L ยท LH where L is the lower triangular matrix and LH is the transposed,
- * complex conjugate or Hermitian, and therefore of upper triangular form (Fig. 13.6).
- * This is true because of the special case of A being a square, conjugate symmetric matrix.
- */
-
- def run(matrix: Vector[Vector[Int]]): Unit = {
-
- val size: Int = matrix.size
- val lower: ArrayBuffer[ArrayBuffer[Int]] = ArrayBuffer[ArrayBuffer[Int]]()
-
- for
- i <- 0 to size
- j <- 0 until i
- do
- if i == j then lower(i)(j) = getSquaredSummation(lower, i, j, matrix) else lower(j)(j) = getReversedSummation(lower, i, j, matrix)
-
- }
-
- private def getReversedSummation(lower: ArrayBuffer[ArrayBuffer[Int]], i: Int, j: Int, matrix: Vector[Vector[Int]]) = {
- math.sqrt(matrix(j)(j) - (0 until j).map { k => lower(i)(k) * lower(j)(k) }.sum).toInt
- }
- private def getSquaredSummation(lower: ArrayBuffer[ArrayBuffer[Int]], i: Int, j: Int, matrix: Vector[Vector[Int]]) = {
- ((matrix(i)(j) - (0 until j).map { k => math.pow(lower(j)(k), 2)}.sum) / lower(j)(j)).toInt
- }
-}
-
diff --git a/src/main/scala/com/nsrddyn/FPU/FPU.scala b/src/main/scala/com/nsrddyn/FPU/FPU.scala
deleted file mode 100644
index 6532476..0000000
--- a/src/main/scala/com/nsrddyn/FPU/FPU.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.nsrddyn.fpu
-
-
-class FPU {
-
-}
diff --git a/src/main/scala/com/nsrddyn/FPU/Matrix.scala b/src/main/scala/com/nsrddyn/FPU/Matrix.scala
deleted file mode 100644
index 7f1bccf..0000000
--- a/src/main/scala/com/nsrddyn/FPU/Matrix.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.nsrddyn.fpu
-
-class Matrix {
-
-}