diff --git a/pywafo/src/wafo/magic.py b/pywafo/src/wafo/magic.py new file mode 100644 index 0000000..2f2a1f2 --- /dev/null +++ b/pywafo/src/wafo/magic.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Apr 17 13:59:12 2012 + +@author: pab +""" +import numpy as np + +def magic(n): + ix = np.arange(n)+1 + J, I = np.meshgrid(ix,ix) + A = np.mod(I+J-(n+3)/2,n) + B = np.mod(I+2*J-2,n) + M = n*A + B + 1 + return M \ No newline at end of file