From 9c2bb94603f400ff0e3179de0639b3fc53eca0f2 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 29 Mar 2011 20:42:04 -0400 Subject: [PATCH] add more debug, SLE solver not working? --- Sketch.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sketch.py b/Sketch.py index 8786132..8918dc7 100644 --- a/Sketch.py +++ b/Sketch.py @@ -32,13 +32,18 @@ class Sketch(object): dim = max(len(equations), len(shape_vars)) C = zeros((dim, dim)) d = zeros(dim) + print 'matrix size (%d, %d)' % (dim, dim) for i in range(len(equations)): e = equations[i] coeffs = e[0] for c in coeffs: var_index = shape_vars[c[1]] C[i][var_index] = c[0] + if c[0] != 0: + print c[1][0].name, c[1][1], 'is at', i, var_index, \ + 'with coefficient', c[0] d[i] = e[1] + print 'equ', i, 'expected value:', e[1] # for row in range(len(equations)): # print '[', # for col in range(len(shape_vars)): @@ -48,9 +53,10 @@ class Sketch(object): s = SLE(C, d) r = s.solve() solved_vars = r.xf + print 'IGNORED THINGY: ', r.ff print "SOLVED: ", solved_vars for i in range(len(solved_vars)): varid_to_shape_var[i][0].setVar(varid_to_shape_var[i][1], solved_vars[i]) -# for s in self.shapes: -# print 'shape:', repr(s.vars) + for s in self.shapes: + print 'shape:', repr(s.vars)