Fill in the lack of documentation of kmath-ast module for adv-expr #109
@ -3,6 +3,13 @@ package scientifik.kmath.asm.internal
|
|||||||
import scientifik.kmath.expressions.Expression
|
import scientifik.kmath.expressions.Expression
|
||||||
import scientifik.kmath.operations.Algebra
|
import scientifik.kmath.operations.Algebra
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [Expression] partial implementation to have it subclassed by actual implementations. Provides unified storage for
|
||||||
|
* objects needed to implement the expression.
|
||||||
|
*
|
||||||
|
* @property algebra the algebra to delegate calls.
|
||||||
|
* @property constants the constants array to have persistent objects to reference in [invoke].
|
||||||
|
*/
|
||||||
internal abstract class AsmCompiledExpression<T> internal constructor(
|
internal abstract class AsmCompiledExpression<T> internal constructor(
|
||||||
@JvmField protected val algebra: Algebra<T>,
|
@JvmField protected val algebra: Algebra<T>,
|
||||||
@JvmField protected val constants: Array<Any>
|
@JvmField protected val constants: Array<Any>
|
||||||
|
@ -2,7 +2,13 @@ package scientifik.kmath.asm.internal
|
|||||||
|
|
||||||
import scientifik.kmath.ast.MST
|
import scientifik.kmath.ast.MST
|
||||||
|
|
||||||
internal fun buildName(mst: MST, collision: Int = 0): String {
|
/**
|
||||||
|
* Creates a class name for [AsmCompiledExpression] subclassed to implement [mst] provided.
|
||||||
|
*
|
||||||
|
* This methods helps to avoid collisions of class name to prevent loading several classes with the same name. If there
|
||||||
|
* is a colliding class, change [collision] parameter or leave it `0` to check existing classes recursively.
|
||||||
|
*/
|
||||||
|
internal tailrec fun buildName(mst: MST, collision: Int = 0): String {
|
||||||
val name = "scientifik.kmath.asm.generated.AsmCompiledExpression_${mst.hashCode()}_$collision"
|
val name = "scientifik.kmath.asm.generated.AsmCompiledExpression_${mst.hashCode()}_$collision"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user