pre-0.0.3 #46

Merged
altavir merged 75 commits from dev into master 2019-02-20 13:05:39 +03:00
2 changed files with 27 additions and 10 deletions
Showing only changes of commit 2b4419823b - Show all commits

View File

@ -30,12 +30,14 @@ fun main() {
//commons-math //commons-math
val cmSolver = CMMatrixContext val cmContext = CMMatrixContext
val commonsTime = measureTimeMillis { val commonsTime = measureTimeMillis {
val cm = matrix.toCM() //avoid overhead on conversion cmContext.run {
repeat(n) { val cm = matrix.toCM() //avoid overhead on conversion
val res = cmSolver.inverse(cm) repeat(n) {
val res = inverse(cm)
}
} }
} }
@ -50,7 +52,7 @@ fun main() {
komaContext.run { komaContext.run {
val km = matrix.toKoma() //avoid overhead on conversion val km = matrix.toKoma() //avoid overhead on conversion
repeat(n) { repeat(n) {
val res = cmSolver.inverse(km) val res = inverse(km)
} }
} }
} }

View File

@ -1,5 +1,6 @@
package scientifik.kmath.linear package scientifik.kmath.linear
import koma.matrix.ejml.EJMLMatrixFactory
import kotlin.random.Random import kotlin.random.Random
import kotlin.system.measureTimeMillis import kotlin.system.measureTimeMillis
@ -13,14 +14,28 @@ fun main() {
// //warmup // //warmup
// matrix1 dot matrix2 // matrix1 dot matrix2
val cmMatrix1 = matrix1.toCM() CMMatrixContext.run {
val cmMatrix2 = matrix2.toCM() val cmMatrix1 = matrix1.toCM()
val cmMatrix2 = matrix2.toCM()
val cmTime = measureTimeMillis { val cmTime = measureTimeMillis {
cmMatrix1 dot cmMatrix2 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 genericTime = measureTimeMillis {
val res = matrix1 dot matrix2 val res = matrix1 dot matrix2