Fix problems related to merge

This commit is contained in:
Iaroslav Postovalov 2021-02-07 02:45:35 +07:00
parent 73969da969
commit d7c28bfd0c
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7
4 changed files with 6 additions and 219 deletions

View File

@ -172,8 +172,6 @@ public data class Complex(val re: Double, val im: Double) : FieldElement<Complex
public override val context: ComplexField get() = ComplexField
public override fun unwrap(): Complex = this
public override fun Complex.wrap(): Complex = this
public override fun toString(): String = "($re + i*$im)"
public companion object : MemorySpec<Complex> {

View File

@ -182,12 +182,12 @@ public object QuaternionField : Field<Quaternion>, Norm<Quaternion, Quaternion>,
* @property z The fourth component.
*/
public data class Quaternion(val w: Double, val x: Double, val y: Double, val z: Double) :
FieldElement<Quaternion, Quaternion, QuaternionField> {
FieldElement<Quaternion, QuaternionField> {
public constructor(w: Number, x: Number, y: Number, z: Number) : this(
w.toDouble(),
x.toDouble(),
y.toDouble(),
z.toDouble()
z.toDouble(),
)
public constructor(w: Number, x: Number, y: Number) : this(w.toDouble(), x.toDouble(), y.toDouble(), 0.0)
@ -206,14 +206,6 @@ public data class Quaternion(val w: Double, val x: Double, val y: Double, val z:
public override val context: QuaternionField
get() = QuaternionField
public override fun div(k: Number): Quaternion {
val d = k.toDouble()
return Quaternion(w / d, x / d, y / d, z / d)
}
public override fun unwrap(): Quaternion = this
public override fun Quaternion.wrap(): Quaternion = this
/**
* Returns a string representation of this quaternion.
*/

View File

@ -4,16 +4,17 @@ import kotlin.math.sqrt
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kscience.kmath.operations.invoke
internal class ComplexTest {
@Test
fun conjugate() = assertEquals(Complex(0, -42), (ComplexField.i * 42).conjugate)
fun conjugate() = ComplexField { assertEquals(i * -42, (i * 42).conjugate) }
@Test
fun reciprocal() = assertTrue((Complex(0.5, -0.0) - 2.toComplex().reciprocal).r < 1e-10)
fun reciprocal() = ComplexField { assertTrue((Complex(0.5, -0.0) - 2.toComplex().reciprocal).r < 1e-10) }
@Test
fun r() = assertEquals(sqrt(2.0), (ComplexField.i + 1.0.toComplex()).r)
fun r() = ComplexField { assertEquals(sqrt(2.0), (i + 1.0.toComplex()).r) }
@Test
fun theta() = assertEquals(0.0, 1.toComplex().theta)

View File

@ -1033,71 +1033,6 @@ public class kscience/kmath/nd/BufferedNDSpace : kscience/kmath/nd/BufferNDAlgeb
public fun unaryPlus (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
}
public final class kscience/kmath/nd/ComplexNDField : kscience/kmath/nd/BufferedNDField, kscience/kmath/operations/ExtendedField, kscience/kmath/operations/RingWithNumbers {
public fun <init> ([I)V
public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object;
public fun acos (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
public fun acosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object;
public fun asin (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
public fun asinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
public fun atan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
public fun atanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
public fun cos (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
public fun cosh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
public fun exp (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun getOne ()Ljava/lang/Object;
public fun getOne ()Lkscience/kmath/nd/NDBuffer;
public synthetic fun getZero ()Ljava/lang/Object;
public fun getZero ()Lkscience/kmath/nd/NDBuffer;
public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object;
public fun ln (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
public fun minus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public fun minus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object;
public fun number (Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
public fun plus (Ljava/lang/Number;Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public fun plus (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public fun pow (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public fun power (Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/nd/NDStructure;Ljava/lang/Number;)Lkscience/kmath/nd/NDStructure;
public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
public fun sin (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
public fun sinh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object;
public fun sqrt (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDStructure;
public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
public fun tan (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
public fun tanh (Lkscience/kmath/nd/NDStructure;)Lkscience/kmath/nd/NDBuffer;
public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
}
public final class kscience/kmath/nd/ComplexNDFieldKt {
public static final fun complex (Lkscience/kmath/nd/NDAlgebra$Companion;[I)Lkscience/kmath/nd/ComplexNDField;
public static final fun nd (Lkscience/kmath/operations/ComplexField;[ILkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun produceInline (Lkscience/kmath/nd/BufferedNDField;Lkotlin/jvm/functions/Function2;)Lkscience/kmath/nd/NDBuffer;
}
public final class kscience/kmath/nd/DefaultStrides : kscience/kmath/nd/Strides {
public static final field Companion Lkscience/kmath/nd/DefaultStrides$Companion;
public synthetic fun <init> ([ILkotlin/jvm/internal/DefaultConstructorMarker;)V
@ -1677,145 +1612,6 @@ public final class kscience/kmath/operations/ByteRing : kscience/kmath/operation
public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object;
}
public final class kscience/kmath/operations/Complex : java/lang/Comparable, kscience/kmath/operations/FieldElement {
public static final field Companion Lkscience/kmath/operations/Complex$Companion;
public fun <init> (DD)V
public fun <init> (Ljava/lang/Number;Ljava/lang/Number;)V
public synthetic fun compareTo (Ljava/lang/Object;)I
public fun compareTo (Lkscience/kmath/operations/Complex;)I
public final fun component1 ()D
public final fun component2 ()D
public final fun copy (DD)Lkscience/kmath/operations/Complex;
public static synthetic fun copy$default (Lkscience/kmath/operations/Complex;DDILjava/lang/Object;)Lkscience/kmath/operations/Complex;
public fun equals (Ljava/lang/Object;)Z
public synthetic fun getContext ()Lkscience/kmath/operations/Algebra;
public fun getContext ()Lkscience/kmath/operations/ComplexField;
public final fun getIm ()D
public final fun getRe ()D
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
public final class kscience/kmath/operations/Complex$Companion : kscience/kmath/memory/MemorySpec {
public fun getObjectSize ()I
public synthetic fun read (Lkscience/kmath/memory/MemoryReader;I)Ljava/lang/Object;
public fun read (Lkscience/kmath/memory/MemoryReader;I)Lkscience/kmath/operations/Complex;
public synthetic fun write (Lkscience/kmath/memory/MemoryWriter;ILjava/lang/Object;)V
public fun write (Lkscience/kmath/memory/MemoryWriter;ILkscience/kmath/operations/Complex;)V
}
public final class kscience/kmath/operations/ComplexField : kscience/kmath/operations/ExtendedField, kscience/kmath/operations/Norm, kscience/kmath/operations/RingWithNumbers {
public static final field INSTANCE Lkscience/kmath/operations/ComplexField;
public synthetic fun acos (Ljava/lang/Object;)Ljava/lang/Object;
public fun acos (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun acosh (Ljava/lang/Object;)Ljava/lang/Object;
public fun acosh (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun add (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun add (Lkscience/kmath/operations/Complex;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun asin (Ljava/lang/Object;)Ljava/lang/Object;
public fun asin (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun asinh (Ljava/lang/Object;)Ljava/lang/Object;
public fun asinh (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun atan (Ljava/lang/Object;)Ljava/lang/Object;
public fun atan (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun atanh (Ljava/lang/Object;)Ljava/lang/Object;
public fun atanh (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun binaryOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun binaryOperation (Ljava/lang/String;Lkscience/kmath/operations/Complex;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public fun binaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
public synthetic fun cos (Ljava/lang/Object;)Ljava/lang/Object;
public fun cos (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun cosh (Ljava/lang/Object;)Ljava/lang/Object;
public fun cosh (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun div (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
public fun div (Ljava/lang/Number;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun div (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public synthetic fun div (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun div (Lkscience/kmath/operations/Complex;Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public fun div (Lkscience/kmath/operations/Complex;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun divide (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun divide (Lkscience/kmath/operations/Complex;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun exp (Ljava/lang/Object;)Ljava/lang/Object;
public fun exp (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public final fun getI ()Lkscience/kmath/operations/Complex;
public synthetic fun getOne ()Ljava/lang/Object;
public fun getOne ()Lkscience/kmath/operations/Complex;
public synthetic fun getZero ()Ljava/lang/Object;
public fun getZero ()Lkscience/kmath/operations/Complex;
public synthetic fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
public fun leftSideNumberOperation (Ljava/lang/String;Ljava/lang/Number;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public fun leftSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
public synthetic fun ln (Ljava/lang/Object;)Ljava/lang/Object;
public fun ln (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public final fun minus (DLkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun minus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
public fun minus (Ljava/lang/Number;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public synthetic fun minus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public final fun minus (Lkscience/kmath/operations/Complex;D)Lkscience/kmath/operations/Complex;
public fun minus (Lkscience/kmath/operations/Complex;Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public fun minus (Lkscience/kmath/operations/Complex;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public synthetic fun multiply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun multiply (Lkscience/kmath/operations/Complex;Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public fun multiply (Lkscience/kmath/operations/Complex;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun norm (Ljava/lang/Object;)Ljava/lang/Object;
public fun norm (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun number (Ljava/lang/Number;)Ljava/lang/Object;
public fun number (Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public final fun plus (DLkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun plus (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
public fun plus (Ljava/lang/Number;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public synthetic fun plus (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public final fun plus (Lkscience/kmath/operations/Complex;D)Lkscience/kmath/operations/Complex;
public fun plus (Lkscience/kmath/operations/Complex;Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public fun plus (Lkscience/kmath/operations/Complex;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun pow (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public fun pow (Lkscience/kmath/operations/Complex;Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public synthetic fun power (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public fun power (Lkscience/kmath/operations/Complex;Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public synthetic fun rightSideNumberOperation (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public fun rightSideNumberOperation (Ljava/lang/String;Lkscience/kmath/operations/Complex;Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public fun rightSideNumberOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function2;
public synthetic fun sin (Ljava/lang/Object;)Ljava/lang/Object;
public fun sin (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun sinh (Ljava/lang/Object;)Ljava/lang/Object;
public fun sinh (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun sqrt (Ljava/lang/Object;)Ljava/lang/Object;
public fun sqrt (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun symbol (Ljava/lang/String;)Ljava/lang/Object;
public fun symbol (Ljava/lang/String;)Lkscience/kmath/operations/Complex;
public synthetic fun tan (Ljava/lang/Object;)Ljava/lang/Object;
public fun tan (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun tanh (Ljava/lang/Object;)Ljava/lang/Object;
public fun tanh (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public final fun times (DLkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun times (Ljava/lang/Number;Ljava/lang/Object;)Ljava/lang/Object;
public fun times (Ljava/lang/Number;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun times (Ljava/lang/Object;Ljava/lang/Number;)Ljava/lang/Object;
public synthetic fun times (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
public fun times (Lkscience/kmath/operations/Complex;Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
public fun times (Lkscience/kmath/operations/Complex;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun unaryMinus (Ljava/lang/Object;)Ljava/lang/Object;
public fun unaryMinus (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public synthetic fun unaryOperation (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
public fun unaryOperation (Ljava/lang/String;Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public fun unaryOperationFunction (Ljava/lang/String;)Lkotlin/jvm/functions/Function1;
public synthetic fun unaryPlus (Ljava/lang/Object;)Ljava/lang/Object;
public fun unaryPlus (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
}
public final class kscience/kmath/operations/ComplexKt {
public static final fun complex (Lkscience/kmath/structures/Buffer$Companion;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/Buffer;
public static final fun complex (Lkscience/kmath/structures/MutableBuffer$Companion;ILkotlin/jvm/functions/Function1;)Lkscience/kmath/structures/MutableBuffer;
public static final fun getConjugate (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public static final fun getR (Lkscience/kmath/operations/Complex;)D
public static final fun getReciprocal (Lkscience/kmath/operations/Complex;)Lkscience/kmath/operations/Complex;
public static final fun getTheta (Lkscience/kmath/operations/Complex;)D
public static final fun toComplex (Ljava/lang/Number;)Lkscience/kmath/operations/Complex;
}
public abstract interface class kscience/kmath/operations/ExponentialOperations : kscience/kmath/operations/Algebra {
public static final field Companion Lkscience/kmath/operations/ExponentialOperations$Companion;
public static final field EXP_OPERATION Ljava/lang/String;