Encapsulate internal constants in Expression
This commit is contained in:
parent
b14e2fdd08
commit
991ab907d8
@ -50,6 +50,8 @@ kotlin {
|
|||||||
|
|
||||||
val jvmMain by getting {
|
val jvmMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation("org.openjdk.jmh:jmh-core:1.36")
|
||||||
|
implementation("org.openjdk.jmh:jmh-generator-annprocess:1.36")
|
||||||
implementation(project(":kmath-commons"))
|
implementation(project(":kmath-commons"))
|
||||||
implementation(project(":kmath-ejml"))
|
implementation(project(":kmath-ejml"))
|
||||||
implementation(project(":kmath-nd4j"))
|
implementation(project(":kmath-nd4j"))
|
||||||
@ -144,13 +146,6 @@ benchmark {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix kotlinx-benchmarks bug
|
|
||||||
afterEvaluate {
|
|
||||||
val jvmBenchmarkJar by tasks.getting(org.gradle.jvm.tasks.Jar::class) {
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin.sourceSets.all {
|
kotlin.sourceSets.all {
|
||||||
with(languageSettings) {
|
with(languageSettings) {
|
||||||
optIn("kotlin.contracts.ExperimentalContracts")
|
optIn("kotlin.contracts.ExperimentalContracts")
|
||||||
|
@ -48,6 +48,10 @@ public interface DoubleExpression : Expression<Double> {
|
|||||||
* @return the value.
|
* @return the value.
|
||||||
*/
|
*/
|
||||||
public operator fun invoke(arguments: DoubleArray): Double
|
public operator fun invoke(arguments: DoubleArray): Double
|
||||||
|
|
||||||
|
public companion object{
|
||||||
|
internal val EMPTY_DOUBLE_ARRAY = DoubleArray(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,6 +77,10 @@ public interface IntExpression : Expression<Int> {
|
|||||||
* @return the value.
|
* @return the value.
|
||||||
*/
|
*/
|
||||||
public operator fun invoke(arguments: IntArray): Int
|
public operator fun invoke(arguments: IntArray): Int
|
||||||
|
|
||||||
|
public companion object{
|
||||||
|
internal val EMPTY_INT_ARRAY = IntArray(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,6 +106,10 @@ public interface LongExpression : Expression<Long> {
|
|||||||
* @return the value.
|
* @return the value.
|
||||||
*/
|
*/
|
||||||
public operator fun invoke(arguments: LongArray): Long
|
public operator fun invoke(arguments: LongArray): Long
|
||||||
|
|
||||||
|
public companion object{
|
||||||
|
internal val EMPTY_LONG_ARRAY = LongArray(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +157,7 @@ public operator fun <T> Expression<T>.invoke(vararg pairs: Pair<String, T>): T =
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
private val EMPTY_DOUBLE_ARRAY = DoubleArray(0)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls this expression without providing any arguments.
|
* Calls this expression without providing any arguments.
|
||||||
@ -153,7 +165,7 @@ private val EMPTY_DOUBLE_ARRAY = DoubleArray(0)
|
|||||||
* @return a value.
|
* @return a value.
|
||||||
*/
|
*/
|
||||||
@UnstableKMathAPI
|
@UnstableKMathAPI
|
||||||
public operator fun DoubleExpression.invoke(): Double = this(EMPTY_DOUBLE_ARRAY)
|
public operator fun DoubleExpression.invoke(): Double = this(DoubleExpression.EMPTY_DOUBLE_ARRAY)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls this expression from arguments.
|
* Calls this expression from arguments.
|
||||||
@ -164,15 +176,13 @@ public operator fun DoubleExpression.invoke(): Double = this(EMPTY_DOUBLE_ARRAY)
|
|||||||
@UnstableKMathAPI
|
@UnstableKMathAPI
|
||||||
public operator fun DoubleExpression.invoke(vararg arguments: Double): Double = this(arguments)
|
public operator fun DoubleExpression.invoke(vararg arguments: Double): Double = this(arguments)
|
||||||
|
|
||||||
private val EMPTY_INT_ARRAY = IntArray(0)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls this expression without providing any arguments.
|
* Calls this expression without providing any arguments.
|
||||||
*
|
*
|
||||||
* @return a value.
|
* @return a value.
|
||||||
*/
|
*/
|
||||||
@UnstableKMathAPI
|
@UnstableKMathAPI
|
||||||
public operator fun IntExpression.invoke(): Int = this(EMPTY_INT_ARRAY)
|
public operator fun IntExpression.invoke(): Int = this(IntExpression.EMPTY_INT_ARRAY)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls this expression from arguments.
|
* Calls this expression from arguments.
|
||||||
@ -183,15 +193,13 @@ public operator fun IntExpression.invoke(): Int = this(EMPTY_INT_ARRAY)
|
|||||||
@UnstableKMathAPI
|
@UnstableKMathAPI
|
||||||
public operator fun IntExpression.invoke(vararg arguments: Int): Int = this(arguments)
|
public operator fun IntExpression.invoke(vararg arguments: Int): Int = this(arguments)
|
||||||
|
|
||||||
private val EMPTY_LONG_ARRAY = LongArray(0)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls this expression without providing any arguments.
|
* Calls this expression without providing any arguments.
|
||||||
*
|
*
|
||||||
* @return a value.
|
* @return a value.
|
||||||
*/
|
*/
|
||||||
@UnstableKMathAPI
|
@UnstableKMathAPI
|
||||||
public operator fun LongExpression.invoke(): Long = this(EMPTY_LONG_ARRAY)
|
public operator fun LongExpression.invoke(): Long = this(LongExpression.EMPTY_LONG_ARRAY)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls this expression from arguments.
|
* Calls this expression from arguments.
|
||||||
|
Loading…
Reference in New Issue
Block a user