JITCMatrix#

class brainevent.JITCMatrix(*args, shape, buffers=None)#

Just-in-time Connectivity (JITC) matrix.

A base class for just-in-time connectivity matrices that inherits from the SparseMatrix class in the brainunit library. This class serves as an abstraction for sparse matrices that are generated or computed on demand rather than stored in full.

JITC matrices are particularly useful in neural network simulations where connectivity patterns might be large but follow specific patterns that can be efficiently computed rather than explicitly stored in memory.

Notes

This is a base class and should be subclassed for specific implementations of JITC matrices. All attributes from brainunit.sparse.SparseMatrix are inherited.

apply(fn)[source]#

Apply a function to matrix value parameters while keeping structure.

Parameters:

fn (callable) – Unary callable applied by subclasses to their value parameters.

Returns:

A new matrix-like object with transformed values.

Return type:

JITCMatrix

apply2(other, fn, *, reverse=False)[source]#

Apply a binary function with consistent sparse-matrix semantics.

Parameters:
  • other (Any) – Right-hand operand for normal operations, or left-hand operand when reverse=True.

  • fn (callable) – Binary function from operator or a compatible callable.

  • reverse (bool) – If False, compute fn(self, other) via _binary_op. If True, compute fn(other, self) via _binary_rop. Defaults to False.

Returns:

Result of the operation.

Return type:

JITCMatrix or Any