brainmass.additive_coupling#
- brainmass.additive_coupling(delayed_x, conn, k=1.0, b=0.0)#
Additive (linear) coupling kernel (function form).
Computes, for each target unit i over the last axis, the additive term
current_i = k * sum_j conn[i, j] * x_{i, j} + b
with full support for leading batch/time dimensions and unit-safe algebra. This is TVB’s
Linearcoupling; the global coupling strengthkis TVB’sG(G ≡ k) andbis its offset/bias.- 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 aPrefetch.conn (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Connection weights with shape(N_out, N_in).k (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Global coupling strength (TVBG). Scalar or broadcastable to(..., N_out).b (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Additive offset/bias, added after the weighted sum. The default0.0is the additive identity, so it reproduces the bias-free coupling bit-for-bit (and, by brainunit’s convention, does not disturb a unit-carrying output). A non-zerobshould carry the same units ask * sum_j conn x.
- Returns:
Coupling output with shape
(..., N_out). Units are preserved when inputs are Quantity.- Return type:
ArrayLike
- Raises:
ValueError – If shapes are incompatible with the expected conventions.
Examples
>>> import brainmass >>> import jax.numpy as jnp >>> conn = jnp.ones((2, 2)) >>> x = jnp.array([[1.0, 2.0], [3.0, 4.0]]) >>> out = brainmass.additive_coupling(x, conn, k=1.0, b=0.5) >>> [float(v) for v in out] [3.5, 7.5]