diff --git a/build.gradle.kts b/build.gradle.kts index e2c5fc44f..a7487f916 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -77,4 +77,4 @@ ksciencePublish { apiValidation.nonPublicMarkers.add("space.kscience.kmath.UnstableKMathAPI") -val multikVersion by extra("0.2.0") +val multikVersion by extra("0.2.2") diff --git a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/_generated.kt b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/_generated.kt index 984f1619b..f48ab4c19 100644 --- a/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/_generated.kt +++ b/kmath-ejml/src/main/kotlin/space/kscience/kmath/ejml/_generated.kt @@ -19,19 +19,13 @@ import org.ejml.sparse.csc.factory.DecompositionFactory_DSCC import org.ejml.sparse.csc.factory.DecompositionFactory_FSCC import org.ejml.sparse.csc.factory.LinearSolverFactory_DSCC import org.ejml.sparse.csc.factory.LinearSolverFactory_FSCC +import space.kscience.kmath.UnstableKMathAPI import space.kscience.kmath.linear.* import space.kscience.kmath.linear.Matrix -import space.kscience.kmath.UnstableKMathAPI import space.kscience.kmath.nd.StructureFeature -import space.kscience.kmath.structures.Float64 -import space.kscience.kmath.structures.Float32 -import space.kscience.kmath.operations.Float64Field import space.kscience.kmath.operations.Float32Field -import space.kscience.kmath.operations.DoubleField -import space.kscience.kmath.operations.FloatField +import space.kscience.kmath.operations.Float64Field import space.kscience.kmath.operations.invoke -import space.kscience.kmath.structures.Float64Buffer -import space.kscience.kmath.structures.Float32Buffer import space.kscience.kmath.structures.DoubleBuffer import space.kscience.kmath.structures.FloatBuffer import kotlin.reflect.KClass diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Circle2D.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Circle2D.kt index 7841be8ff..1cf8d5dc2 100644 --- a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Circle2D.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Circle2D.kt @@ -6,16 +6,26 @@ package space.kscience.kmath.geometry.euclidean2d import kotlinx.serialization.Serializable +import space.kscience.kmath.geometry.Vector2D import kotlin.math.PI + +public interface Circle2D{ + public val center: Vector2D + public val radius: Double +} + +public val Circle2D<*>.circumference: Double get() = radius * 2 * PI + /** * A circle in 2D space */ @Serializable -public data class Circle2D( - @Serializable(Float64Space2D.VectorSerializer::class) public val center: DoubleVector2D, - public val radius: Double -) +public data class Float64Circle2D( + @Serializable(Float64Space2D.VectorSerializer::class) override val center: Float64Vector2D, + override val radius: Double +): Circle2D + +public fun Circle2D(center: Float64Vector2D, radius: Double): Circle2D = Float64Circle2D(center, radius) -public val Circle2D.circumference: Double get() = radius * 2 * PI diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float32Space2D.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float32Space2D.kt index 89c3dc204..4dd188d49 100644 --- a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float32Space2D.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float32Space2D.kt @@ -19,12 +19,10 @@ import kotlin.math.pow import kotlin.math.sqrt @Serializable(Float32Space2D.VectorSerializer::class) -public interface Float32Vector2D: Vector2D +public interface Float32Vector2D : Vector2D -public object Float32Space2D : - GeometrySpace, - ScaleOperations { +public object Float32Space2D : GeometrySpace, ScaleOperations { @Serializable @SerialName("Float32Vector2D") diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float64Space2D.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float64Space2D.kt index 030a46185..423e43c30 100644 --- a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float64Space2D.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/euclidean2d/Float64Space2D.kt @@ -14,13 +14,11 @@ import kotlinx.serialization.encoding.Encoder import space.kscience.kmath.geometry.GeometrySpace import space.kscience.kmath.geometry.Vector2D import space.kscience.kmath.operations.Float64Field -import space.kscience.kmath.operations.Norm import space.kscience.kmath.operations.ScaleOperations import kotlin.math.pow import kotlin.math.sqrt - public typealias DoubleVector2D = Vector2D public typealias Float64Vector2D = Vector2D @@ -30,9 +28,7 @@ public val Vector2D.r: Double get() = Float64Space2D.norm(this) /** * 2D Euclidean space */ -public object Float64Space2D : GeometrySpace, - ScaleOperations, - Norm { +public object Float64Space2D : GeometrySpace, ScaleOperations { @Serializable @SerialName("Float64Vector2D") @@ -72,4 +68,6 @@ public object Float64Space2D : GeometrySpace, public val yAxis: DoubleVector2D = vector(0.0, 1.0) } +public fun Float64Vector2D(x: Number, y: Number): Float64Vector2D = Float64Space2D.vector(x, y) + public val Float64Field.euclidean2D: Float64Space2D get() = Float64Space2D \ No newline at end of file diff --git a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/quaternionOperations.kt b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/quaternionOperations.kt index b6ad5009e..859255004 100644 --- a/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/quaternionOperations.kt +++ b/kmath-geometry/src/commonMain/kotlin/space/kscience/kmath/geometry/quaternionOperations.kt @@ -8,13 +8,7 @@ package space.kscience.kmath.geometry import space.kscience.kmath.complex.Quaternion import space.kscience.kmath.complex.QuaternionAlgebra import space.kscience.kmath.complex.conjugate -import space.kscience.kmath.complex.normalized -import space.kscience.kmath.geometry.euclidean3d.Float32Space3D -import space.kscience.kmath.geometry.euclidean3d.Float32Vector3D import space.kscience.kmath.geometry.euclidean3d.theta -import kotlin.math.asin -import kotlin.math.atan2 -import kotlin.math.pow public operator fun Quaternion.times(other: Quaternion): Quaternion = QuaternionAlgebra.multiply(this, other) @@ -50,11 +44,11 @@ public infix fun Quaternion.dot(other: Quaternion): Double = w * other.w + x * o // return Float32Vector3D(roll, pitch, yaw) //} -/** - * Quaternion to XYZ Cardan angles - */ -public fun Quaternion.toEuler(): Float32Vector3D = if (QuaternionAlgebra.norm(this) == 0.0) { - Float32Space3D.zero -} else { - normalized().normalizedToEuler() -} \ No newline at end of file +///** +// * Quaternion to XYZ Cardan angles +// */ +//public fun Quaternion.toEuler(): Float32Vector3D = if (QuaternionAlgebra.norm(this) == 0.0) { +// Float32Space3D.zero +//} else { +// normalized().normalizedToEuler() +//} \ No newline at end of file