multi threading by index i. 73 times faster than MATLAB