Dev #194

Merged
altavir merged 266 commits from dev into master 2021-01-20 17:32:32 +03:00
8 changed files with 38 additions and 10 deletions
Showing only changes of commit 53ea704bae - Show all commits

View File

@ -2,13 +2,14 @@ plugins {
id("ru.mipt.npm.project")
}
val kmathVersion by extra("0.2.0-dev-1")
val kmathVersion by extra("0.2.0-dev-2")
val bintrayRepo by extra("kscience")
val githubProject by extra("kmath")
allprojects {
repositories {
jcenter()
maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/hotkeytlt/maven")
}

View File

@ -10,9 +10,11 @@
>
> ```gradle
> repositories {
> maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
> maven { url 'https://dl.bintray.com/mipt-npm/kscience' }
> maven { url 'https://dl.bintray.com/mipt-npm/dev' }
> maven { url 'https://dl.bintray.com/hotkeytlt/maven' }
> }
>
> dependencies {
@ -23,6 +25,7 @@
>
> ```kotlin
> repositories {
> maven("https://dl.bintray.com/kotlin/kotlin-eap")
> maven("https://dl.bintray.com/mipt-npm/kscience")
> maven("https://dl.bintray.com/mipt-npm/dev")
> maven("https://dl.bintray.com/hotkeytlt/maven")

View File

@ -3,8 +3,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
java
kotlin("jvm")
kotlin("plugin.allopen") version "1.4.20-dev-3898-14"
id("kotlinx.benchmark") version "0.2.0-dev-20"
kotlin("plugin.allopen")
id("kotlinx.benchmark")
}
allOpen.annotation("org.openjdk.jmh.annotations.State")
@ -26,7 +26,7 @@ dependencies {
implementation(project(":kmath-prob"))
implementation(project(":kmath-viktor"))
implementation(project(":kmath-dimensions"))
implementation("org.jetbrains.kotlinx:kotlinx-io-jvm:0.2.0-npm-dev-6")
implementation("org.jetbrains.kotlinx:kotlinx-io:0.2.0-npm-dev-11")
implementation("org.jetbrains.kotlinx:kotlinx.benchmark.runtime:0.2.0-dev-20")
"benchmarksCompile"(sourceSets.main.get().output + sourceSets.main.get().compileClasspath) //sourceSets.main.output + sourceSets.main.runtimeClasspath
}
@ -34,9 +34,8 @@ dependencies {
// Configure benchmark
benchmark {
// Setup configurations
targets
targets.register("benchmarks")
// This one matches sourceSet name above
.register("benchmarks")
configurations.register("fast") {
warmups = 5 // number of warmup iterations

View File

@ -1,4 +1,7 @@
plugins { id("ru.mipt.npm.mpp") }
plugins {
id("ru.mipt.npm.mpp")
id("ru.mipt.npm.native")
}
description = "A proof of concept module for adding type-safe dimensions to structures"

View File

@ -0,0 +1,20 @@
package kscience.kmath.dimensions
import kotlin.native.concurrent.ThreadLocal
import kotlin.reflect.KClass
@ThreadLocal
private val dimensionMap: MutableMap<UInt, Dimension> = hashMapOf(1u to D1, 2u to D2, 3u to D3)
@Suppress("UNCHECKED_CAST")
public actual fun <D : Dimension> Dimension.Companion.resolve(type: KClass<D>): D = dimensionMap
.entries
.map(MutableMap.MutableEntry<UInt, Dimension>::value)
.find { it::class == type } as? D
?: error("Can't resolve dimension $type")
public actual fun Dimension.Companion.of(dim: UInt): Dimension = dimensionMap.getOrPut(dim) {
object : Dimension {
override val dim: UInt get() = dim
}
}

View File

@ -10,7 +10,8 @@ pluginManagement {
maven("https://dl.bintray.com/kotlin/kotlin-dev/")
}
val toolsVersion = "0.6.1"
val toolsVersion = "0.6.1-dev-1.4.20-M1"
val kotlinVersion = "1.4.20-M1"
plugins {
id("kotlinx.benchmark") version "0.2.0-dev-20"
@ -18,7 +19,8 @@ pluginManagement {
id("ru.mipt.npm.mpp") version toolsVersion
id("ru.mipt.npm.jvm") version toolsVersion
id("ru.mipt.npm.publish") version toolsVersion
kotlin("plugin.allopen")
kotlin("jvm") version kotlinVersion
kotlin("plugin.allopen") version kotlinVersion
}
}