Attributes modify->modified

This commit is contained in:
Alexander Nozik 2024-03-27 08:51:56 +03:00
parent ec88d6be9e
commit ecb5d28110
5 changed files with 7 additions and 7 deletions

View File

@ -83,8 +83,8 @@ public fun <A : Attribute<Unit>> Attributes.withAttribute(attribute: A): Attribu
/** /**
* Create a new [Attributes] by modifying the current one * Create a new [Attributes] by modifying the current one
*/ */
public fun <T> Attributes.modify(block: AttributesBuilder<T>.() -> Unit): Attributes = Attributes<T> { public fun <T> Attributes.modified(block: AttributesBuilder<T>.() -> Unit): Attributes = Attributes<T> {
putAll(this@modify) putAll(this@modified)
block() block()
} }

View File

@ -26,7 +26,7 @@ public fun <T, A : Any> MultivariateIntegrand<T>.withAttribute(
public fun <T> MultivariateIntegrand<T>.withAttributes( public fun <T> MultivariateIntegrand<T>.withAttributes(
block: AttributesBuilder<MultivariateIntegrand<T>>.() -> Unit, block: AttributesBuilder<MultivariateIntegrand<T>>.() -> Unit,
): MultivariateIntegrand<T> = withAttributes(attributes.modify(block)) ): MultivariateIntegrand<T> = withAttributes(attributes.modified(block))
public inline fun <reified T : Any> MultivariateIntegrand( public inline fun <reified T : Any> MultivariateIntegrand(
attributeBuilder: AttributesBuilder<MultivariateIntegrand<T>>.() -> Unit, attributeBuilder: AttributesBuilder<MultivariateIntegrand<T>>.() -> Unit,

View File

@ -27,7 +27,7 @@ public fun <T, A : Any> UnivariateIntegrand<T>.withAttribute(
public fun <T> UnivariateIntegrand<T>.withAttributes( public fun <T> UnivariateIntegrand<T>.withAttributes(
block: AttributesBuilder<UnivariateIntegrand<T>>.() -> Unit, block: AttributesBuilder<UnivariateIntegrand<T>>.() -> Unit,
): UnivariateIntegrand<T> = withAttributes(attributes.modify(block)) ): UnivariateIntegrand<T> = withAttributes(attributes.modified(block))
public inline fun <reified T : Any> UnivariateIntegrand( public inline fun <reified T : Any> UnivariateIntegrand(
attributeBuilder: AttributesBuilder<UnivariateIntegrand<T>>.() -> Unit, attributeBuilder: AttributesBuilder<UnivariateIntegrand<T>>.() -> Unit,

View File

@ -65,7 +65,7 @@ public fun <T> FunctionOptimization<T>.withAttributes(
modifier: AttributesBuilder<FunctionOptimization<T>>.() -> Unit, modifier: AttributesBuilder<FunctionOptimization<T>>.() -> Unit,
): FunctionOptimization<T> = FunctionOptimization( ): FunctionOptimization<T> = FunctionOptimization(
expression, expression,
attributes.modify(modifier), attributes.modified(modifier),
) )
/** /**

View File

@ -108,7 +108,7 @@ public fun XYOptimization(
public fun XYFit.withAttributes( public fun XYFit.withAttributes(
modifier: AttributesBuilder<XYFit>.() -> Unit, modifier: AttributesBuilder<XYFit>.() -> Unit,
): XYFit = XYFit(data, model, attributes.modify(modifier), pointToCurveDistance, pointWeight, xSymbol) ): XYFit = XYFit(data, model, attributes.modified(modifier), pointToCurveDistance, pointWeight, xSymbol)
public suspend fun XYColumnarData<Double, Double, Double>.fitWith( public suspend fun XYColumnarData<Double, Double, Double>.fitWith(
optimizer: Optimizer<Double, XYFit>, optimizer: Optimizer<Double, XYFit>,
@ -123,7 +123,7 @@ public suspend fun XYColumnarData<Double, Double, Double>.fitWith(
val problem = XYFit( val problem = XYFit(
this, this,
modelExpression, modelExpression,
attributes.modify<XYFit> { attributes.modified<XYFit> {
set(OptimizationStartPoint(), startingPoint) set(OptimizationStartPoint(), startingPoint)
if (!hasAny<OptimizationLog>()) { if (!hasAny<OptimizationLog>()) {
set(OptimizationLog, Loggable.console) set(OptimizationLog, Loggable.console)