Performance improvements to csm using LazyArrays
Added LazyArrays to improve csm performance. Basically the inner loop
for m in 1:M
for j in m:M
ds .= Sc[m].*S[j]
C[j,m,:] = mean!(Pxy,ds)
end
end
is replaced by:
for m in 1:M
for j in m:M
C[j,m,:] .= dropdims(mean(LazyArray(@~ Sc[m].*S[j]),dims=2);dims=2)
end
end
Gives approx performance improvement of 1.3X, however, with an increase in allocations.