MatTwoPowModM compute matrix B = (A^(2^e) % m); works even if A = B
function MatTwoPowModM input Real[3, 3] A; output Real[3, 3] B; input Real m; input Real e; end MatTwoPowModM;