Home > eeg > egis > data_utils > fastcsdm.m

fastcsdm

PURPOSE ^

[cross_trial, fft_trial] = fastcsdm(trialdata);

SYNOPSIS ^

function [cross_trial, fft_trial] = fastcsdm(trialdata)

DESCRIPTION ^

 [cross_trial, fft_trial] = fastcsdm(trialdata);

 This is faster than csdm up to 256 pt FFTs.  After that it actually seems to
 get slower.  4 fold speed increase on 64pt FFTs

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [cross_trial, fft_trial] = fastcsdm(trialdata)
0002 % [cross_trial, fft_trial] = fastcsdm(trialdata);
0003 %
0004 % This is faster than csdm up to 256 pt FFTs.  After that it actually seems to
0005 % get slower.  4 fold speed increase on 64pt FFTs
0006 %
0007   
0008 trialdata = zeromean(trialdata);
0009 fft_trial = fft(trialdata)./(size(trialdata,1)+1);
0010 
0011 nfreq = size(trialdata,1)/2;
0012 nchan = size(trialdata,2);
0013 
0014 cross_trial = zeros(nfreq,(nchan.^2+nchan)/2); 
0015 cross_prod = zeros(nchan);
0016 
0017 relevant_indices = find(tril((1:nchan)'*(1:nchan)));
0018 
0019 if strcmp(computer, 'MAC2')
0020   disp('Run this on a real machine')
0021 else
0022   for ifreq = 1:nfreq
0023     chanvect = fft_trial(ifreq,:);
0024     cross_prod = chanvect.'*conj(chanvect);
0025     cross_trial(ifreq,:) = cross_prod(relevant_indices)';
0026   end;
0027 end

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003