Attributes modify->modified
This commit is contained in:
parent
ec88d6be9e
commit
ecb5d28110
@ -83,8 +83,8 @@ public fun <A : Attribute<Unit>> Attributes.withAttribute(attribute: A): Attribu
|
||||
/**
|
||||
* Create a new [Attributes] by modifying the current one
|
||||
*/
|
||||
public fun <T> Attributes.modify(block: AttributesBuilder<T>.() -> Unit): Attributes = Attributes<T> {
|
||||
putAll(this@modify)
|
||||
public fun <T> Attributes.modified(block: AttributesBuilder<T>.() -> Unit): Attributes = Attributes<T> {
|
||||
putAll(this@modified)
|
||||
block()
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public fun <T, A : Any> MultivariateIntegrand<T>.withAttribute(
|
||||
|
||||
public fun <T> MultivariateIntegrand<T>.withAttributes(
|
||||
block: AttributesBuilder<MultivariateIntegrand<T>>.() -> Unit,
|
||||
): MultivariateIntegrand<T> = withAttributes(attributes.modify(block))
|
||||
): MultivariateIntegrand<T> = withAttributes(attributes.modified(block))
|
||||
|
||||
public inline fun <reified T : Any> MultivariateIntegrand(
|
||||
attributeBuilder: AttributesBuilder<MultivariateIntegrand<T>>.() -> Unit,
|
||||
|
@ -27,7 +27,7 @@ public fun <T, A : Any> UnivariateIntegrand<T>.withAttribute(
|
||||
|
||||
public fun <T> UnivariateIntegrand<T>.withAttributes(
|
||||
block: AttributesBuilder<UnivariateIntegrand<T>>.() -> Unit,
|
||||
): UnivariateIntegrand<T> = withAttributes(attributes.modify(block))
|
||||
): UnivariateIntegrand<T> = withAttributes(attributes.modified(block))
|
||||
|
||||
public inline fun <reified T : Any> UnivariateIntegrand(
|
||||
attributeBuilder: AttributesBuilder<UnivariateIntegrand<T>>.() -> Unit,
|
||||
|
@ -65,7 +65,7 @@ public fun <T> FunctionOptimization<T>.withAttributes(
|
||||
modifier: AttributesBuilder<FunctionOptimization<T>>.() -> Unit,
|
||||
): FunctionOptimization<T> = FunctionOptimization(
|
||||
expression,
|
||||
attributes.modify(modifier),
|
||||
attributes.modified(modifier),
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -108,7 +108,7 @@ public fun XYOptimization(
|
||||
|
||||
public fun XYFit.withAttributes(
|
||||
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(
|
||||
optimizer: Optimizer<Double, XYFit>,
|
||||
@ -123,7 +123,7 @@ public suspend fun XYColumnarData<Double, Double, Double>.fitWith(
|
||||
val problem = XYFit(
|
||||
this,
|
||||
modelExpression,
|
||||
attributes.modify<XYFit> {
|
||||
attributes.modified<XYFit> {
|
||||
set(OptimizationStartPoint(), startingPoint)
|
||||
if (!hasAny<OptimizationLog>()) {
|
||||
set(OptimizationLog, Loggable.console)
|
||||
|
Loading…
Reference in New Issue
Block a user