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 realField = NDField.real(dim, dim)
val complexField: ComplexNDField = NDField.complex(dim, dim)
val complexField = NDField.complex(dim, dim)
val realTime = measureTimeMillis {
realField {

View File

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

View File

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

View File

@ -1,13 +1,14 @@
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.assertEquals
internal class NDFieldTest {
@Test
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

View File

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