Tools version update

This commit is contained in:
Alexander Nozik 2020-10-13 20:34:17 +03:00
parent 245adab719
commit e44423192d
6 changed files with 10 additions and 8 deletions

View File

@ -24,4 +24,4 @@ subprojects {
readme { readme {
readmeTemplate = file("docs/templates/README-TEMPLATE.md") readmeTemplate = file("docs/templates/README-TEMPLATE.md")
} }

View File

@ -6,8 +6,8 @@ import kscience.kmath.structures.complex
fun main() { fun main() {
// 2d element // 2d element
val element = NDElement.complex(2, 2) { index: IntArray -> val element = NDElement.complex(2, 2) { (i,j) ->
Complex(index[0].toDouble() - index[1].toDouble(), index[0].toDouble() + index[1].toDouble()) Complex(i.toDouble() - j.toDouble(), i.toDouble() + j.toDouble())
} }
println(element) println(element)

View File

@ -16,7 +16,7 @@ import kotlin.properties.ReadOnlyProperty
*/ */
public class DerivativeStructureField( public class DerivativeStructureField(
public val order: Int, public val order: Int,
public val parameters: Map<String, Double> public val parameters: Map<String, Double>,
) : ExtendedField<DerivativeStructure> { ) : ExtendedField<DerivativeStructure> {
public override val zero: DerivativeStructure by lazy { DerivativeStructure(parameters.size, order) } public override val zero: DerivativeStructure by lazy { DerivativeStructure(parameters.size, order) }
public override val one: DerivativeStructure by lazy { DerivativeStructure(parameters.size, order, 1.0) } public override val one: DerivativeStructure by lazy { DerivativeStructure(parameters.size, order, 1.0) }
@ -85,8 +85,9 @@ public class DerivativeStructureField(
/** /**
* A constructs that creates a derivative structure with required order on-demand * A constructs that creates a derivative structure with required order on-demand
*/ */
public class DiffExpression(public val function: DerivativeStructureField.() -> DerivativeStructure) : public class DiffExpression(
Expression<Double> { public val function: DerivativeStructureField.() -> DerivativeStructure,
) : Expression<Double> {
public override operator fun invoke(arguments: Map<String, Double>): Double = DerivativeStructureField( public override operator fun invoke(arguments: Map<String, Double>): Double = DerivativeStructureField(
0, 0,
arguments arguments

View File

@ -18,7 +18,7 @@ internal inline fun <R> diff(
internal class AutoDiffTest { internal class AutoDiffTest {
@Test @Test
fun derivativeStructureFieldTest() { fun derivativeStructureFieldTest() {
val res = diff(3, "x" to 1.0, "y" to 1.0) { val res: Double = diff(3, "x" to 1.0, "y" to 1.0) {
val x by variable val x by variable
val y = variable("y") val y = variable("y")
val z = x * (-sin(x * y) + y) val z = x * (-sin(x * y) + y)

View File

@ -195,6 +195,7 @@ public data class Complex(val re: Double, val im: Double) : FieldElement<Complex
} }
} }
/** /**
* Creates a complex number with real part equal to this real. * Creates a complex number with real part equal to this real.
* *

View File

@ -10,7 +10,7 @@ pluginManagement {
maven("https://dl.bintray.com/kotlin/kotlin-dev/") maven("https://dl.bintray.com/kotlin/kotlin-dev/")
} }
val toolsVersion = "0.6.1-dev-1.4.20-M1" val toolsVersion = "0.6.3-dev-1.4.20-M1"
val kotlinVersion = "1.4.20-M1" val kotlinVersion = "1.4.20-M1"
plugins { plugins {