Update examples to use with
instead of invoke
on algebras
This commit is contained in:
parent
cd4bfdf59e
commit
a384b323c3
@ -10,7 +10,6 @@ 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 org.openjdk.jmh.annotations.Scope
|
||||
import org.openjdk.jmh.annotations.State
|
||||
import kotlin.random.Random
|
||||
@ -34,14 +33,14 @@ internal class LinearAlgebraBenchmark {
|
||||
|
||||
@Benchmark
|
||||
fun cmLUPInversion() {
|
||||
CMMatrixContext {
|
||||
with(CMMatrixContext) {
|
||||
inverse(matrix)
|
||||
}
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
fun ejmlInverse() {
|
||||
EjmlMatrixContext {
|
||||
with(EjmlMatrixContext) {
|
||||
inverse(matrix)
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package kscience.kmath.benchmarks
|
||||
|
||||
import kscience.kmath.nd.*
|
||||
import kscience.kmath.operations.RealField
|
||||
import kscience.kmath.operations.invoke
|
||||
import kscience.kmath.structures.Buffer
|
||||
import org.openjdk.jmh.annotations.Benchmark
|
||||
import org.openjdk.jmh.annotations.Scope
|
||||
@ -12,7 +11,7 @@ import org.openjdk.jmh.annotations.State
|
||||
internal class NDFieldBenchmark {
|
||||
@Benchmark
|
||||
fun autoFieldAdd() {
|
||||
autoField {
|
||||
with(autoField) {
|
||||
var res: NDStructure<Double> = one
|
||||
repeat(n) { res += one }
|
||||
}
|
||||
@ -20,7 +19,7 @@ internal class NDFieldBenchmark {
|
||||
|
||||
@Benchmark
|
||||
fun specializedFieldAdd() {
|
||||
specializedField {
|
||||
with(specializedField) {
|
||||
var res: NDStructure<Double> = one
|
||||
repeat(n) { res += 1.0 }
|
||||
}
|
||||
@ -29,7 +28,7 @@ internal class NDFieldBenchmark {
|
||||
|
||||
@Benchmark
|
||||
fun boxingFieldAdd() {
|
||||
genericField {
|
||||
with(genericField) {
|
||||
var res: NDStructure<Double> = one
|
||||
repeat(n) { res += 1.0 }
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package kscience.kmath.benchmarks
|
||||
|
||||
import kscience.kmath.nd.*
|
||||
import kscience.kmath.operations.RealField
|
||||
import kscience.kmath.operations.invoke
|
||||
import kscience.kmath.viktor.ViktorNDField
|
||||
import org.jetbrains.bio.viktor.F64Array
|
||||
import org.openjdk.jmh.annotations.Benchmark
|
||||
@ -21,7 +20,7 @@ internal class ViktorBenchmark {
|
||||
|
||||
@Benchmark
|
||||
fun automaticFieldAddition() {
|
||||
autoField {
|
||||
with(autoField) {
|
||||
var res: NDStructure<Double> = one
|
||||
repeat(n) { res += 1.0 }
|
||||
}
|
||||
@ -29,7 +28,7 @@ internal class ViktorBenchmark {
|
||||
|
||||
@Benchmark
|
||||
fun realFieldAddition() {
|
||||
realField {
|
||||
with(realField) {
|
||||
var res: NDStructure<Double> = one
|
||||
repeat(n) { res += 1.0 }
|
||||
}
|
||||
@ -37,7 +36,7 @@ internal class ViktorBenchmark {
|
||||
|
||||
@Benchmark
|
||||
fun viktorFieldAddition() {
|
||||
viktorField {
|
||||
with(viktorField) {
|
||||
var res = one
|
||||
repeat(n) { res += 1.0 }
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package kscience.kmath.benchmarks
|
||||
|
||||
import kscience.kmath.nd.*
|
||||
import kscience.kmath.operations.RealField
|
||||
import kscience.kmath.operations.invoke
|
||||
import kscience.kmath.viktor.ViktorNDField
|
||||
import org.jetbrains.bio.viktor.F64Array
|
||||
import org.openjdk.jmh.annotations.Benchmark
|
||||
@ -22,7 +21,7 @@ internal class ViktorLogBenchmark {
|
||||
|
||||
@Benchmark
|
||||
fun realFieldLog() {
|
||||
realField {
|
||||
with(realField) {
|
||||
val fortyTwo = produce { 42.0 }
|
||||
var res = one
|
||||
repeat(n) { res = ln(fortyTwo) }
|
||||
@ -31,7 +30,7 @@ internal class ViktorLogBenchmark {
|
||||
|
||||
@Benchmark
|
||||
fun viktorFieldLog() {
|
||||
viktorField {
|
||||
with(viktorField) {
|
||||
val fortyTwo = produce { 42.0 }
|
||||
var res = one
|
||||
repeat(n) { res = ln(fortyTwo) }
|
||||
|
Loading…
Reference in New Issue
Block a user