Deprecate AlgebraElements.kt #304

Merged
CommanderTvis merged 1 commits from commandertvis/deprecate-element into dev 2021-05-02 21:27:03 +03:00
3 changed files with 29 additions and 8 deletions
Showing only changes of commit 83c7ec8c6b - Show all commits

View File

@ -991,14 +991,7 @@ public abstract interface class space/kscience/kmath/operations/Algebra {
public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1; public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
} }
public abstract interface class space/kscience/kmath/operations/AlgebraElement {
public abstract fun getContext ()Lspace/kscience/kmath/operations/Algebra;
}
public final class space/kscience/kmath/operations/AlgebraElementsKt { public final class space/kscience/kmath/operations/AlgebraElementsKt {
public static final fun div (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement;
public static final fun plus (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement;
public static final fun times (Lspace/kscience/kmath/operations/AlgebraElement;Lspace/kscience/kmath/operations/AlgebraElement;)Lspace/kscience/kmath/operations/AlgebraElement;
} }
public final class space/kscience/kmath/operations/AlgebraExtensionsKt { public final class space/kscience/kmath/operations/AlgebraExtensionsKt {

View File

@ -13,6 +13,8 @@ import space.kscience.kmath.misc.UnstableKMathAPI
* @param C the type of mathematical context for this element. * @param C the type of mathematical context for this element.
* @param T the type wrapped by this wrapper. * @param T the type wrapped by this wrapper.
*/ */
@UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public interface AlgebraElement<T, C : Algebra<T>> { public interface AlgebraElement<T, C : Algebra<T>> {
/** /**
* The context this element belongs to. * The context this element belongs to.
@ -45,6 +47,7 @@ public interface AlgebraElement<T, C : Algebra<T>> {
* @return the difference. * @return the difference.
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public operator fun <T : AlgebraElement<T, S>, S : NumbersAddOperations<T>> T.minus(b: T): T = public operator fun <T : AlgebraElement<T, S>, S : NumbersAddOperations<T>> T.minus(b: T): T =
context.add(this, context.run { -b }) context.add(this, context.run { -b })
@ -55,6 +58,8 @@ public operator fun <T : AlgebraElement<T, S>, S : NumbersAddOperations<T>> T.mi
* @param b the addend. * @param b the addend.
* @return the sum. * @return the sum.
*/ */
@UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public operator fun <T : AlgebraElement<T, S>, S : Ring<T>> T.plus(b: T): T = public operator fun <T : AlgebraElement<T, S>, S : Ring<T>> T.plus(b: T): T =
context.add(this, b) context.add(this, b)
@ -71,6 +76,8 @@ public operator fun <T : AlgebraElement<T, S>, S : Ring<T>> T.plus(b: T): T =
* @param b the multiplier. * @param b the multiplier.
* @return the product. * @return the product.
*/ */
@UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public operator fun <T : AlgebraElement<T, R>, R : Ring<T>> T.times(b: T): T = public operator fun <T : AlgebraElement<T, R>, R : Ring<T>> T.times(b: T): T =
context.multiply(this, b) context.multiply(this, b)
@ -81,6 +88,8 @@ public operator fun <T : AlgebraElement<T, R>, R : Ring<T>> T.times(b: T): T =
* @param b the divisor. * @param b the divisor.
* @return the quotient. * @return the quotient.
*/ */
@UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public operator fun <T : AlgebraElement<T, F>, F : Field<T>> T.div(b: T): T = public operator fun <T : AlgebraElement<T, F>, F : Field<T>> T.div(b: T): T =
context.divide(this, b) context.divide(this, b)
@ -93,6 +102,7 @@ public operator fun <T : AlgebraElement<T, F>, F : Field<T>> T.div(b: T): T =
* @param S the type of space. * @param S the type of space.
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public interface GroupElement<T : GroupElement<T, S>, S : Group<T>> : AlgebraElement<T, S> public interface GroupElement<T : GroupElement<T, S>, S : Group<T>> : AlgebraElement<T, S>
/** /**
@ -103,6 +113,7 @@ public interface GroupElement<T : GroupElement<T, S>, S : Group<T>> : AlgebraEle
* @param R the type of ring. * @param R the type of ring.
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public interface RingElement<T : RingElement<T, R>, R : Ring<T>> : GroupElement<T, R> public interface RingElement<T : RingElement<T, R>, R : Ring<T>> : GroupElement<T, R>
/** /**
@ -113,4 +124,5 @@ public interface RingElement<T : RingElement<T, R>, R : Ring<T>> : GroupElement<
* @param F the type of field. * @param F the type of field.
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public interface FieldElement<T : FieldElement<T, F>, F : Field<T>> : RingElement<T, F> public interface FieldElement<T : FieldElement<T, F>, F : Field<T>> : RingElement<T, F>

View File

@ -80,36 +80,42 @@ public interface TrigonometricOperations<T> : Algebra<T> {
* Computes the sine of [arg]. * Computes the sine of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> sin(arg: T): T = arg.context.sin(arg) public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> sin(arg: T): T = arg.context.sin(arg)
/** /**
* Computes the cosine of [arg]. * Computes the cosine of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> cos(arg: T): T = arg.context.cos(arg) public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> cos(arg: T): T = arg.context.cos(arg)
/** /**
* Computes the tangent of [arg]. * Computes the tangent of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> tan(arg: T): T = arg.context.tan(arg) public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> tan(arg: T): T = arg.context.tan(arg)
/** /**
* Computes the inverse sine of [arg]. * Computes the inverse sine of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> asin(arg: T): T = arg.context.asin(arg) public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> asin(arg: T): T = arg.context.asin(arg)
/** /**
* Computes the inverse cosine of [arg]. * Computes the inverse cosine of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> acos(arg: T): T = arg.context.acos(arg) public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> acos(arg: T): T = arg.context.acos(arg)
/** /**
* Computes the inverse tangent of [arg]. * Computes the inverse tangent of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> atan(arg: T): T = arg.context.atan(arg) public fun <T : AlgebraElement<T, out TrigonometricOperations<T>>> atan(arg: T): T = arg.context.atan(arg)
/** /**
@ -154,18 +160,21 @@ public interface PowerOperations<T> : Algebra<T> {
* @return the base raised to the power. * @return the base raised to the power.
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public infix fun <T : AlgebraElement<T, out PowerOperations<T>>> T.pow(power: Double): T = context.power(this, power) public infix fun <T : AlgebraElement<T, out PowerOperations<T>>> T.pow(power: Double): T = context.power(this, power)
/** /**
* Computes the square root of the value [arg]. * Computes the square root of the value [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out PowerOperations<T>>> sqrt(arg: T): T = arg pow 0.5 public fun <T : AlgebraElement<T, out PowerOperations<T>>> sqrt(arg: T): T = arg pow 0.5
/** /**
* Computes the square of the value [arg]. * Computes the square of the value [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out PowerOperations<T>>> sqr(arg: T): T = arg pow 2.0 public fun <T : AlgebraElement<T, out PowerOperations<T>>> sqr(arg: T): T = arg pow 2.0
/** /**
@ -261,12 +270,14 @@ public interface ExponentialOperations<T> : Algebra<T> {
* The identifier of exponential function. * The identifier of exponential function.
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> exp(arg: T): T = arg.context.exp(arg) public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> exp(arg: T): T = arg.context.exp(arg)
/** /**
* The identifier of natural logarithm. * The identifier of natural logarithm.
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> ln(arg: T): T = arg.context.ln(arg) public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> ln(arg: T): T = arg.context.ln(arg)
@ -280,30 +291,35 @@ public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> sinh(arg: T): T
* Computes the hyperbolic cosine of [arg]. * Computes the hyperbolic cosine of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> cosh(arg: T): T = arg.context.cosh(arg) public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> cosh(arg: T): T = arg.context.cosh(arg)
/** /**
* Computes the hyperbolic tangent of [arg]. * Computes the hyperbolic tangent of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> tanh(arg: T): T = arg.context.tanh(arg) public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> tanh(arg: T): T = arg.context.tanh(arg)
/** /**
* Computes the inverse hyperbolic sine of [arg]. * Computes the inverse hyperbolic sine of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> asinh(arg: T): T = arg.context.asinh(arg) public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> asinh(arg: T): T = arg.context.asinh(arg)
/** /**
* Computes the inverse hyperbolic cosine of [arg]. * Computes the inverse hyperbolic cosine of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> acosh(arg: T): T = arg.context.acosh(arg) public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> acosh(arg: T): T = arg.context.acosh(arg)
/** /**
* Computes the inverse hyperbolic tangent of [arg]. * Computes the inverse hyperbolic tangent of [arg].
*/ */
@UnstableKMathAPI @UnstableKMathAPI
@Deprecated("AlgebraElements are considered odd and will be removed in future releases.")
public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> atanh(arg: T): T = arg.context.atanh(arg) public fun <T : AlgebraElement<T, out ExponentialOperations<T>>> atanh(arg: T): T = arg.context.atanh(arg)
/** /**