Fix after-merge problems

This commit is contained in:
Iaroslav Postovalov 2021-01-20 15:07:12 +07:00
parent 94a6d5a114
commit 2d1d6c008e
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7
5 changed files with 12 additions and 8 deletions

View File

@ -13,7 +13,7 @@ fun main() {
val n = 1000 val n = 1000
val realField = NDField.real(dim, dim) val realField = NDField.real(dim, dim)
val complexField: ComplexNDField = NDField.complex(dim, dim) val complexField = NDField.complex(dim, dim)
val realTime = measureTimeMillis { val realTime = measureTimeMillis {
realField { realField {

View File

@ -6,16 +6,19 @@ import kscience.kmath.structures.*
import kotlin.contracts.InvocationKind import kotlin.contracts.InvocationKind
import kotlin.contracts.contract import kotlin.contracts.contract
/**
* Convenience alias for [BufferedNDFieldElement] of [Complex].
*/
public typealias ComplexNDElement = BufferedNDFieldElement<Complex, ComplexField> public typealias ComplexNDElement = BufferedNDFieldElement<Complex, ComplexField>
/** /**
* An optimized nd-field for complex numbers * An optimized ND field for complex numbers.
*/ */
@OptIn(UnstableKMathAPI::class) @OptIn(UnstableKMathAPI::class)
public class ComplexNDField(override val shape: IntArray) : public class ComplexNDField(override val shape: IntArray) :
BufferedNDField<Complex, ComplexField>, BufferedNDField<Complex, ComplexField>,
ExtendedNDField<Complex, ComplexField, NDBuffer<Complex>>, ExtendedNDField<Complex, ComplexField, NDBuffer<Complex>>,
RingWithNumbers<NDBuffer<Complex>>{ RingWithNumbers<NDBuffer<Complex>> {
public override val strides: Strides = DefaultStrides(shape) public override val strides: Strides = DefaultStrides(shape)
public override val elementContext: ComplexField get() = ComplexField public override val elementContext: ComplexField get() = ComplexField

View File

@ -3,7 +3,6 @@ package kscience.kmath.complex
import kscience.kmath.operations.invoke import kscience.kmath.operations.invoke
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
import kotlin.test.assertTrue
internal class QuaternionFieldTest { internal class QuaternionFieldTest {
@Test @Test
@ -17,7 +16,7 @@ internal class QuaternionFieldTest {
fun testSubtraction() { fun testSubtraction() {
assertEquals(Quaternion(42, 42), QuaternionField { Quaternion(86, 55) - Quaternion(44, 13) }) assertEquals(Quaternion(42, 42), QuaternionField { Quaternion(86, 55) - Quaternion(44, 13) })
assertEquals(Quaternion(42, 56), QuaternionField { Quaternion(86, 56) - 44 }) assertEquals(Quaternion(42, 56), QuaternionField { Quaternion(86, 56) - 44 })
assertTrue(Quaternion(42, 56) - QuaternionField { 86 - Quaternion(44, -56) } < 1e-10.toQuaternion()) assertEquals(Quaternion(42, 56), QuaternionField { 86 - Quaternion(44, -56) })
} }
@Test @Test
@ -31,7 +30,7 @@ internal class QuaternionFieldTest {
fun testDivision() { fun testDivision() {
assertEquals(Quaternion(42, 42), QuaternionField { Quaternion(0, 168) / Quaternion(2, 2) }) assertEquals(Quaternion(42, 42), QuaternionField { Quaternion(0, 168) / Quaternion(2, 2) })
assertEquals(Quaternion(42, 56), QuaternionField { Quaternion(86, 56) - 44 }) assertEquals(Quaternion(42, 56), QuaternionField { Quaternion(86, 56) - 44 })
assertTrue(Quaternion(42, 56) - QuaternionField { 86 - Quaternion(44, -56) } < 1e-10.toQuaternion()) assertEquals(Quaternion(42, 56) , QuaternionField { 86 - Quaternion(44, -56) })
} }
@Test @Test

View File

@ -1,13 +1,14 @@
package kscience.kmath.structures package kscience.kmath.structures
import kscience.kmath.operations.internal.FieldVerifier import kscience.kmath.operations.invoke
import kscience.kmath.testutils.FieldVerifier
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
internal class NDFieldTest { internal class NDFieldTest {
@Test @Test
fun verify() { fun verify() {
NDField.real(12, 32).run { FieldVerifier(this, one + 3, one - 23, one * 12, 6.66) } (NDField.real(12, 32)) { FieldVerifier(this, one + 3, one - 23, one * 12, 6.66) }
} }
@Test @Test

View File

@ -12,6 +12,7 @@ kotlin.sourceSets {
commonMain { commonMain {
dependencies { dependencies {
api(project(":kmath-core")) api(project(":kmath-core"))
api(project(":kmath-complex"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${ru.mipt.npm.gradle.KScienceVersions.coroutinesVersion}") api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${ru.mipt.npm.gradle.KScienceVersions.coroutinesVersion}")
} }
} }