Hi,
The Matlab variant is not my main area of expertise, but the SPD manifold
you could use on any of your N matrices,
in there you have a log. so something like
```
M = sympositivedefinitefactory(m)
M.log(mean, pi) % or data[:,:,i]
```
for all your N pi matrices could work.
collecting all these in a mxmxN array you could reshape it afterwards.
Hope this is a first start,
Ronny