Skip to content

Conversation

Edouard2laire
Copy link
Contributor

@Edouard2laire Edouard2laire commented Sep 15, 2025

Hello,

The goal of this PR is to start implementing the idea described in #808

Since we gained a lot in memory usage by not storing the matrix plainly (nVertex x nTime) but as factors, it can be useful to not regenerate the entire matrix upon loading, but to only expand part of the matrix necessary for the task at hand.

For example, to display a specific time point, the last matrix can be reduced before doing the multiplication, greatly reducing the time spent and memory usage.

This PR is critical when dealing with long nirs data (lets say whole night nirs) while impacting very little short-duration recording.

Edit: Maybe a better name could be found for bst_multiply_cells, but I don't have any idea right now.

@Edouard2laire Edouard2laire marked this pull request as ready for review September 15, 2025 20:09
@Edouard2laire
Copy link
Contributor Author

Edouard2laire commented Sep 16, 2025

So, i just tried loading 9 hours of data on the cortex, in our lab computer with 64 Gb of ram. and wow. its so nice. Without this trick matlab would just become unresponsive but now it just load and display with a RAM usage less than 7 Gb.

Here is what ImageGridAmp looks like :
|- ImageGridAmp: {[15002x7810 double sparse], [7810x50981 double], [50981x302001 double sparse]}

If we were to multiply the three matrices before doing any selection, it would create a matrix the size of 15 002 x 302 001 which would take 36 Gb in memory...

When displaying a single time point, the selection of time reduces the matrix to
l- ImageGridAmp: {15002×7810 double} {7810×71 double} {71×1 double}

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

Successfully merging this pull request may close these issues.

1 participant