diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Complex.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Complex.kt index a588f5d5c..d56524936 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Complex.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Complex.kt @@ -105,54 +105,12 @@ public object ComplexField : ExtendedField, Norm { exp(pow * ln(arg)) public override fun exp(arg: Complex): Complex = exp(arg.re) * (cos(arg.im) + i * sin(arg.im)) - public override fun ln(arg: Complex): Complex = ln(arg.r) + i * atan2(arg.im, arg.re) - - /** - * Adds complex number to real one. - * - * @receiver the addend. - * @param b the augend. - * @return the sum. - */ public override operator fun Number.plus(b: Complex): Complex = add(toComplex(), b) - - /** - * Subtracts complex number from real one. - * - * @receiver the minuend. - * @param b the subtrahend. - * @return the difference. - */ public override operator fun Number.minus(b: Complex): Complex = add(toComplex(), -b) - - /** - * Adds real number to complex one. - * - * @receiver the addend. - * @param b the augend. - * @return the sum. - */ public override operator fun Complex.plus(b: Number): Complex = b + this - - /** - * Subtracts real number from complex one. - * - * @receiver the minuend. - * @param b the subtrahend. - * @return the difference. - */ public override operator fun Complex.minus(b: Number): Complex = add(this, -b.toComplex()) - - /** - * Multiplies real number by complex one. - * - * @receiver the multiplier. - * @param b the multiplicand. - * @receiver the product. - */ public override operator fun Number.times(b: Complex): Complex = Complex(b.re * toDouble(), b.im * toDouble()) - public override fun Complex.unaryMinus(): Complex = Complex(-re, -im) public override fun norm(arg: Complex): Complex = sqrt(arg.conjugate * arg) public override fun symbol(value: String): Complex = if (value == "i") i else super.symbol(value) diff --git a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Quaternion.kt b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Quaternion.kt index 7692b0f01..96331bd8a 100644 --- a/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Quaternion.kt +++ b/kmath-core/src/commonMain/kotlin/kscience/kmath/operations/Quaternion.kt @@ -165,50 +165,14 @@ public object QuaternionField : Field, Norm, return Quaternion(ln(n), th * arg.x, th * arg.y, th * arg.z) } - /** - * Adds quaternion to real one. - * - * @receiver the addend. - * @param b the augend. - * @return the sum. - */ public override operator fun Number.plus(b: Quaternion): Quaternion = Quaternion(toDouble() + b.w, b.x, b.y, b.z) - /** - * Subtracts quaternion from real one. - * - * @receiver the minuend. - * @param b the subtrahend. - * @return the difference. - */ public override operator fun Number.minus(b: Quaternion): Quaternion = Quaternion(toDouble() - b.w, -b.x, -b.y, -b.z) - /** - * Adds real number to quaternion. - * - * @receiver the addend. - * @param b the augend. - * @return the sum. - */ public override operator fun Quaternion.plus(b: Number): Quaternion = Quaternion(w + b.toDouble(), x, y, z) - - /** - * Subtracts real number from quaternion. - * - * @receiver the minuend. - * @param b the subtrahend. - * @return the difference. - */ public override operator fun Quaternion.minus(b: Number): Quaternion = Quaternion(w - b.toDouble(), x, y, z) - /** - * Multiplies real number by quaternion. - * - * @receiver the multiplier. - * @param b the multiplicand. - * @receiver the product. - */ public override operator fun Number.times(b: Quaternion): Quaternion = Quaternion(toDouble() * b.w, toDouble() * b.x, toDouble() * b.y, toDouble() * b.z)