scot-dev / scot

EEG/MEG Source Connectivity Toolbox in Python
http://scot-dev.github.io/scot-doc/index.html
MIT License
58 stars 23 forks source link

Vectorization #66

Open mbillingr opened 9 years ago

mbillingr commented 9 years ago

Many places in the code use list comprehensions where vectorized numpy functions could be used instead (example: datatools.dot_special).

We should find and fix these.

cbrnr commented 9 years ago

I'm not that firm in broadcasting yet, do you have a suggestion in the case of dot_special?

mbillingr commented 9 years ago

return np.dot(x.transpose((2, 0, 1)), a).transpose((1, 2, 0)) is 13 times faster than the list comprehension with the data i'm currently working with.

Note that the arguments to transpose would need to be changed for the new data orientation.

cbrnr commented 9 years ago

Alright. I just learned that transpose takes an axes argument :-).