FastLinearCoupling
experimental.network_dynamics.coupling.FastLinearCoupling(
incoming_states=None,
local_states=None,
**kwargs,
)Fast linear coupling using vectorized mode.
Uses local states (instead of incoming states) to trigger vectorized matrix multiplication instead of per-edge element-wise operations. This is significantly faster for dense all-to-all connectivity patterns.
Implements the same transformation as LinearCoupling:
\[c = G \cdot \sum_{j} w_{ij} x_j + b\]
but uses optimized matrix operations.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| local_states | str or list of str | State name(s) from current node (required for vectorized mode) | None |
Attributes
| Name | Type | Description |
|---|---|---|
| N_OUTPUT_STATES | int | Number of output coupling states: 1 |
| DEFAULT_PARAMS | Bunch | Default parameters: G=1.0 (coupling strength), b=0.0 (offset/bias) |
Notes
Use this variant when you have dense connectivity and want better performance. For sparse graphs, the standard LinearCoupling may be more efficient.
Examples
>>> # Fast vectorized coupling for dense networks
>>> coupling = FastLinearCoupling(local_states='S', G=1.0)Methods
| Name | Description |
|---|---|
| post | Apply linear transformation to summed inputs. |
| pre | Return local states to trigger vectorized mode. |
post
experimental.network_dynamics.coupling.FastLinearCoupling.post(
summed_inputs,
local_states,
params,
)Apply linear transformation to summed inputs.
pre
experimental.network_dynamics.coupling.FastLinearCoupling.pre(
incoming_states,
local_states,
params,
)Return local states to trigger vectorized mode.
By returning [n_local, n_nodes] (2D), we trigger the vectorized path which uses matmul instead of per-edge ops.