equal
deleted
inserted
replaced
|
1 #!/usr/bin/python |
|
2 |
|
3 import pylab as pl |
|
4 |
|
5 def move(b, nonred, maxi): |
|
6 """ """ |
|
7 br, bc = pl.atleast_2d(b).shape |
|
8 b = pl.hstack((b, pl.zeros((br, len(nonred)-bc)))) |
|
9 maxi = max(max(nonred)+1, maxi) |
|
10 result = pl.zeros((br, maxi)) |
|
11 nonred = pl.array(nonred) |
|
12 result[:,nonred.T]=b |
|
13 return result |
|
14 |
|
15 if __name__== "__main__": |
|
16 |
|
17 s = """b = pl.array([[1, 2], |
|
18 [9, 10]])""" |
|
19 t = """nonred = pl.array([7, 2])""" |
|
20 u = """maxi = 10""" |
|
21 print s, t, u |
|
22 exec(s) |
|
23 exec(t) |
|
24 exec(u) |
|
25 |
|
26 print """move(b, nonred, maxi)""" |
|
27 print move(b, nonred, maxi) |