Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse matrix support #33

Open
sina-mansour opened this issue Oct 26, 2023 · 2 comments
Open

Sparse matrix support #33

sina-mansour opened this issue Oct 26, 2023 · 2 comments

Comments

@sina-mansour
Copy link

As detailed in the documentation, handling dense structures can be computationally burdensome. Essentially, an increase in the number of nodes may introduce complexities due to the cubic growth of the distance matrix size.

I particularly had a feature request, which might very well be already available but not explained in the documentation. I was wondering if brainsmash can also accept scipy.sparse distance matrices (or possibly inverses of distance such that zero would denote very long distances). This would result in a potentially considerable computational speedup and also reduce storage requirements for the dense distance matrix.

@jbburt
Copy link
Member

jbburt commented Oct 29, 2023

BrainSMASH does indeed use sparse matrix routines in the workbench sub-package, though I think they're used more for algorithmic efficiency (during graph traversal when deriving the cortical distance matrix) than to mitigate memory burden. The dense matrices are so large that they're never loaded entirely into memory anyways (via memory-mapping). In my analyses, the distance matrix for ~10^5 voxels was ~20 GB. Since I only ever needed to compute it once, the storage burden wasn't considerable. Is your situation different?

@sina-mansour
Copy link
Author

Yeah, basically, I was interested in testing the impact of using different distance matrices (e.g. at different levels of sparsity, or coming from different distance/similarity notions) and basically visualize how that changes the nulls produced by the method. Ideally, this could be facilitated by the possibility of loading a sparse matrix denoting the inverse of distance. This way a value of zero would indicate infinite (very long) distances and the same operation may be achieved by sparse matrices which may even take less than a GigaByte of storage/memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants