brainevent.jitumm#
- brainevent.jitumm = <NameScope(brainevent.jitumm)>#
Float matrix-matrix product with a JIT uniform connectivity matrix.
Computes the product of a just-in-time generated sparse matrix with uniformly distributed weights and a dense matrix
B. Unlike the binary variant, this function uses the full floating-point values ofB.The sparse matrix
Aof shape(m, n)is never materialized. Each entryA[i, j]is drawn fromUniform(w_low, w_high)with probabilityprob, seeded byseed.- Parameters:
w_low (Data) – Lower bound of the uniform weight distribution. Scalar value, optionally with physical units (
brainunit.Quantity).w_high (Data) – Upper bound of the uniform weight distribution. Must have the same dimension (units) as
w_low.prob (float) – Connection probability in [0, 1]. Determines the fraction of non-zero entries in the connectivity matrix.
B (Data) – Input dense matrix of shape
(n, k)(iftranspose=False) or(m, k)(iftranspose=True). Optionally with physical units.seed (int, optional) – Random seed for reproducible connectivity patterns. If None, a random seed is generated at compile time.
shape (MatrixShape) – Shape
(m, n)of the logical connectivity matrix.transpose (bool, optional) – If True, compute
A.T @ Binstead ofA @ B. Default is False.corder (bool, default=True) – Which index owns a random stream.
True: one stream per output row, walked over the input (a gather, no atomics).False: one stream per input index, scattered into the output (zero inputs are skipped). The two values draw different matrices;transpose=True, corder=not cuses exactly the transpose of the matrix drawn bytranspose=False, corder=c.backend (str, optional) – Computation backend. One of
'numba'or'pallas'. If None, the default backend is used.
- Returns:
Result matrix of shape
(m, k)(iftranspose=False) or(n, k)(iftranspose=True). Carries the product of units from the weight andBif either has physical units.- Return type:
Data
See also
jitumvMatrix-vector variant.
binary_jitummEvent-driven (binary) variant.
Notes
The connectivity matrix
Aof shape(m, n)follows the model:A[i, j] = U[i, j] * B_conn[i, j]where
U[i, j] ~ Uniform(w_low, w_high)andB_conn[i, j] ~ Bernoulli(prob)are independent, both determined byseed.The float matrix-matrix product computes:
result[i, j] = sum_{k=0}^{n-1} A[i, k] * B[k, j]Unlike the binary variant (
binary_jitumm()), this uses the full floating-point values ofBrather than treating them as binary events.When
transpose=True, the operation becomesresult = A^T @ B:result[j, l] = sum_{i=0}^{m-1} A[i, j] * B[i, l]Examples
>>> import jax.numpy as jnp >>> from brainevent._jit_uniform.float import jitumm >>> B = jnp.ones((5, 3)) >>> result = jitumm(0.1, 0.5, 0.2, B, seed=42, shape=(4, 5)) >>> result.shape (4, 3)