Fix up Symja build issues #356
@ -10,7 +10,9 @@ allprojects {
|
|||||||
maven("http://logicrunch.research.it.uu.se/maven") {
|
maven("http://logicrunch.research.it.uu.se/maven") {
|
||||||
isAllowInsecureProtocol = true
|
isAllowInsecureProtocol = true
|
||||||
}
|
}
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots")
|
maven("https://oss.sonatype.org/content/repositories/snapshots") {
|
||||||
|
|
||||||
|
}
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +33,7 @@ subprojects {
|
|||||||
externalDocumentationLink("http://ejml.org/javadoc/")
|
externalDocumentationLink("http://ejml.org/javadoc/")
|
||||||
externalDocumentationLink("https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/")
|
externalDocumentationLink("https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/")
|
||||||
externalDocumentationLink("https://deeplearning4j.org/api/latest/")
|
externalDocumentationLink("https://deeplearning4j.org/api/latest/")
|
||||||
|
externalDocumentationLink("https://axelclk.bitbucket.io/symja/javadoc/")
|
||||||
externalDocumentationLink("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/")
|
externalDocumentationLink("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,14 @@ plugins {
|
|||||||
description = "Symja integration module"
|
description = "Symja integration module"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("org.matheclipse:matheclipse-core:2.0.0-SNAPSHOT")
|
api("org.matheclipse:matheclipse-core:2.0.0-SNAPSHOT") {
|
||||||
|
// Incorrect transitive dependency org.apfloat:apfloat:1.10.0-SNAPSHOT
|
||||||
|
exclude("org.apfloat", "apfloat")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace for org.apfloat:apfloat:1.10.0-SNAPSHOT
|
||||||
|
api("org.apfloat:apfloat:1.10.0")
|
||||||
|
|
||||||
api(project(":kmath-core"))
|
api(project(":kmath-core"))
|
||||||
testImplementation("org.slf4j:slf4j-simple:1.7.30")
|
testImplementation("org.slf4j:slf4j-simple:1.7.30")
|
||||||
}
|
}
|
||||||
|
@ -7,17 +7,28 @@ package space.kscience.kmath.symja
|
|||||||
|
|
||||||
import org.matheclipse.core.eval.ExprEvaluator
|
import org.matheclipse.core.eval.ExprEvaluator
|
||||||
import org.matheclipse.core.expression.F
|
import org.matheclipse.core.expression.F
|
||||||
import space.kscience.kmath.expressions.DifferentiableExpression
|
import space.kscience.kmath.expressions.SpecialDifferentiableExpression
|
||||||
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.expressions.interpret
|
import space.kscience.kmath.expressions.interpret
|
||||||
import space.kscience.kmath.operations.NumericAlgebra
|
import space.kscience.kmath.operations.NumericAlgebra
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents [MST] based [DifferentiableExpression] relying on [Symja](https://github.com/axkr/symja_android_library).
|
||||||
|
*
|
||||||
|
* The principle of this API is converting the [mst] to an [org.matheclipse.core.interfaces.IExpr], differentiating it
|
||||||
|
* with Symja's [F.D], then converting [org.matheclipse.core.interfaces.IExpr] back to [MST].
|
||||||
|
*
|
||||||
|
* @param T The type of number.
|
||||||
|
* @param A The [NumericAlgebra] of [T].
|
||||||
|
* @property algebra The [A] instance.
|
||||||
|
* @property mst The [MST] node.
|
||||||
|
*/
|
||||||
public class SymjaExpression<T : Number, A : NumericAlgebra<T>>(
|
public class SymjaExpression<T : Number, A : NumericAlgebra<T>>(
|
||||||
public val algebra: A,
|
public val algebra: A,
|
||||||
public val mst: MST,
|
public val mst: MST,
|
||||||
public val evaluator: ExprEvaluator = DEFAULT_EVALUATOR,
|
public val evaluator: ExprEvaluator = DEFAULT_EVALUATOR,
|
||||||
) : DifferentiableExpression<T, SymjaExpression<T, A>> {
|
) : SpecialDifferentiableExpression<T, SymjaExpression<T, A>> {
|
||||||
public override fun invoke(arguments: Map<Symbol, T>): T = mst.interpret(algebra, arguments)
|
public override fun invoke(arguments: Map<Symbol, T>): T = mst.interpret(algebra, arguments)
|
||||||
|
|
||||||
public override fun derivativeOrNull(symbols: List<Symbol>): SymjaExpression<T, A> = SymjaExpression(
|
public override fun derivativeOrNull(symbols: List<Symbol>): SymjaExpression<T, A> = SymjaExpression(
|
||||||
|
Loading…
Reference in New Issue
Block a user