Nirstorm / nirstorm

Brainstorm plugin for fNIRS data analysis
GNU General Public License v3.0
34 stars 12 forks source link

Update MNE implementation #236

Closed Edouard2laire closed 4 months ago

Edouard2laire commented 4 months ago

Note:

For long recordings, following code can be used for norm(WkernelJ)

        tic;
        [U,S] = svd(M,'econ'); % Can be pre-computed
        [~,R] = qr(wKernel*U);

        max(svd(R*S))
        toc;

Source: https://math.stackexchange.com/questions/67231/singular-value-decomposition-of-product-of-matrices

Time comparison:

        tic
        norm(wKernel*M);
        toc

        tic;
        max(svd(wKernel*M));
        toc;

        tic;
        [U,S] = svd(wKernel');
        [~,R] = qr(M'*U);

        Prior(iAlpha)  = max(svd(R*S));
        toc;

on 45s data at 10Hz: Elapsed time is 0.118618 seconds. Elapsed time is 0.140532 seconds. Elapsed time is 0.109374 seconds.

On 10 minutes data:

Elapsed time is 23.214881 seconds. Elapsed time is 0.446106 seconds.