forked from kscience/kmath
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 {
|
||||
cmContext.run {
|
||||
val cm = matrix.toCM() //avoid overhead on conversion
|
||||
repeat(n) {
|
||||
val res = cmSolver.inverse(cm)
|
||||
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,6 +14,7 @@ fun main() {
|
||||
// //warmup
|
||||
// matrix1 dot matrix2
|
||||
|
||||
CMMatrixContext.run {
|
||||
val cmMatrix1 = matrix1.toCM()
|
||||
val cmMatrix2 = matrix2.toCM()
|
||||
|
||||
@ -21,6 +23,19 @@ fun main() {
|
||||
}
|
||||
|
||||
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