Fix benchmarks source set #200

Merged
CommanderTvis merged 3 commits from commandertvis/fix-benchmarks into dev 2021-02-11 10:55:40 +03:00
7 changed files with 19 additions and 15 deletions
Showing only changes of commit e6876c3f97 - Show all commits

View File

@ -14,7 +14,7 @@ import org.openjdk.jmh.annotations.State
import kotlin.random.Random import kotlin.random.Random
@State(Scope.Benchmark) @State(Scope.Benchmark)
class DotBenchmark { internal class DotBenchmark {
companion object { companion object {
val random = Random(12224) val random = Random(12224)
val dim = 1000 val dim = 1000

View File

@ -1,6 +1,8 @@
package kscience.kmath.ast package kscience.kmath.benchmarks
import kscience.kmath.asm.compile import kscience.kmath.asm.compile
import kscience.kmath.ast.MstField
import kscience.kmath.ast.mstInField
import kscience.kmath.expressions.Expression import kscience.kmath.expressions.Expression
import kscience.kmath.expressions.expressionInField import kscience.kmath.expressions.expressionInField
import kscience.kmath.expressions.invoke import kscience.kmath.expressions.invoke
@ -28,7 +30,7 @@ internal class ExpressionsInterpretersBenchmark {
@Benchmark @Benchmark
fun mstExpression() { fun mstExpression() {
val expr = algebra.mstInField { val expr = algebra.mstInField {
symbol("x") * 2.0 + 2.0 / symbol("x") - 16.0 MstField.symbol("x") * 2.0 + 2.0 / MstField.symbol("x") - 16.0
} }
invokeAndSum(expr) invokeAndSum(expr)
@ -37,7 +39,7 @@ internal class ExpressionsInterpretersBenchmark {
@Benchmark @Benchmark
fun asmExpression() { fun asmExpression() {
val expr = algebra.mstInField { val expr = algebra.mstInField {
symbol("x") * 2.0 + 2.0 / symbol("x") - 16.0 MstField.symbol("x") * 2.0 + 2.0 / MstField.symbol("x") - 16.0
}.compile() }.compile()
invokeAndSum(expr) invokeAndSum(expr)

View File

@ -1,5 +1,4 @@
package kscience.kmath.linear package kscience.kmath.benchmarks
import kotlinx.benchmark.Benchmark import kotlinx.benchmark.Benchmark
import kscience.kmath.commons.linear.CMMatrixContext import kscience.kmath.commons.linear.CMMatrixContext
@ -7,14 +6,17 @@ import kscience.kmath.commons.linear.CMMatrixContext.dot
import kscience.kmath.commons.linear.inverse import kscience.kmath.commons.linear.inverse
import kscience.kmath.ejml.EjmlMatrixContext import kscience.kmath.ejml.EjmlMatrixContext
import kscience.kmath.ejml.inverse import kscience.kmath.ejml.inverse
import kscience.kmath.linear.Matrix
import kscience.kmath.linear.MatrixContext
import kscience.kmath.linear.inverseWithLup
import kscience.kmath.linear.real
import kscience.kmath.operations.invoke import kscience.kmath.operations.invoke
import kscience.kmath.structures.Matrix
import org.openjdk.jmh.annotations.Scope import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State import org.openjdk.jmh.annotations.State
import kotlin.random.Random import kotlin.random.Random
@State(Scope.Benchmark) @State(Scope.Benchmark)
class LinearAlgebraBenchmark { internal class LinearAlgebraBenchmark {
companion object { companion object {
val random = Random(1224) val random = Random(1224)
val dim = 100 val dim = 100