from scipy.io import loadmat, savemat
from pydec import *

X = loadmat('pyamg.mat')
del X['__version__']
del X['__header__']
del X['__globals__']

sc = simplicial_complex(X['vertices'],X['elements'].astype('intc'))

d = sc[0].d
M = whitney_innerproduct(sc,1)
A = d.T.tocsr() * M * d

X['A'] = A
X['B'] = ones((A.shape[0],1))

savemat('pyamg.mat',X)

@@ -1,12 +1,31 @@
+import numpy as np%0A
 from scipy.i
@@ -68,17 +68,56 @@
  import 
-*
+simplicial_complex, whitney_innerproduct
 %0A%0AX = lo
@@ -236,16 +236,17 @@
 tices'%5D,
+ 
 X%5B'eleme
@@ -308,16 +308,17 @@
 duct(sc,
+ 
 1)%0AA = d
@@ -357,16 +357,19 @@
 %5B'B'%5D = 
+np.
 ones((A.
@@ -377,16 +377,17 @@
 hape%5B0%5D,
+ 
 1))%0A%0Asav
@@ -403,11 +403,12 @@
 mg.mat',
+ 
 X)%0A

fix old script