Remove Differentiable

This commit is contained in:
Alexander Nozik 2020-10-28 09:25:37 +03:00
parent dfa1bcaf01
commit 5fa4d40f41

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))