Dev #194

Merged
altavir merged 266 commits from dev into master 2021-01-20 17:32:32 +03:00
Showing only changes of commit 31c71e0fad - Show all commits

View File

@ -3,10 +3,29 @@ package kscience.kmath.ast.kotlingrad
import edu.umontreal.kotlingrad.experimental.* import edu.umontreal.kotlingrad.experimental.*
import kscience.kmath.ast.MST import kscience.kmath.ast.MST
import kscience.kmath.ast.MstExtendedField import kscience.kmath.ast.MstExtendedField
import kscience.kmath.ast.MstExtendedField.unaryMinus
import kscience.kmath.operations.* import kscience.kmath.operations.*
/** /**
* Maps [SFun] objects to [MST]. Some unsupported operations like [Derivative] are bound and converted then. * Maps [SFun] objects to [MST]. Some unsupported operations like [Derivative] are bound and converted then.
* [Power] operation is limited to constant right-hand side arguments.
*
* Detailed mapping is:
*
* - [SVar] -> [MstExtendedField.symbol];
* - [SConst] -> [MstExtendedField.number];
* - [Sum] -> [MstExtendedField.add];
* - [Prod] -> [MstExtendedField.multiply];
* - [Power] -> [MstExtendedField.power] (limited);
* - [Negative] -> [MstExtendedField.unaryMinus];
* - [Log] -> [MstExtendedField.ln] (left) / [MstExtendedField.ln] (right);
* - [Sine] -> [MstExtendedField.sin];
* - [Cosine] -> [MstExtendedField.cos];
* - [Tangent] -> [MstExtendedField.tan];
* - [DProd] is vector operation, and it is requested to be evaluated;
* - [SComposition] is also requested to be evaluated eagerly;
* - [VSumAll] is requested to be evaluated;
* - [Derivative] is requested to be evaluated.
* *
* @receiver the scalar function. * @receiver the scalar function.
* @return a node. * @return a node.
@ -50,6 +69,13 @@ public fun <X : SFun<X>> MST.Symbolic.svar(proto: X): SVar<X> = SVar(proto, valu
/** /**
* Maps [MST] objects to [SFun]. Unsupported operations throw [IllegalStateException]. * Maps [MST] objects to [SFun]. Unsupported operations throw [IllegalStateException].
* *
* Detailed mapping is:
*
* - [MST.Numeric] -> [SConst];
* - [MST.Symbolic] -> [SVar];
* - [MST.Unary] -> [Negative], [Sine], [Cosine], [Tangent], [Power], [Log];
* - [MST.Binary] -> [Sum], [Prod], [Power].
*
* @receiver the node. * @receiver the node.
* @param proto the prototype instance. * @param proto the prototype instance.
* @return a scalar function. * @return a scalar function.