v0.2.0 #206
@ -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 {
|
||||
|
@ -6,10 +6,13 @@ 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) :
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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}")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user