gradientCast

inline fun <ID : Any, Value, Distance : Comparable<Distance>> Aggregate<ID>.gradientCast(source: Boolean, local: Value, bottom: Distance, top: Distance, crossinline accumulateData: (Distance, Distance, Value) -> Value = { _, _, data -> data }, crossinline accumulateDistance: (Distance, Distance) -> Distance, crossinline metric: () -> Field<ID, Distance>): Value

Propagate local values across a spanning tree starting from the closest source.

If there are no sources and no neighbors, default to local value. The metric function is used to compute the distance between devices in form of a field of Distances. Distances must be in the [bottom, top] range, accumulateDistance is used to sum distances. accumulateData is used to modify data from neighbors on the fly, and defaults to the identity function.


@JvmName(name = "gradientCastInt")
inline fun <ID : Any, Type> Aggregate<ID>.gradientCast(source: Boolean, local: Type, crossinline accumulateData: (Int, Int, Type) -> Type = { _, _, data -> data }, crossinline metric: () -> Field<ID, Int> = { neighboring(1) }): Type

Propagate local values across a spanning tree starting from the closest source.

If there are no sources and no neighbors, default to local value. The metric function is used to compute the distance between devices in form of a field of Ints. accumulateData is used to modify data from neighbors on the fly, and defaults to the identity function.


@JvmName(name = "gradientCastDouble")
inline fun <ID : Any, Type> Aggregate<ID>.gradientCast(source: Boolean, local: Type, crossinline accumulateData: (Double, Double, Type) -> Type = { _, _, data -> data }, crossinline metric: () -> Field<ID, Double> = { neighboring(1.0) }): Type

Propagate local values across a spanning tree starting from the closest source.

If there are no sources and no neighbors, default to local value. The metric function is used to compute the distance between devices in form of a field of Doubles. accumulateData is used to modify data from neighbors on the fly, and defaults to the identity function.