Revert SymbolIndexer package to make ASM builders work.
This commit is contained in:
parent
43e407e11a
commit
b9f413b5ce
@ -13,4 +13,4 @@ kotlin.native.ignoreDisabledTargets=true
|
|||||||
org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers
|
org.jetbrains.dokka.experimental.gradle.pluginMode=V2EnabledWithHelpers
|
||||||
kotlin.native.enableKlibsCrossCompilation=true
|
kotlin.native.enableKlibsCrossCompilation=true
|
||||||
|
|
||||||
toolsVersion=0.16.0-kotlin-2.1.0
|
toolsVersion=0.16.0-kotlin-2.1.0
|
@ -40,7 +40,7 @@ kscience {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies(jvmMain) {
|
dependencies(jvmMain) {
|
||||||
implementation("org.ow2.asm:asm-commons:9.2")
|
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.getProperty("space.kscience.kmath.ast.dump.generated.classes") == "1") {
|
if (project.properties["space.kscience.kmath.ast.dump.generated.classes"] == "1") {
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest> {
|
tasks.withType<org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest> {
|
||||||
jvmArgs("-Dspace.kscience.kmath.ast.dump.generated.classes=1")
|
jvmArgs("-Dspace.kscience.kmath.ast.dump.generated.classes=1")
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,12 @@
|
|||||||
|
|
||||||
package space.kscience.kmath.wasm.internal
|
package space.kscience.kmath.wasm.internal
|
||||||
|
|
||||||
|
import `<dynamic>`.invoke
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.ast.TypedMst
|
import space.kscience.kmath.ast.TypedMst
|
||||||
import space.kscience.kmath.expressions.DoubleExpression
|
import space.kscience.kmath.expressions.*
|
||||||
import space.kscience.kmath.expressions.Expression
|
|
||||||
import space.kscience.kmath.expressions.IntExpression
|
|
||||||
import space.kscience.kmath.expressions.Symbol
|
|
||||||
import space.kscience.kmath.internal.binaryen.*
|
import space.kscience.kmath.internal.binaryen.*
|
||||||
import space.kscience.kmath.internal.webassembly.Instance
|
import space.kscience.kmath.internal.webassembly.Instance
|
||||||
import space.kscience.kmath.named.SimpleSymbolIndexer
|
|
||||||
import space.kscience.kmath.operations.*
|
import space.kscience.kmath.operations.*
|
||||||
import space.kscience.kmath.structures.Float64
|
import space.kscience.kmath.structures.Float64
|
||||||
import space.kscience.kmath.internal.binaryen.Module as BinaryenModule
|
import space.kscience.kmath.internal.binaryen.Module as BinaryenModule
|
||||||
|
@ -11,7 +11,6 @@ import space.kscience.kmath.UnstableKMathAPI
|
|||||||
import space.kscience.kmath.ast.TypedMst
|
import space.kscience.kmath.ast.TypedMst
|
||||||
import space.kscience.kmath.ast.evaluateConstants
|
import space.kscience.kmath.ast.evaluateConstants
|
||||||
import space.kscience.kmath.expressions.*
|
import space.kscience.kmath.expressions.*
|
||||||
import space.kscience.kmath.named.SimpleSymbolIndexer
|
|
||||||
import space.kscience.kmath.operations.Float64Field
|
import space.kscience.kmath.operations.Float64Field
|
||||||
import space.kscience.kmath.operations.Int32Ring
|
import space.kscience.kmath.operations.Int32Ring
|
||||||
import space.kscience.kmath.structures.Float64
|
import space.kscience.kmath.structures.Float64
|
||||||
|
@ -12,7 +12,6 @@ import space.kscience.kmath.asm.internal.*
|
|||||||
import space.kscience.kmath.ast.TypedMst
|
import space.kscience.kmath.ast.TypedMst
|
||||||
import space.kscience.kmath.ast.evaluateConstants
|
import space.kscience.kmath.ast.evaluateConstants
|
||||||
import space.kscience.kmath.expressions.*
|
import space.kscience.kmath.expressions.*
|
||||||
import space.kscience.kmath.named.SimpleSymbolIndexer
|
|
||||||
import space.kscience.kmath.operations.Algebra
|
import space.kscience.kmath.operations.Algebra
|
||||||
import space.kscience.kmath.operations.Float64Field
|
import space.kscience.kmath.operations.Float64Field
|
||||||
import space.kscience.kmath.operations.Int32Ring
|
import space.kscience.kmath.operations.Int32Ring
|
||||||
|
@ -14,8 +14,6 @@ import org.objectweb.asm.commons.InstructionAdapter
|
|||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.ast.TypedMst
|
import space.kscience.kmath.ast.TypedMst
|
||||||
import space.kscience.kmath.expressions.*
|
import space.kscience.kmath.expressions.*
|
||||||
import space.kscience.kmath.named.SimpleSymbolIndexer
|
|
||||||
import space.kscience.kmath.named.SymbolIndexer
|
|
||||||
import space.kscience.kmath.operations.*
|
import space.kscience.kmath.operations.*
|
||||||
import space.kscience.kmath.structures.Float64
|
import space.kscience.kmath.structures.Float64
|
||||||
import java.lang.invoke.MethodHandles
|
import java.lang.invoke.MethodHandles
|
||||||
@ -77,7 +75,7 @@ internal sealed class PrimitiveAsmBuilder<T : Number, out E : Expression<T>>(
|
|||||||
val instance: E by lazy {
|
val instance: E by lazy {
|
||||||
val classWriter = ClassWriter(ClassWriter.COMPUTE_FRAMES) {
|
val classWriter = ClassWriter(ClassWriter.COMPUTE_FRAMES) {
|
||||||
visit(
|
visit(
|
||||||
V1_8,
|
V11,
|
||||||
ACC_PUBLIC or ACC_FINAL or ACC_SUPER,
|
ACC_PUBLIC or ACC_FINAL or ACC_SUPER,
|
||||||
classType.internalName,
|
classType.internalName,
|
||||||
"${OBJECT_TYPE.descriptor}${expressionParentType.descriptor}",
|
"${OBJECT_TYPE.descriptor}${expressionParentType.descriptor}",
|
||||||
|
@ -73,7 +73,6 @@ internal tailrec fun buildName(marker: String, collision: Int = 0): String {
|
|||||||
return buildName(marker, collision + 1)
|
return buildName(marker, collision + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("FunctionName")
|
|
||||||
internal inline fun ClassWriter(flags: Int, block: ClassWriter.() -> Unit): ClassWriter {
|
internal inline fun ClassWriter(flags: Int, block: ClassWriter.() -> Unit): ClassWriter {
|
||||||
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
|
contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }
|
||||||
return ClassWriter(flags).apply(block)
|
return ClassWriter(flags).apply(block)
|
||||||
|
@ -18,12 +18,11 @@ import space.kscience.attributes.AttributesBuilder
|
|||||||
import space.kscience.attributes.SetAttribute
|
import space.kscience.attributes.SetAttribute
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.expressions.Symbol
|
import space.kscience.kmath.expressions.Symbol
|
||||||
|
import space.kscience.kmath.expressions.SymbolIndexer
|
||||||
import space.kscience.kmath.expressions.derivative
|
import space.kscience.kmath.expressions.derivative
|
||||||
import space.kscience.kmath.named.SymbolIndexer
|
import space.kscience.kmath.expressions.withSymbols
|
||||||
import space.kscience.kmath.named.withSymbols
|
|
||||||
import space.kscience.kmath.optimization.*
|
import space.kscience.kmath.optimization.*
|
||||||
import space.kscience.kmath.structures.Float64
|
import space.kscience.kmath.structures.Float64
|
||||||
import kotlin.collections.set
|
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
public operator fun PointValuePair.component1(): DoubleArray = point
|
public operator fun PointValuePair.component1(): DoubleArray = point
|
||||||
|
@ -7,7 +7,6 @@ package space.kscience.kmath.expressions
|
|||||||
|
|
||||||
import space.kscience.attributes.SafeType
|
import space.kscience.attributes.SafeType
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.named.SymbolIndexer
|
|
||||||
import space.kscience.kmath.operations.*
|
import space.kscience.kmath.operations.*
|
||||||
import space.kscience.kmath.structures.Buffer
|
import space.kscience.kmath.structures.Buffer
|
||||||
import space.kscience.kmath.structures.MutableBuffer
|
import space.kscience.kmath.structures.MutableBuffer
|
||||||
|
@ -9,7 +9,6 @@ import space.kscience.attributes.SafeType
|
|||||||
import space.kscience.attributes.WithType
|
import space.kscience.attributes.WithType
|
||||||
import space.kscience.attributes.safeTypeOf
|
import space.kscience.attributes.safeTypeOf
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.named.SymbolIndexer
|
|
||||||
import space.kscience.kmath.operations.Algebra
|
import space.kscience.kmath.operations.Algebra
|
||||||
import space.kscience.kmath.operations.DoubleField
|
import space.kscience.kmath.operations.DoubleField
|
||||||
import space.kscience.kmath.operations.IntRing
|
import space.kscience.kmath.operations.IntRing
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* 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.named
|
package space.kscience.kmath.expressions
|
||||||
|
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.expressions.Symbol
|
|
||||||
import space.kscience.kmath.linear.Point
|
import space.kscience.kmath.linear.Point
|
||||||
import space.kscience.kmath.nd.Structure2D
|
import space.kscience.kmath.nd.Structure2D
|
||||||
import space.kscience.kmath.structures.BufferFactory
|
import space.kscience.kmath.structures.BufferFactory
|
||||||
@ -15,6 +14,8 @@ import kotlin.contracts.InvocationKind
|
|||||||
import kotlin.contracts.contract
|
import kotlin.contracts.contract
|
||||||
import kotlin.jvm.JvmInline
|
import kotlin.jvm.JvmInline
|
||||||
|
|
||||||
|
//DO NOT MOVE THIS CLASS if you do not want ASM module to break
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An environment to easy transform indexed variables to symbols and back.
|
* An environment to easy transform indexed variables to symbols and back.
|
||||||
* TODO requires multi-receivers to be beautiful
|
* TODO requires multi-receivers to be beautiful
|
@ -9,6 +9,7 @@ package space.kscience.kmath.named
|
|||||||
|
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.expressions.Symbol
|
import space.kscience.kmath.expressions.Symbol
|
||||||
|
import space.kscience.kmath.expressions.SymbolIndexer
|
||||||
import space.kscience.kmath.structures.Buffer
|
import space.kscience.kmath.structures.Buffer
|
||||||
import space.kscience.kmath.structures.MutableBuffer
|
import space.kscience.kmath.structures.MutableBuffer
|
||||||
|
|
||||||
|
@ -9,7 +9,9 @@ package space.kscience.kmath.named
|
|||||||
|
|
||||||
import space.kscience.kmath.PerformancePitfall
|
import space.kscience.kmath.PerformancePitfall
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
|
import space.kscience.kmath.expressions.SimpleSymbolIndexer
|
||||||
import space.kscience.kmath.expressions.Symbol
|
import space.kscience.kmath.expressions.Symbol
|
||||||
|
import space.kscience.kmath.expressions.SymbolIndexer
|
||||||
import space.kscience.kmath.linear.Matrix
|
import space.kscience.kmath.linear.Matrix
|
||||||
import space.kscience.kmath.structures.getOrNull
|
import space.kscience.kmath.structures.getOrNull
|
||||||
|
|
||||||
@ -20,7 +22,7 @@ import space.kscience.kmath.structures.getOrNull
|
|||||||
*/
|
*/
|
||||||
public class NamedMatrix<T>(public val values: Matrix<T>, public val indexer: SymbolIndexer) : Matrix<T> by values {
|
public class NamedMatrix<T>(public val values: Matrix<T>, public val indexer: SymbolIndexer) : Matrix<T> by values {
|
||||||
init {
|
init {
|
||||||
require(values.rows.size == values.columns.size) { "Only square matrices could be named" }
|
require(values.rowNum == values.colNum) { "Only square matrices could be named" }
|
||||||
}
|
}
|
||||||
|
|
||||||
public operator fun get(i: Symbol, j: Symbol): T = get(indexer.indexOf(i), indexer.indexOf(j))
|
public operator fun get(i: Symbol, j: Symbol): T = get(indexer.indexOf(i), indexer.indexOf(j))
|
||||||
|
@ -6,18 +6,15 @@
|
|||||||
package space.kscience.kmath.optimization
|
package space.kscience.kmath.optimization
|
||||||
|
|
||||||
import space.kscience.kmath.UnstableKMathAPI
|
import space.kscience.kmath.UnstableKMathAPI
|
||||||
import space.kscience.kmath.expressions.DifferentiableExpression
|
import space.kscience.kmath.expressions.*
|
||||||
import space.kscience.kmath.expressions.Symbol
|
|
||||||
import space.kscience.kmath.expressions.derivative
|
|
||||||
import space.kscience.kmath.expressions.withDefaultArgs
|
|
||||||
import space.kscience.kmath.linear.*
|
import space.kscience.kmath.linear.*
|
||||||
import space.kscience.kmath.misc.log
|
import space.kscience.kmath.misc.log
|
||||||
import space.kscience.kmath.named.NamedMatrix
|
import space.kscience.kmath.named.NamedMatrix
|
||||||
import space.kscience.kmath.named.SymbolIndexer
|
|
||||||
import space.kscience.kmath.named.named
|
import space.kscience.kmath.named.named
|
||||||
import space.kscience.kmath.operations.Float64Field
|
import space.kscience.kmath.operations.Float64Field
|
||||||
import space.kscience.kmath.operations.Float64L2Norm
|
import space.kscience.kmath.operations.Float64L2Norm
|
||||||
import space.kscience.kmath.operations.algebra
|
import space.kscience.kmath.operations.algebra
|
||||||
|
import space.kscience.kmath.optimization.QowOptimizer.distance
|
||||||
import space.kscience.kmath.structures.Float64
|
import space.kscience.kmath.structures.Float64
|
||||||
import space.kscience.kmath.structures.Float64Buffer
|
import space.kscience.kmath.structures.Float64Buffer
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
Loading…
Reference in New Issue
Block a user