Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t = 1
- n = 2
- b = [1, 2]
- # check to make sure units match up
- if len(b) != n:
- raise ValueError('Array dimensions do not match')
- import numpy as np
- from numpy import *
- import pdb
- # print "working on an array with %d elements %s" % (n, b)
- tot = np.product(b)
- # print "initializing dimension %d x %d " % (tot, n)
- v = ones((tot*n, n))
- a = []
- k = 0
- def f(i, k, a):
- k += 1
- print "---------------"
- print "this is call %d, a is %s" % (k, a)
- if i == n-1:
- print "-------------------------"
- a.insert(0,b[0])
- print "done! now have %s with count %d" % (a, k)
- a = [] # This doesn't clear
- return False
- else:
- print "loading %s from %s with index %d" % (a, b, i)
- print "calling %d with %d children" % (b[i], b[i+1])
- # now find children
- for j in range(1, b[i+1]+1):
- # print "%d %d" % (b[i], j)
- a.append(j)
- f(i+1, k, a)
- f(0, k, a)
- # print v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement