Dev #127

Merged
altavir merged 214 commits from dev into master 2020-08-11 08:33:21 +03:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit fec8c7f9d1 - Show all commits

View File

@ -11,7 +11,7 @@ interface AsmExpression<T> {
fun invoke(gen: AsmGenerationContext<T>)
}
internal val methodNameAdapters = mapOf("+" to "add", "*" to "multiply", "/" to "divide")
private val methodNameAdapters: Map<String, String> = mapOf("+" to "add", "*" to "multiply", "/" to "divide")
internal fun <T> hasSpecific(context: Algebra<T>, name: String, arity: Int): Boolean {
val aName = methodNameAdapters[name] ?: name
@ -137,7 +137,9 @@ internal class AsmConstProductExpression<T>(
gen.visitAlgebraOperation(
owner = AsmGenerationContext.SPACE_OPERATIONS_CLASS,
method = "multiply",
descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};L${AsmGenerationContext.NUMBER_CLASS};)L${AsmGenerationContext.OBJECT_CLASS};"
descriptor = "(L${AsmGenerationContext.OBJECT_CLASS};" +
"L${AsmGenerationContext.NUMBER_CLASS};)" +
"L${AsmGenerationContext.OBJECT_CLASS};"
)
}
}

View File

@ -2,7 +2,7 @@ package scientifik.kmath.expressions
import scientifik.kmath.operations.*
internal class FunctionalUnaryOperation<T>(val context: Algebra<T>, val name: String, val expr: Expression<T>) :
internal class FunctionalUnaryOperation<T>(val context: Algebra<T>, val name: String, private val expr: Expression<T>) :
Expression<T> {
override fun invoke(arguments: Map<String, T>): T = context.unaryOperation(name, expr.invoke(arguments))
}