diff -r 000000000000 -r 0efde00f9229 python/move.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/move.py Fri May 27 14:24:59 2011 +0530 @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import pylab as pl + +def move(b, nonred, maxi): + """ """ + br, bc = pl.atleast_2d(b).shape + b = pl.hstack((b, pl.zeros((br, len(nonred)-bc)))) + maxi = max(max(nonred)+1, maxi) + result = pl.zeros((br, maxi)) + nonred = pl.array(nonred) + result[:,nonred.T]=b + return result + +if __name__== "__main__": + + s = """b = pl.array([[1, 2], + [9, 10]])""" + t = """nonred = pl.array([7, 2])""" + u = """maxi = 10""" + print s, t, u + exec(s) + exec(t) + exec(u) + + print """move(b, nonred, maxi)""" + print move(b, nonred, maxi)