Fixed performance tests.
This commit is contained in:
parent
6154588534
commit
2b4419823b
@ -30,12 +30,14 @@ fun main() {
|
||||
|
||||
//commons-math
|
||||
|
||||
val cmSolver = CMMatrixContext
|
||||
val cmContext = CMMatrixContext
|
||||
|
||||
val commonsTime = measureTimeMillis {
|
||||
val cm = matrix.toCM() //avoid overhead on conversion
|
||||
repeat(n) {
|
||||
val res = cmSolver.inverse(cm)
|
||||
cmContext.run {
|
||||
val cm = matrix.toCM() //avoid overhead on conversion
|
||||
repeat(n) {
|
||||
val res = inverse(cm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +52,7 @@ fun main() {
|
||||
komaContext.run {
|
||||
val km = matrix.toKoma() //avoid overhead on conversion
|
||||
repeat(n) {
|
||||
val res = cmSolver.inverse(km)
|
||||
val res = inverse(km)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package scientifik.kmath.linear
|
||||
|
||||
import koma.matrix.ejml.EJMLMatrixFactory
|
||||
import kotlin.random.Random
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
@ -13,14 +14,28 @@ fun main() {
|
||||
// //warmup
|
||||
// matrix1 dot matrix2
|
||||
|
||||
val cmMatrix1 = matrix1.toCM()
|
||||
val cmMatrix2 = matrix2.toCM()
|
||||
CMMatrixContext.run {
|
||||
val cmMatrix1 = matrix1.toCM()
|
||||
val cmMatrix2 = matrix2.toCM()
|
||||
|
||||
val cmTime = measureTimeMillis {
|
||||
cmMatrix1 dot cmMatrix2
|
||||
val cmTime = measureTimeMillis {
|
||||
cmMatrix1 dot cmMatrix2
|
||||
}
|
||||
|
||||
println("CM implementation time: $cmTime")
|
||||
}
|
||||
|
||||
println("CM implementation time: $cmTime")
|
||||
|
||||
KomaMatrixContext(EJMLMatrixFactory()).run {
|
||||
val komaMatrix1 = matrix1.toKoma()
|
||||
val komaMatrix2 = matrix2.toKoma()
|
||||
|
||||
val komaTime = measureTimeMillis {
|
||||
komaMatrix1 dot komaMatrix2
|
||||
}
|
||||
|
||||
println("Koma-ejml implementation time: $komaTime")
|
||||
}
|
||||
|
||||
val genericTime = measureTimeMillis {
|
||||
val res = matrix1 dot matrix2
|
||||
|
Loading…
Reference in New Issue
Block a user