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
brainunitlibrary. 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.SparseMatrixare 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:
- 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
operatoror a compatible callable.reverse (
bool) – If False, computefn(self, other)via_binary_op. If True, computefn(other, self)via_binary_rop. Defaults to False.
- Returns:
Result of the operation.
- Return type:
JITCMatrix or Any
- classmethod fromdense(dense, **kwargs)[source]#
Unsupported: JITC connectivity cannot be recovered from a dense matrix.
- Raises:
UnsupportedOperationError – Always. The generating
(prob, seed)cannot be inferred from a materialised matrix.
- tocoo()[source]#
Convert to COO by materialising through
tocsr().- Returns:
The same logical matrix in COO format. Eager-only (
O(nnz)), inheriting the tracing restriction oftocsr().- Return type:
brainunit.sparse.COO
See also
tocsrDirect count+fill materialisation to CSR.
tocscConvert to compressed sparse column format.
- tocsc()[source]#
Convert to CSC by materialising through
tocsr().- Returns:
The same logical matrix in CSC format. Eager-only (
O(nnz)), inheriting the tracing restriction oftocsr().- Return type:
See also
tocsrDirect count+fill materialisation to CSR.
tocooConvert to coordinate format.
- update_on_post(*args, **kwargs)[source]#
Unsupported: JITC connectivity has no per-synapse plastic weight.
- Raises:
UnsupportedOperationError – Always. Materialise first with
mat.tocsr().update_on_post(...).
- update_on_pre(*args, **kwargs)[source]#
Unsupported: JITC connectivity has no per-synapse plastic weight.
- Raises:
UnsupportedOperationError – Always. Materialise first with
mat.tocsr().update_on_pre(...).