brainmass.diffusive_coupling#
- brainmass.diffusive_coupling(delayed_x, y, conn, k)#
Diffusive coupling kernel (function form).
Computes, for each target unit i over the last axis, the diffusive term
current_i = k * sum_j conn[i, j] * (x_{i, j} - y_i)
with full support for leading batch/time dimensions and unit-safe algebra.
- Parameters:
delayed_x (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Zero-arg callable returning the source signal with shape(..., N_out, N_in)or flattened(..., N_out*N_in). Typically aPrefetchthat reads a state from another module.y (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Zero-arg callable returning the target signal with shape(..., N_out).conn (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Connection weights. Either(N_out, N_in)or flattened(N_out*N_in,).k (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Global coupling strength. Can be scalar or broadcastable to the output shape(..., N_out).
- Returns:
Coupling output with shape
(..., N_out). If inputs carry units, the result preserves unit consistency via brainunit.- Return type:
ArrayLike
- Raises:
ValueError – If shapes are incompatible with the expected conventions.