0.3.1 #514

Merged
altavir merged 36 commits from dev into master 2023-05-12 22:19:49 +03:00
27 changed files with 242 additions and 167 deletions
Showing only changes of commit b2746e5c0e - Show all commits

View File

@ -2,6 +2,7 @@
## [Unreleased] ## [Unreleased]
### Added ### Added
- Wasm support for `memory`, `core`, `complex` and `functions` modules.
- Generic builders for `BufferND` and `MutableBufferND` - Generic builders for `BufferND` and `MutableBufferND`
- `NamedMatrix` - matrix with symbol-based indexing - `NamedMatrix` - matrix with symbol-based indexing
- `Expression` with default arguments - `Expression` with default arguments

View File

@ -15,7 +15,7 @@ allprojects {
} }
group = "space.kscience" group = "space.kscience"
version = "0.4.0-dev-1" version = "0.3.1-dev-RC"
} }
subprojects { subprojects {
@ -55,18 +55,6 @@ subprojects {
} }
} }
} }
plugins.withId("org.jetbrains.kotlin.multiplatform") {
configure<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension> {
sourceSets {
val commonTest by getting {
dependencies {
implementation(projects.testUtils)
}
}
}
}
}
} }
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md") readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")

View File

@ -5,7 +5,6 @@
package space.kscience.kmath.ast package space.kscience.kmath.ast
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.expressions.Expression import space.kscience.kmath.expressions.Expression
import space.kscience.kmath.expressions.Symbol import space.kscience.kmath.expressions.Symbol
import space.kscience.kmath.operations.Algebra import space.kscience.kmath.operations.Algebra
@ -16,7 +15,6 @@ import space.kscience.kmath.operations.NumericAlgebra
* *
* @param T the type. * @param T the type.
*/ */
@UnstableKMathAPI
public sealed interface TypedMst<T> { public sealed interface TypedMst<T> {
/** /**
* A node containing a unary operation. * A node containing a unary operation.
@ -133,7 +131,6 @@ public sealed interface TypedMst<T> {
/** /**
* Interprets the [TypedMst] node with this [Algebra] and [arguments]. * Interprets the [TypedMst] node with this [Algebra] and [arguments].
*/ */
@UnstableKMathAPI
public fun <T> TypedMst<T>.interpret(algebra: Algebra<T>, arguments: Map<Symbol, T>): T = when (this) { public fun <T> TypedMst<T>.interpret(algebra: Algebra<T>, arguments: Map<Symbol, T>): T = when (this) {
is TypedMst.Unary -> algebra.unaryOperation(operation, interpret(algebra, arguments)) is TypedMst.Unary -> algebra.unaryOperation(operation, interpret(algebra, arguments))
@ -158,7 +155,6 @@ public fun <T> TypedMst<T>.interpret(algebra: Algebra<T>, arguments: Map<Symbol,
/** /**
* Interprets the [TypedMst] node with this [Algebra] and optional [arguments]. * Interprets the [TypedMst] node with this [Algebra] and optional [arguments].
*/ */
@UnstableKMathAPI
public fun <T> TypedMst<T>.interpret(algebra: Algebra<T>, vararg arguments: Pair<Symbol, T>): T = interpret( public fun <T> TypedMst<T>.interpret(algebra: Algebra<T>, vararg arguments: Pair<Symbol, T>): T = interpret(
algebra, algebra,
when (arguments.size) { when (arguments.size) {
@ -171,7 +167,6 @@ public fun <T> TypedMst<T>.interpret(algebra: Algebra<T>, vararg arguments: Pair
/** /**
* Interpret this [TypedMst] node as expression. * Interpret this [TypedMst] node as expression.
*/ */
@UnstableKMathAPI
public fun <T : Any> TypedMst<T>.toExpression(algebra: Algebra<T>): Expression<T> = Expression { arguments -> public fun <T : Any> TypedMst<T>.toExpression(algebra: Algebra<T>): Expression<T> = Expression { arguments ->
interpret(algebra, arguments) interpret(algebra, arguments)
} }

View File

@ -5,7 +5,6 @@
package space.kscience.kmath.ast package space.kscience.kmath.ast
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.expressions.MST import space.kscience.kmath.expressions.MST
import space.kscience.kmath.expressions.Symbol import space.kscience.kmath.expressions.Symbol
import space.kscience.kmath.operations.Algebra import space.kscience.kmath.operations.Algebra
@ -15,7 +14,6 @@ import space.kscience.kmath.operations.bindSymbolOrNull
/** /**
* Evaluates constants in given [MST] for given [algebra] at the same time with converting to [TypedMst]. * Evaluates constants in given [MST] for given [algebra] at the same time with converting to [TypedMst].
*/ */
@UnstableKMathAPI
public fun <T> MST.evaluateConstants(algebra: Algebra<T>): TypedMst<T> = when (this) { public fun <T> MST.evaluateConstants(algebra: Algebra<T>): TypedMst<T> = when (this) {
is MST.Numeric -> TypedMst.Constant( is MST.Numeric -> TypedMst.Constant(
(algebra as? NumericAlgebra<T>)?.number(value) ?: error("Numeric nodes are not supported by $algebra"), (algebra as? NumericAlgebra<T>)?.number(value) ?: error("Numeric nodes are not supported by $algebra"),

View File

@ -5,8 +5,6 @@
package space.kscience.kmath.ast.rendering package space.kscience.kmath.ast.rendering
import space.kscience.kmath.UnstableKMathAPI
/** /**
* [SyntaxRenderer] implementation for LaTeX. * [SyntaxRenderer] implementation for LaTeX.
* *
@ -25,7 +23,6 @@ import space.kscience.kmath.UnstableKMathAPI
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public object LatexSyntaxRenderer : SyntaxRenderer { public object LatexSyntaxRenderer : SyntaxRenderer {
override fun render(node: MathSyntax, output: Appendable): Unit = output.run { override fun render(node: MathSyntax, output: Appendable): Unit = output.run {
fun render(syntax: MathSyntax) = render(syntax, output) fun render(syntax: MathSyntax) = render(syntax, output)

View File

@ -5,8 +5,6 @@
package space.kscience.kmath.ast.rendering package space.kscience.kmath.ast.rendering
import space.kscience.kmath.UnstableKMathAPI
/** /**
* [SyntaxRenderer] implementation for MathML. * [SyntaxRenderer] implementation for MathML.
* *
@ -14,7 +12,6 @@ import space.kscience.kmath.UnstableKMathAPI
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public object MathMLSyntaxRenderer : SyntaxRenderer { public object MathMLSyntaxRenderer : SyntaxRenderer {
override fun render(node: MathSyntax, output: Appendable) { override fun render(node: MathSyntax, output: Appendable) {
output.append("<math xmlns=\"https://www.w3.org/1998/Math/MathML\"><mrow>") output.append("<math xmlns=\"https://www.w3.org/1998/Math/MathML\"><mrow>")

View File

@ -5,7 +5,6 @@
package space.kscience.kmath.ast.rendering package space.kscience.kmath.ast.rendering
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.expressions.MST import space.kscience.kmath.expressions.MST
/** /**
@ -13,7 +12,6 @@ import space.kscience.kmath.expressions.MST
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public fun interface MathRenderer { public fun interface MathRenderer {
/** /**
* Renders [MST] to [MathSyntax]. * Renders [MST] to [MathSyntax].
@ -27,7 +25,6 @@ public fun interface MathRenderer {
* @property features The applied features. * @property features The applied features.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public open class FeaturedMathRenderer(public val features: List<RenderFeature>) : MathRenderer { public open class FeaturedMathRenderer(public val features: List<RenderFeature>) : MathRenderer {
override fun render(mst: MST): MathSyntax { override fun render(mst: MST): MathSyntax {
for (feature in features) feature.render(this, mst)?.let { return it } for (feature in features) feature.render(this, mst)?.let { return it }
@ -51,7 +48,6 @@ public open class FeaturedMathRenderer(public val features: List<RenderFeature>)
* @property stages The applied stages. * @property stages The applied stages.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public open class FeaturedMathRendererWithPostProcess( public open class FeaturedMathRendererWithPostProcess(
features: List<RenderFeature>, features: List<RenderFeature>,
public val stages: List<PostProcessPhase>, public val stages: List<PostProcessPhase>,

View File

@ -5,14 +5,11 @@
package space.kscience.kmath.ast.rendering package space.kscience.kmath.ast.rendering
import space.kscience.kmath.UnstableKMathAPI
/** /**
* Syntax node for mathematical typography. * Syntax node for mathematical typography.
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public sealed class MathSyntax { public sealed class MathSyntax {
/** /**
* The parent node of this syntax node. * The parent node of this syntax node.
@ -25,7 +22,6 @@ public sealed class MathSyntax {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public sealed class TerminalSyntax : MathSyntax() public sealed class TerminalSyntax : MathSyntax()
/** /**
@ -33,7 +29,6 @@ public sealed class TerminalSyntax : MathSyntax()
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public sealed class OperationSyntax : MathSyntax() { public sealed class OperationSyntax : MathSyntax() {
/** /**
* The operation token. * The operation token.
@ -46,7 +41,6 @@ public sealed class OperationSyntax : MathSyntax() {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public sealed class UnarySyntax : OperationSyntax() { public sealed class UnarySyntax : OperationSyntax() {
/** /**
* The operand of this node. * The operand of this node.
@ -59,7 +53,6 @@ public sealed class UnarySyntax : OperationSyntax() {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public sealed class BinarySyntax : OperationSyntax() { public sealed class BinarySyntax : OperationSyntax() {
/** /**
* The left-hand side operand. * The left-hand side operand.
@ -78,7 +71,6 @@ public sealed class BinarySyntax : OperationSyntax() {
* @property string The digits of number. * @property string The digits of number.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class NumberSyntax(public var string: String) : TerminalSyntax() public data class NumberSyntax(public var string: String) : TerminalSyntax()
/** /**
@ -87,7 +79,6 @@ public data class NumberSyntax(public var string: String) : TerminalSyntax()
* @property string The symbol. * @property string The symbol.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class SymbolSyntax(public var string: String) : TerminalSyntax() public data class SymbolSyntax(public var string: String) : TerminalSyntax()
/** /**
@ -98,7 +89,6 @@ public data class SymbolSyntax(public var string: String) : TerminalSyntax()
* @see UnaryOperatorSyntax * @see UnaryOperatorSyntax
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class OperatorNameSyntax(public var name: String) : TerminalSyntax() public data class OperatorNameSyntax(public var name: String) : TerminalSyntax()
/** /**
@ -107,7 +97,6 @@ public data class OperatorNameSyntax(public var name: String) : TerminalSyntax()
* @property kind The kind of symbol. * @property kind The kind of symbol.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class SpecialSymbolSyntax(public var kind: Kind) : TerminalSyntax() { public data class SpecialSymbolSyntax(public var kind: Kind) : TerminalSyntax() {
/** /**
* The kind of symbol. * The kind of symbol.
@ -132,7 +121,6 @@ public data class SpecialSymbolSyntax(public var kind: Kind) : TerminalSyntax()
* @property parentheses Whether the operand should be wrapped with parentheses. * @property parentheses Whether the operand should be wrapped with parentheses.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class OperandSyntax( public data class OperandSyntax(
public val operand: MathSyntax, public val operand: MathSyntax,
public var parentheses: Boolean, public var parentheses: Boolean,
@ -148,7 +136,6 @@ public data class OperandSyntax(
* @property prefix The prefix. * @property prefix The prefix.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class UnaryOperatorSyntax( public data class UnaryOperatorSyntax(
override val operation: String, override val operation: String,
public var prefix: MathSyntax, public var prefix: MathSyntax,
@ -164,7 +151,6 @@ public data class UnaryOperatorSyntax(
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class UnaryPlusSyntax( public data class UnaryPlusSyntax(
override val operation: String, override val operation: String,
override val operand: OperandSyntax, override val operand: OperandSyntax,
@ -179,7 +165,6 @@ public data class UnaryPlusSyntax(
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class UnaryMinusSyntax( public data class UnaryMinusSyntax(
override val operation: String, override val operation: String,
override val operand: OperandSyntax, override val operand: OperandSyntax,
@ -195,7 +180,6 @@ public data class UnaryMinusSyntax(
* @property operand The radicand. * @property operand The radicand.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class RadicalSyntax( public data class RadicalSyntax(
override val operation: String, override val operation: String,
override val operand: MathSyntax, override val operand: MathSyntax,
@ -213,7 +197,6 @@ public data class RadicalSyntax(
* (*e<sup>x</sup>*). * (*e<sup>x</sup>*).
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class ExponentSyntax( public data class ExponentSyntax(
override val operation: String, override val operation: String,
override val operand: OperandSyntax, override val operand: OperandSyntax,
@ -231,7 +214,6 @@ public data class ExponentSyntax(
* @property right The superscript. * @property right The superscript.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class SuperscriptSyntax( public data class SuperscriptSyntax(
override val operation: String, override val operation: String,
override val left: MathSyntax, override val left: MathSyntax,
@ -250,7 +232,6 @@ public data class SuperscriptSyntax(
* @property right The subscript. * @property right The subscript.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class SubscriptSyntax( public data class SubscriptSyntax(
override val operation: String, override val operation: String,
override val left: MathSyntax, override val left: MathSyntax,
@ -268,7 +249,6 @@ public data class SubscriptSyntax(
* @property prefix The prefix. * @property prefix The prefix.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class BinaryOperatorSyntax( public data class BinaryOperatorSyntax(
override val operation: String, override val operation: String,
public var prefix: MathSyntax, public var prefix: MathSyntax,
@ -288,7 +268,6 @@ public data class BinaryOperatorSyntax(
* @param right The addend. * @param right The addend.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class BinaryPlusSyntax( public data class BinaryPlusSyntax(
override val operation: String, override val operation: String,
override val left: OperandSyntax, override val left: OperandSyntax,
@ -307,7 +286,6 @@ public data class BinaryPlusSyntax(
* @param right The subtrahend. * @param right The subtrahend.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class BinaryMinusSyntax( public data class BinaryMinusSyntax(
override val operation: String, override val operation: String,
override val left: OperandSyntax, override val left: OperandSyntax,
@ -327,7 +305,6 @@ public data class BinaryMinusSyntax(
* @property infix Whether infix (*1 / 2*) or normal (*&frac12;*) fraction should be made. * @property infix Whether infix (*1 / 2*) or normal (*&frac12;*) fraction should be made.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class FractionSyntax( public data class FractionSyntax(
override val operation: String, override val operation: String,
override val left: OperandSyntax, override val left: OperandSyntax,
@ -347,7 +324,6 @@ public data class FractionSyntax(
* @property right The radicand. * @property right The radicand.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class RadicalWithIndexSyntax( public data class RadicalWithIndexSyntax(
override val operation: String, override val operation: String,
override val left: MathSyntax, override val left: MathSyntax,
@ -367,7 +343,6 @@ public data class RadicalWithIndexSyntax(
* @property times Whether the times (&times;) symbol should be used. * @property times Whether the times (&times;) symbol should be used.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public data class MultiplicationSyntax( public data class MultiplicationSyntax(
override val operation: String, override val operation: String,
override val left: OperandSyntax, override val left: OperandSyntax,

View File

@ -5,15 +5,12 @@
package space.kscience.kmath.ast.rendering package space.kscience.kmath.ast.rendering
import space.kscience.kmath.UnstableKMathAPI
/** /**
* Abstraction of writing [MathSyntax] as a string of an actual markup language. Typical implementation should * Abstraction of writing [MathSyntax] as a string of an actual markup language. Typical implementation should
* involve traversal of MathSyntax with handling each subtype. * involve traversal of MathSyntax with handling each subtype.
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public fun interface SyntaxRenderer { public fun interface SyntaxRenderer {
/** /**
* Renders the [MathSyntax] to [output]. * Renders the [MathSyntax] to [output].
@ -26,7 +23,6 @@ public fun interface SyntaxRenderer {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public fun SyntaxRenderer.renderWithStringBuilder(node: MathSyntax): String { public fun SyntaxRenderer.renderWithStringBuilder(node: MathSyntax): String {
val sb = StringBuilder() val sb = StringBuilder()
render(node, sb) render(node, sb)

View File

@ -5,7 +5,6 @@
package space.kscience.kmath.ast.rendering package space.kscience.kmath.ast.rendering
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.ast.rendering.FeaturedMathRenderer.RenderFeature import space.kscience.kmath.ast.rendering.FeaturedMathRenderer.RenderFeature
import space.kscience.kmath.expressions.MST import space.kscience.kmath.expressions.MST
import space.kscience.kmath.expressions.Symbol import space.kscience.kmath.expressions.Symbol
@ -17,7 +16,6 @@ import kotlin.reflect.KClass
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public val PrintSymbol: RenderFeature = RenderFeature { _, node -> public val PrintSymbol: RenderFeature = RenderFeature { _, node ->
if (node !is Symbol) null if (node !is Symbol) null
else SymbolSyntax(string = node.identity) else SymbolSyntax(string = node.identity)
@ -28,7 +26,6 @@ public val PrintSymbol: RenderFeature = RenderFeature { _, node ->
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public val PrintNumeric: RenderFeature = RenderFeature { _, node -> public val PrintNumeric: RenderFeature = RenderFeature { _, node ->
if (node !is MST.Numeric) if (node !is MST.Numeric)
null null
@ -36,7 +33,6 @@ public val PrintNumeric: RenderFeature = RenderFeature { _, node ->
NumberSyntax(string = node.value.toString()) NumberSyntax(string = node.value.toString())
} }
@UnstableKMathAPI
private fun printSignedNumberString(s: String): MathSyntax = if (s.startsWith('-')) private fun printSignedNumberString(s: String): MathSyntax = if (s.startsWith('-'))
UnaryMinusSyntax( UnaryMinusSyntax(
operation = GroupOps.MINUS_OPERATION, operation = GroupOps.MINUS_OPERATION,
@ -55,7 +51,6 @@ else
* @property types The suitable types. * @property types The suitable types.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class PrettyPrintFloats(public val types: Set<KClass<out Number>>) : RenderFeature { public class PrettyPrintFloats(public val types: Set<KClass<out Number>>) : RenderFeature {
override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? { override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? {
if (node !is MST.Numeric || node.value::class !in types) return null if (node !is MST.Numeric || node.value::class !in types) return null
@ -115,7 +110,6 @@ public class PrettyPrintFloats(public val types: Set<KClass<out Number>>) : Rend
* @property types The suitable types. * @property types The suitable types.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class PrettyPrintIntegers(public val types: Set<KClass<out Number>>) : RenderFeature { public class PrettyPrintIntegers(public val types: Set<KClass<out Number>>) : RenderFeature {
override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? = override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? =
if (node !is MST.Numeric || node.value::class !in types) if (node !is MST.Numeric || node.value::class !in types)
@ -138,7 +132,6 @@ public class PrettyPrintIntegers(public val types: Set<KClass<out Number>>) : Re
* @property symbols The allowed symbols. * @property symbols The allowed symbols.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class PrettyPrintPi(public val symbols: Set<String>) : RenderFeature { public class PrettyPrintPi(public val symbols: Set<String>) : RenderFeature {
override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? = override fun render(renderer: FeaturedMathRenderer, node: MST): MathSyntax? =
if (node !is Symbol || node.identity !in symbols) if (node !is Symbol || node.identity !in symbols)
@ -161,7 +154,6 @@ public class PrettyPrintPi(public val symbols: Set<String>) : RenderFeature {
* @param operations the allowed operations. If `null`, any operation is accepted. * @param operations the allowed operations. If `null`, any operation is accepted.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public abstract class Unary(public val operations: Collection<String>?) : RenderFeature { public abstract class Unary(public val operations: Collection<String>?) : RenderFeature {
/** /**
* The actual render function specialized for [MST.Unary]. * The actual render function specialized for [MST.Unary].
@ -182,7 +174,6 @@ public abstract class Unary(public val operations: Collection<String>?) : Render
* @property operations the allowed operations. If `null`, any operation is accepted. * @property operations the allowed operations. If `null`, any operation is accepted.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public abstract class Binary(public val operations: Collection<String>?) : RenderFeature { public abstract class Binary(public val operations: Collection<String>?) : RenderFeature {
/** /**
* The actual render function specialized for [MST.Binary]. * The actual render function specialized for [MST.Binary].
@ -200,7 +191,6 @@ public abstract class Binary(public val operations: Collection<String>?) : Rende
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class BinaryPlus(operations: Collection<String>?) : Binary(operations) { public class BinaryPlus(operations: Collection<String>?) : Binary(operations) {
override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax = override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
BinaryPlusSyntax( BinaryPlusSyntax(
@ -222,7 +212,6 @@ public class BinaryPlus(operations: Collection<String>?) : Binary(operations) {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class BinaryMinus(operations: Collection<String>?) : Binary(operations) { public class BinaryMinus(operations: Collection<String>?) : Binary(operations) {
override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax = override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
BinaryMinusSyntax( BinaryMinusSyntax(
@ -244,7 +233,6 @@ public class BinaryMinus(operations: Collection<String>?) : Binary(operations) {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class UnaryPlus(operations: Collection<String>?) : Unary(operations) { public class UnaryPlus(operations: Collection<String>?) : Unary(operations) {
override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = UnaryPlusSyntax( override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = UnaryPlusSyntax(
operation = node.operation, operation = node.operation,
@ -264,7 +252,6 @@ public class UnaryPlus(operations: Collection<String>?) : Unary(operations) {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class UnaryMinus(operations: Collection<String>?) : Unary(operations) { public class UnaryMinus(operations: Collection<String>?) : Unary(operations) {
override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = UnaryMinusSyntax( override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = UnaryMinusSyntax(
operation = node.operation, operation = node.operation,
@ -284,7 +271,6 @@ public class UnaryMinus(operations: Collection<String>?) : Unary(operations) {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class Fraction(operations: Collection<String>?) : Binary(operations) { public class Fraction(operations: Collection<String>?) : Binary(operations) {
override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax = FractionSyntax( override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax = FractionSyntax(
operation = node.operation, operation = node.operation,
@ -306,7 +292,6 @@ public class Fraction(operations: Collection<String>?) : Binary(operations) {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class BinaryOperator(operations: Collection<String>?) : Binary(operations) { public class BinaryOperator(operations: Collection<String>?) : Binary(operations) {
override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax = override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
BinaryOperatorSyntax( BinaryOperatorSyntax(
@ -329,7 +314,6 @@ public class BinaryOperator(operations: Collection<String>?) : Binary(operations
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class UnaryOperator(operations: Collection<String>?) : Unary(operations) { public class UnaryOperator(operations: Collection<String>?) : Unary(operations) {
override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax =
UnaryOperatorSyntax( UnaryOperatorSyntax(
@ -351,7 +335,6 @@ public class UnaryOperator(operations: Collection<String>?) : Unary(operations)
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class Power(operations: Collection<String>?) : Binary(operations) { public class Power(operations: Collection<String>?) : Binary(operations) {
override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax = override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
SuperscriptSyntax( SuperscriptSyntax(
@ -371,7 +354,6 @@ public class Power(operations: Collection<String>?) : Binary(operations) {
/** /**
* Handles binary nodes by producing [RadicalSyntax] with no index. * Handles binary nodes by producing [RadicalSyntax] with no index.
*/ */
@UnstableKMathAPI
public class SquareRoot(operations: Collection<String>?) : Unary(operations) { public class SquareRoot(operations: Collection<String>?) : Unary(operations) {
override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax =
RadicalSyntax(operation = node.operation, operand = parent.render(node.value)) RadicalSyntax(operation = node.operation, operand = parent.render(node.value))
@ -389,7 +371,6 @@ public class SquareRoot(operations: Collection<String>?) : Unary(operations) {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class Exponent(operations: Collection<String>?) : Unary(operations) { public class Exponent(operations: Collection<String>?) : Unary(operations) {
override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = ExponentSyntax( override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = ExponentSyntax(
operation = node.operation, operation = node.operation,
@ -410,7 +391,6 @@ public class Exponent(operations: Collection<String>?) : Unary(operations) {
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class Multiplication(operations: Collection<String>?) : Binary(operations) { public class Multiplication(operations: Collection<String>?) : Binary(operations) {
override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax = override fun renderBinary(parent: FeaturedMathRenderer, node: MST.Binary): MathSyntax =
MultiplicationSyntax( MultiplicationSyntax(
@ -433,7 +413,6 @@ public class Multiplication(operations: Collection<String>?) : Binary(operations
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class InverseTrigonometricOperations(operations: Collection<String>?) : Unary(operations) { public class InverseTrigonometricOperations(operations: Collection<String>?) : Unary(operations) {
override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax =
UnaryOperatorSyntax( UnaryOperatorSyntax(
@ -460,7 +439,6 @@ public class InverseTrigonometricOperations(operations: Collection<String>?) : U
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class InverseHyperbolicOperations(operations: Collection<String>?) : Unary(operations) { public class InverseHyperbolicOperations(operations: Collection<String>?) : Unary(operations) {
override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax = override fun renderUnary(parent: FeaturedMathRenderer, node: MST.Unary): MathSyntax =
UnaryOperatorSyntax( UnaryOperatorSyntax(

View File

@ -5,7 +5,6 @@
package space.kscience.kmath.ast.rendering package space.kscience.kmath.ast.rendering
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.ast.rendering.FeaturedMathRendererWithPostProcess.PostProcessPhase import space.kscience.kmath.ast.rendering.FeaturedMathRendererWithPostProcess.PostProcessPhase
import space.kscience.kmath.operations.FieldOps import space.kscience.kmath.operations.FieldOps
import space.kscience.kmath.operations.GroupOps import space.kscience.kmath.operations.GroupOps
@ -17,7 +16,6 @@ import space.kscience.kmath.operations.RingOps
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public val BetterMultiplication: PostProcessPhase = PostProcessPhase { node -> public val BetterMultiplication: PostProcessPhase = PostProcessPhase { node ->
fun perform(node: MathSyntax): Unit = when (node) { fun perform(node: MathSyntax): Unit = when (node) {
is NumberSyntax -> Unit is NumberSyntax -> Unit
@ -91,7 +89,6 @@ public val BetterMultiplication: PostProcessPhase = PostProcessPhase { node ->
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public val BetterFraction: PostProcessPhase = PostProcessPhase { node -> public val BetterFraction: PostProcessPhase = PostProcessPhase { node ->
fun perform(node: MathSyntax, infix: Boolean = false): Unit = when (node) { fun perform(node: MathSyntax, infix: Boolean = false): Unit = when (node) {
is NumberSyntax -> Unit is NumberSyntax -> Unit
@ -162,7 +159,6 @@ public val BetterFraction: PostProcessPhase = PostProcessPhase { node ->
* *
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public val BetterExponent: PostProcessPhase = PostProcessPhase { node -> public val BetterExponent: PostProcessPhase = PostProcessPhase { node ->
fun perform(node: MathSyntax): Boolean { fun perform(node: MathSyntax): Boolean {
return when (node) { return when (node) {
@ -202,7 +198,6 @@ public val BetterExponent: PostProcessPhase = PostProcessPhase { node ->
* @property precedenceFunction Returns the precedence number for syntax node. Higher number is lower priority. * @property precedenceFunction Returns the precedence number for syntax node. Higher number is lower priority.
* @author Iaroslav Postovalov * @author Iaroslav Postovalov
*/ */
@UnstableKMathAPI
public class SimplifyParentheses(public val precedenceFunction: (MathSyntax) -> Int) : public class SimplifyParentheses(public val precedenceFunction: (MathSyntax) -> Int) :
PostProcessPhase { PostProcessPhase {
override fun perform(node: MathSyntax): Unit = when (node) { override fun perform(node: MathSyntax): Unit = when (node) {

View File

@ -7,9 +7,31 @@ kscience {
js() js()
native() native()
wasm{
browser {
testTask {
useKarma {
this.webpackConfig.experiments.add("topLevelAwait")
useChromeHeadless()
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
}
}
}
}
wasmTest{
dependencies {
implementation(kotlin("test"))
}
}
dependencies { dependencies {
api(projects.kmathCore) api(projects.kmathCore)
} }
testDependencies {
implementation(projects.testUtils)
}
} }
readme { readme {

View File

@ -6,11 +6,31 @@ kscience{
jvm() jvm()
js() js()
native() native()
// wasm() wasm{
browser {
testTask {
useKarma {
this.webpackConfig.experiments.add("topLevelAwait")
useChromeHeadless()
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
}
}
}
}
wasmTest{
dependencies {
implementation(kotlin("test"))
}
}
dependencies { dependencies {
api(projects.kmathMemory) api(projects.kmathMemory)
} }
testDependencies {
implementation(projects.testUtils)
}
} }
kotlin.sourceSets { kotlin.sourceSets {

View File

@ -5,6 +5,7 @@
package space.kscience.kmath.misc package space.kscience.kmath.misc
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.misc.PermSortTest.Platform.* import space.kscience.kmath.misc.PermSortTest.Platform.*
import space.kscience.kmath.structures.IntBuffer import space.kscience.kmath.structures.IntBuffer
import space.kscience.kmath.structures.asBuffer import space.kscience.kmath.structures.asBuffer
@ -14,6 +15,7 @@ import kotlin.test.assertContentEquals
import kotlin.test.assertEquals import kotlin.test.assertEquals
import kotlin.test.assertTrue import kotlin.test.assertTrue
@OptIn(UnstableKMathAPI::class)
class PermSortTest { class PermSortTest {
private enum class Platform { private enum class Platform {

View File

@ -22,6 +22,7 @@ import kotlin.math.pow
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
@OptIn(PerformancePitfall::class)
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
class NumberNDFieldTest { class NumberNDFieldTest {
val algebra = DoubleField.ndAlgebra val algebra = DoubleField.ndAlgebra

View File

@ -6,6 +6,7 @@ kscience {
jvm() jvm()
js() js()
native() native()
dependencies { dependencies {
api(project(":kmath-core")) api(project(":kmath-core"))
api(project(":kmath-complex")) api(project(":kmath-complex"))

View File

@ -6,18 +6,32 @@ kscience{
jvm() jvm()
js() js()
native() native()
wasm{
browser {
testTask {
useKarma {
this.webpackConfig.experiments.add("topLevelAwait")
useChromeHeadless()
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
}
}
}
}
wasmTest{
dependencies {
implementation(kotlin("test"))
}
}
dependencies {
api(projects.kmathCore)
}
} }
description = "Functions, integration and interpolation" description = "Functions, integration and interpolation"
kotlin.sourceSets {
commonMain {
dependencies {
api(project(":kmath-core"))
}
}
}
dependencies { dependencies {
dokkaPlugin("org.jetbrains.dokka:mathjax-plugin:${spclibs.versions.dokka.get()}") dokkaPlugin("org.jetbrains.dokka:mathjax-plugin:${spclibs.versions.dokka.get()}")
} }

View File

@ -12,6 +12,11 @@ kscience{
dependencies{ dependencies{
api(projects.kmath.kmathComplex) api(projects.kmath.kmathComplex)
} }
testDependencies {
implementation(projects.testUtils)
}
} }
readme { readme {

View File

@ -13,6 +13,7 @@ import org.jetbrains.kotlinx.jupyter.api.DisplayResult
import org.jetbrains.kotlinx.jupyter.api.HTML import org.jetbrains.kotlinx.jupyter.api.HTML
import org.jetbrains.kotlinx.jupyter.api.libraries.JupyterIntegration import org.jetbrains.kotlinx.jupyter.api.libraries.JupyterIntegration
import space.kscience.kmath.PerformancePitfall import space.kscience.kmath.PerformancePitfall
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.ast.rendering.FeaturedMathRendererWithPostProcess import space.kscience.kmath.ast.rendering.FeaturedMathRendererWithPostProcess
import space.kscience.kmath.ast.rendering.MathMLSyntaxRenderer import space.kscience.kmath.ast.rendering.MathMLSyntaxRenderer
import space.kscience.kmath.ast.rendering.renderWithStringBuilder import space.kscience.kmath.ast.rendering.renderWithStringBuilder
@ -30,6 +31,7 @@ import space.kscience.kmath.structures.Buffer
*/ */
public fun Number.toMst(): MST.Numeric = MST.Numeric(this) public fun Number.toMst(): MST.Numeric = MST.Numeric(this)
@OptIn(UnstableKMathAPI::class)
internal class KMathJupyter : JupyterIntegration() { internal class KMathJupyter : JupyterIntegration() {
private val mathRender = FeaturedMathRendererWithPostProcess.Default private val mathRender = FeaturedMathRendererWithPostProcess.Default
private val syntaxRender = MathMLSyntaxRenderer private val syntaxRender = MathMLSyntaxRenderer

View File

@ -6,7 +6,23 @@ kscience {
jvm() jvm()
js() js()
native() native()
// wasm() wasm{
browser {
testTask {
useKarma {
this.webpackConfig.experiments.add("topLevelAwait")
useChromeHeadless()
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
}
}
}
}
wasmTest{
dependencies {
implementation(kotlin("test"))
}
}
} }
readme { readme {

View File

@ -0,0 +1,37 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.memory
import kotlin.test.Test
import kotlin.test.assertEquals
class MemoryTest {
@Test
fun memoryWriteRead() {
val memorySize = 60
val data = buildList {
for (i in 0 until (memorySize / 4)) {
add(i)
}
}
val memory = Memory.allocate(memorySize)
memory.write {
for (i in 0 until (memory.size / 4)) {
writeInt(i*4, data[i])
}
}
val result = memory.read {
buildList {
for (i in 0 until (memory.size / 4)) {
add(readInt(i*4))
}
}
}
assertEquals(data,result)
}
}

View File

@ -20,8 +20,7 @@ internal class ByteBufferMemory(
val startOffset: Int = 0, val startOffset: Int = 0,
override val size: Int = buffer.limit(), override val size: Int = buffer.limit(),
) : Memory { ) : Memory {
@Suppress("NOTHING_TO_INLINE") private fun position(offset: Int): Int = startOffset + offset
private inline fun position(o: Int): Int = startOffset + o
override fun view(offset: Int, length: Int): Memory { override fun view(offset: Int, length: Int): Memory {
require(offset >= 0) { "offset shouldn't be negative: $offset" } require(offset >= 0) { "offset shouldn't be negative: $offset" }
@ -120,7 +119,7 @@ public fun ByteBuffer.asMemory(startOffset: Int = 0, size: Int = limit()): Memor
ByteBufferMemory(this, startOffset, size) ByteBufferMemory(this, startOffset, size)
/** /**
* Uses direct memory-mapped buffer from file to read something and close it afterwards. * Uses direct memory-mapped buffer from file to read something and close it afterward.
*/ */
@Throws(IOException::class) @Throws(IOException::class)
public inline fun <R> Path.readAsMemory(position: Long = 0, size: Long = Files.size(this), block: Memory.() -> R): R { public inline fun <R> Path.readAsMemory(position: Long = 0, size: Long = Files.size(this), block: Memory.() -> R): R {

View File

@ -0,0 +1,103 @@
/*
* Copyright 2018-2022 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.memory
import org.khronos.webgl.ArrayBuffer
import org.khronos.webgl.DataView
import org.khronos.webgl.Int8Array
private class WasmDataViewMemory(val view: DataView) : Memory {
override val size: Int get() = view.byteLength
override fun view(offset: Int, length: Int): Memory {
require(offset >= 0) { "offset shouldn't be negative: $offset" }
require(length >= 0) { "length shouldn't be negative: $length" }
require(offset + length <= size) { "Can't view memory outside the parent region." }
if (offset + length > size)
throw IndexOutOfBoundsException("offset + length > size: $offset + $length > $size")
return WasmDataViewMemory(DataView(view.buffer, view.byteOffset + offset, length))
}
override fun copy(): Memory = WasmDataViewMemory(DataView(view.buffer.slice(0)))
private val reader: MemoryReader = object : MemoryReader {
override val memory: Memory get() = this@WasmDataViewMemory
override fun readDouble(offset: Int): Double = view.getFloat64(offset, false)
override fun readFloat(offset: Int): Float = view.getFloat32(offset, false)
override fun readByte(offset: Int): Byte = view.getInt8(offset)
override fun readShort(offset: Int): Short = view.getInt16(offset, false)
override fun readInt(offset: Int): Int = view.getInt32(offset, false)
override fun readLong(offset: Int): Long =
view.getInt32(offset, false).toLong() shl 32 or view.getInt32(offset + 4, false).toLong()
override fun close() {
// does nothing on JS
}
}
override fun reader(): MemoryReader = reader
private val writer: MemoryWriter = object : MemoryWriter {
override val memory: Memory get() = this@WasmDataViewMemory
override fun writeDouble(offset: Int, value: Double) {
view.setFloat64(offset, value, false)
}
override fun writeFloat(offset: Int, value: Float) {
view.setFloat32(offset, value, false)
}
override fun writeByte(offset: Int, value: Byte) {
view.setInt8(offset, value)
}
override fun writeShort(offset: Int, value: Short) {
view.setUint16(offset, value, false)
}
override fun writeInt(offset: Int, value: Int) {
view.setInt32(offset, value, false)
}
override fun writeLong(offset: Int, value: Long) {
view.setInt32(offset, (value shr 32).toInt(), littleEndian = false)
view.setInt32(offset + 4, (value and 0xffffffffL).toInt(), littleEndian = false)
}
override fun close() {
// does nothing on JS
}
}
override fun writer(): MemoryWriter = writer
}
/**
* Allocates memory based on a [DataView].
*/
public actual fun Memory.Companion.allocate(length: Int): Memory {
val buffer = ArrayBuffer(length)
return WasmDataViewMemory(DataView(buffer, 0, length))
}
/**
* Wraps a [Memory] around existing [ByteArray]. This operation is unsafe since the array is not copied
* and could be mutated independently of the resulting [Memory].
*/
public actual fun Memory.Companion.wrap(array: ByteArray): Memory {
@Suppress("CAST_NEVER_SUCCEEDS") val int8Array = array as Int8Array
return WasmDataViewMemory(DataView(int8Array.buffer, int8Array.byteOffset, int8Array.length))
}

View File

@ -1,66 +0,0 @@
/*
* Copyright 2018-2023 KMath contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package space.kscience.kmath.memory
import kotlin.wasm.unsafe.Pointer
import kotlin.wasm.unsafe.UnsafeWasmMemoryApi
@OptIn(UnsafeWasmMemoryApi::class)
public class WasmMemory private constructor(
public val pointer: Pointer,
override val size: Int,
) : Memory {
override fun view(offset: Int, length: Int): Memory {
TODO("Not yet implemented")
}
override fun copy(): Memory {
TODO("Not yet implemented")
}
override fun reader(): MemoryReader = object : MemoryReader {
override val memory: Memory
get() = this@WasmMemory
override fun readDouble(offset: Int): Double {
return Double.fromBits(pointer.plus(offset).loadLong())
}
override fun readFloat(offset: Int): Float {
return Float.fromBits(pointer.plus(offset).loadInt())
}
override fun readByte(offset: Int): Byte {
return pointer.plus(offset).loadByte()
}
override fun readShort(offset: Int): Short {
return pointer.plus(offset).loadShort()
}
override fun readInt(offset: Int): Int {
return pointer.plus(offset).loadInt()
}
override fun readLong(offset: Int): Long {
return pointer.plus(offset).loadLong()
}
override fun close() {
TODO()
}
}
override fun writer(): MemoryWriter = TODO()
}
public actual fun Memory.Companion.allocate(length: Int): Memory {
TODO()
}
public actual fun Memory.Companion.wrap(array: ByteArray): Memory = TODO()

View File

@ -5,6 +5,7 @@
package space.kscience.kmath.optimization package space.kscience.kmath.optimization
import space.kscience.kmath.UnstableKMathAPI
import space.kscience.kmath.data.XYColumnarData import space.kscience.kmath.data.XYColumnarData
import space.kscience.kmath.expressions.DifferentiableExpression import space.kscience.kmath.expressions.DifferentiableExpression
import space.kscience.kmath.expressions.Symbol import space.kscience.kmath.expressions.Symbol
@ -69,6 +70,7 @@ public suspend fun <T> DifferentiableExpression<T>.optimizeWith(
} }
@OptIn(UnstableKMathAPI::class)
public class XYOptimizationBuilder( public class XYOptimizationBuilder(
public val data: XYColumnarData<Double, Double, Double>, public val data: XYColumnarData<Double, Double, Double>,
public val model: DifferentiableExpression<Double>, public val model: DifferentiableExpression<Double>,
@ -86,6 +88,7 @@ public class XYOptimizationBuilder(
) )
} }
@OptIn(UnstableKMathAPI::class)
public fun XYOptimization( public fun XYOptimization(
data: XYColumnarData<Double, Double, Double>, data: XYColumnarData<Double, Double, Double>,
model: DifferentiableExpression<Double>, model: DifferentiableExpression<Double>,

View File

@ -11,7 +11,7 @@ kscience{
kotlin.sourceSets { kotlin.sourceSets {
commonMain { commonMain {
dependencies { dependencies {
api(project(":kmath-coroutines")) api(projects.kmathCoroutines)
//implementation(spclibs.atomicfu) //implementation(spclibs.atomicfu)
} }
} }

View File

@ -6,7 +6,7 @@ kscience{
jvm() jvm()
js() js()
native() native()
// wasm() wasm()
} }
kotlin.sourceSets { kotlin.sourceSets {