some speedups

parfor loop
bsxfun instead of repmat
fewer calls to Greenswave
fewer operations in inner loops