Merge branch 'master' into dev
This commit is contained in:
commit
8662935dbe
@ -1,37 +0,0 @@
|
||||
package scientifik.kmath.coroutines
|
||||
|
||||
import scientifik.kmath.operations.RealField
|
||||
import scientifik.kmath.operations.SpaceOperations
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* A suspendable univariate function defined in algebraic context
|
||||
*/
|
||||
interface UFunction<T, C : SpaceOperations<T>> {
|
||||
suspend operator fun C.invoke(arg: T): T
|
||||
}
|
||||
|
||||
suspend fun UFunction<Double, RealField>.invoke(arg: Double) = RealField.invoke(arg)
|
||||
|
||||
/**
|
||||
* A suspendable multivariate (N->1) function defined on algebraic context
|
||||
*/
|
||||
interface MFunction<T, C : SpaceOperations<T>> {
|
||||
/**
|
||||
* The input dimension of the function
|
||||
*/
|
||||
val dimension: UInt
|
||||
|
||||
suspend operator fun C.invoke(vararg args: T): T
|
||||
}
|
||||
|
||||
suspend fun MFunction<Double, RealField>.invoke(args: DoubleArray) = RealField.invoke(*args.toTypedArray())
|
||||
@JvmName("varargInvoke")
|
||||
suspend fun MFunction<Double, RealField>.invoke(vararg args: Double) = RealField.invoke(*args.toTypedArray())
|
||||
|
||||
/**
|
||||
* A suspendable univariate function with parameter
|
||||
*/
|
||||
interface ParametricUFunction<T, P, C : SpaceOperations<T>> {
|
||||
suspend operator fun C.invoke(arg: T, parameter: P): T
|
||||
}
|
23
kmath-functions/build.gradle.kts
Normal file
23
kmath-functions/build.gradle.kts
Normal file
@ -0,0 +1,23 @@
|
||||
plugins {
|
||||
id("scientifik.mpp")
|
||||
//id("scientifik.atomic")
|
||||
}
|
||||
|
||||
kotlin.sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api(project(":kmath-core"))
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Scientifik.coroutinesVersion}")
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Scientifik.coroutinesVersion}")
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Scientifik.coroutinesVersion}")
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
package scientifik.kmath.functions
|
||||
|
@ -0,0 +1,4 @@
|
||||
package scientifik.kmath.functions
|
||||
|
||||
interface Polynomial {
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package scientifik.kmath.misc
|
||||
|
||||
import scientifik.kmath.operations.RealField
|
||||
import scientifik.kmath.operations.SpaceOperations
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
/**
|
||||
* A regular function that could be called only inside specific algebra context
|
||||
*/
|
||||
interface UFunction<T, C : SpaceOperations<T>> {
|
||||
operator fun C.invoke(arg: T): T
|
||||
}
|
||||
|
||||
/**
|
||||
* A suspendable univariate function defined in algebraic context
|
||||
*/
|
||||
interface USFunction<T, C : SpaceOperations<T>> {
|
||||
suspend operator fun C.invoke(arg: T): T
|
||||
}
|
||||
|
||||
suspend fun USFunction<Double, RealField>.invoke(arg: Double) = RealField.invoke(arg)
|
||||
|
||||
|
||||
interface MFunction<T, C : SpaceOperations<T>> {
|
||||
/**
|
||||
* The input dimension of the function
|
||||
*/
|
||||
val dimension: UInt
|
||||
|
||||
operator fun C.invoke(vararg args: T): T
|
||||
}
|
||||
|
||||
/**
|
||||
* A suspendable multivariate (N->1) function defined on algebraic context
|
||||
*/
|
||||
interface MSFunction<T, C : SpaceOperations<T>> {
|
||||
/**
|
||||
* The input dimension of the function
|
||||
*/
|
||||
val dimension: UInt
|
||||
|
||||
suspend operator fun C.invoke(vararg args: T): T
|
||||
}
|
||||
|
||||
suspend fun MSFunction<Double, RealField>.invoke(args: DoubleArray) = RealField.invoke(*args.toTypedArray())
|
||||
@JvmName("varargInvoke")
|
||||
suspend fun MSFunction<Double, RealField>.invoke(vararg args: Double) = RealField.invoke(*args.toTypedArray())
|
||||
|
||||
/**
|
||||
* A suspendable parametric function with parameter
|
||||
*/
|
||||
interface PSFunction<T, P, C : SpaceOperations<T>> {
|
||||
suspend operator fun C.invoke(arg: T, parameter: P): T
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package scientifik.kmath.interpolation
|
||||
|
||||
import scientifik.kmath.functions.MathFunction
|
||||
|
||||
interface Interpolator<X, Y> {
|
||||
fun interpolate(points: Collection<Pair<X, Y>>): MathFunction<X, *, Y>
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package scientifik.kmath.interpolation
|
||||
|
||||
class LinearInterpolator {
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package scientifik.kmath.interpolation
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
class LinearInterpolatorTest
|
Loading…
Reference in New Issue
Block a user