Dev #194
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -25,7 +25,7 @@ internal class AsmBuilder<T> internal constructor(
|
||||
private val classOfT: Class<*>,
|
||||
private val algebra: Algebra<T>,
|
||||
private val className: String,
|
||||
private val invokeLabel0Visitor: AsmBuilder<T>.() -> Unit
|
||||
private val invokeLabel0Visitor: AsmBuilder<T>.() -> Unit,
|
||||
) {
|
||||
/**
|
||||
* Internal classloader of [AsmBuilder] with alias to define class from byte array.
|
||||
@ -379,22 +379,14 @@ internal class AsmBuilder<T> internal constructor(
|
||||
* Loads a variable [name] from arguments [Map] parameter of [Expression.invoke]. The [defaultValue] may be
|
||||
* provided.
|
||||
*/
|
||||
internal fun loadVariable(name: String, defaultValue: T? = null): Unit = invokeMethodVisitor.run {
|
||||
internal fun loadVariable(name: String): Unit = invokeMethodVisitor.run {
|
||||
load(invokeArgumentsVar, MAP_TYPE)
|
||||
aconst(name)
|
||||
|
||||
if (defaultValue != null)
|
||||
loadTConstant(defaultValue)
|
||||
|
||||
invokestatic(
|
||||
MAP_INTRINSICS_TYPE.internalName,
|
||||
"getOrFail",
|
||||
|
||||
Type.getMethodDescriptor(
|
||||
OBJECT_TYPE,
|
||||
MAP_TYPE,
|
||||
OBJECT_TYPE,
|
||||
*OBJECT_TYPE.wrapToArrayIf { defaultValue != null }),
|
||||
Type.getMethodDescriptor(OBJECT_TYPE, MAP_TYPE, STRING_TYPE),
|
||||
false
|
||||
)
|
||||
|
||||
@ -429,7 +421,7 @@ internal class AsmBuilder<T> internal constructor(
|
||||
method: String,
|
||||
descriptor: String,
|
||||
expectedArity: Int,
|
||||
opcode: Int = INVOKEINTERFACE
|
||||
opcode: Int = INVOKEINTERFACE,
|
||||
) {
|
||||
run loop@{
|
||||
repeat(expectedArity) {
|
||||
|
@ -3,12 +3,11 @@
|
||||
package kscience.kmath.asm.internal
|
||||
|
||||
import kscience.kmath.expressions.StringSymbol
|
||||
import kscience.kmath.expressions.Symbol
|
||||
|
||||
/**
|
||||
* Gets value with given [key] or throws [IllegalStateException] whenever it is not present.
|
||||
* Gets value with given [key] or throws [NoSuchElementException] whenever it is not present.
|
||||
*
|
||||
* @author Iaroslav Postovalov
|
||||
*/
|
||||
@JvmOverloads
|
||||
internal fun <K, V> Map<K, V>.getOrFail(key: K, default: V? = null): V =
|
||||
this[StringSymbol(key.toString())] ?: default ?: error("Parameter not found: $key")
|
||||
internal fun <V> Map<Symbol, V>.getOrFail(key: String): V = getValue(StringSymbol(key))
|
||||
|
@ -146,7 +146,9 @@ private class AutoDiffContext<T : Any, F : Field<T>>(
|
||||
override val identity: String,
|
||||
value: T,
|
||||
var d: T,
|
||||
) : AutoDiffValue<T>(value), Symbol
|
||||
) : AutoDiffValue<T>(value), Symbol{
|
||||
override fun toString(): String = identity
|
||||
}
|
||||
|
||||
private val bindings: Map<String, AutoDiffVariableWithDeriv<T>> = bindings.entries.associate {
|
||||
it.key.identity to AutoDiffVariableWithDeriv(it.key.identity, it.value, context.zero)
|
||||
|
Loading…
Reference in New Issue
Block a user