brainevent.jitu#
- brainevent.jitu = <NameScope(brainevent.jitu)>#
Materialize a JIT uniform connectivity matrix as a dense array.
Generates a dense matrix where each entry is drawn from
Uniform(w_low, w_high)at positions determined by the connection probabilityproband random seedseed. All other entries are zero.- Parameters:
w_low (
Array|ndarray|Quantity|Number) – Lower bound of the uniform weight distribution. Scalar value, optionally with physical units (brainunit.Quantity).w_high (
Array|ndarray|Quantity|Number) – Upper bound of the uniform weight distribution. Must have the same dimension (units) asw_low.prob (
float) – Connection probability in [0, 1]. Determines the fraction of non-zero entries in the generated matrix.seed (
int) – Random seed for reproducible connectivity and weight generation.shape (
Tuple[int,int]) – Shape(m, n)of the output matrix.transpose (
bool) – If True, generate the transposed matrix of shape(n, m). Default is False.corder (
bool) – Memory layout order for the connectivity generation. True for C-order (row-major), False for Fortran-order (column-major). Default is True.backend (
str|None) – Computation backend. One of'numba'or'pallas'. If None, the default backend is used.
- Returns:
Dense matrix of shape
(m, n)(or(n, m)iftranspose=True) with uniformly distributed weights at connected positions and zeros elsewhere. Carries physical units ifw_lowhas units.- Return type:
Array|ndarray|Quantity|Number
See also
jitumvMatrix-vector product without materializing the matrix.
Notes
Each entry
A[i, j]of the generated matrix follows the model:A[i, j] = U[i, j] * B[i, j]where
U[i, j] ~ Uniform(w_low, w_high)andB[i, j] ~ Bernoulli(prob)are independent random variables. Equivalently:A[i, j] ~ Uniform(w_low, w_high)with probabilityprobA[i, j] = 0with probability1 - prob
The expected value of each entry is:
E[A[i, j]] = prob * (w_low + w_high) / 2The connectivity pattern and uniform variates are determined by
seedandprob. Using the sameseedalways produces the same matrix.This function materializes the full dense matrix. For implicit (non-materialized) matrix-vector products, use
jitumv()orjitumm()instead.Examples
>>> import jax.numpy as jnp >>> from brainevent._jit_uniform.float import jitu >>> dense = jitu(0.1, 0.5, 0.2, seed=42, shape=(4, 6)) >>> dense.shape (4, 6)