print >> html, '<h2>Update plans</h2>'
cmd = """ghc -isrc Dyna.Backend.Python -e 'processFile "%s"' """ % dynafile
- assert 0 == os.system(cmd), 'command failed:\n\t' + cmd
+ if 0 != os.system(cmd):
+ print 'command failed:\n\t' + cmd
+ os.system('gnome-open %s 2>/dev/null >/dev/null' % html.name)
+ return
# print >> html, '<pre>'
print >> html, '</div>'
- print
- print 'wrote', html.name
-
if argv.browser:
os.system('gnome-open %s 2>/dev/null >/dev/null' % html.name)
print >> out, x
print >> out, '====================================='
- rows = [(pretty((x,idx)), idx, row, pretty(row[-1])) for idx, row in chart[x].data.items()]
+ rows = [(pretty((x,idx)), idx, row, pretty(row[-1])) for idx, row in chart[x].data.items() if row[-1] is not None]
rows.sort()
for p, _, _, v in rows:
-% A and B are names of matricies
-times(A, B, I, J) += m(A, I, K) * m(B, K, J).
-times(A, B, C, I, L) += m(A, I, K) * m(B, K, J) * m(C, J, L).
+% A and B are names of matrices
+times(A, B, I, J) += m(A, I, K) * m(B, K, J) whenever product(A,B).
+
+m(P, I, J) += shape(A, R, C),
+ shape(B, C, D),
+ P is product(A, B),
+ times(A, B, I, J).
+
+shape(P, R, C) :- P is product(A, B), shape(A, R, X), shape(B, X, C).
+
+shape(X, *rows(X), *cols(X)).
+rows(X) max= m(X, R, _), R.
+cols(X) max= m(X, _, C), C.
-% matrix "c" is the product of matricies "a" and "b"
-m(c, I, J) += times(a, b, I, J).
% matrix "a" = [ 1 0 ;
% 0 1 ]
m(a, 2, 1) += 0 .
m(a, 2, 2) += 1.
-% matrix "b" = [ 3 0 ;
-% 0 2 ]
+% matrix "b" = [ 3 0 1 ;
+% 0 2 0 ]
m(b, 1, 1) += 3.
m(b, 1, 2) += 0 .
+m(b, 1, 3) += 1 .
m(b, 2, 1) += 0 .
m(b, 2, 2) += 2.
+m(b, 2, 3) += 0 .
+
+% matrix "c" is the product of matricies "a" and "b"
+product(a,b) += &c