Dev #194

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

View File

@ -1,20 +1,15 @@
package kscience.kmath.expressions
/**
* And object that could be differentiated
* An expression that provides derivatives
*/
public interface Differentiable<T> {
public fun derivativeOrNull(orders: Map<Symbol, Int>): T?
public interface DifferentiableExpression<T> : Expression<T>{
public fun derivativeOrNull(orders: Map<Symbol, Int>): Expression<T>?
}
public fun <T> Differentiable<T>.derivative(orders: Map<Symbol, Int>): T =
public fun <T> DifferentiableExpression<T>.derivative(orders: Map<Symbol, Int>): Expression<T> =
derivativeOrNull(orders) ?: error("Derivative with orders $orders not provided")
/**
* An expression that provid
*/
public interface DifferentiableExpression<T> : Differentiable<Expression<T>>, Expression<T>
public fun <T> DifferentiableExpression<T>.derivative(vararg orders: Pair<Symbol, Int>): Expression<T> =
derivative(mapOf(*orders))