Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. t = 1
  2. n = 2
  3. b = [1, 2]
  4.  
  5. # check to make sure units match up
  6. if len(b) != n:
  7. raise ValueError('Array dimensions do not match')
  8.  
  9. import numpy as np
  10. from numpy import *
  11. import pdb
  12.  
  13. # print "working on an array with %d elements %s" % (n, b)
  14. tot = np.product(b)
  15. # print "initializing dimension %d x %d " % (tot, n)
  16. v = ones((tot*n, n))
  17.  
  18. a = []
  19. k = 0
  20.  
  21. def f(i, k, a):
  22. k += 1
  23. print "---------------"
  24. print "this is call %d, a is %s" % (k, a)
  25. if i == n-1:
  26. print "-------------------------"
  27. a.insert(0,b[0])
  28. print "done! now have %s with count %d" % (a, k)
  29. a = [] # This doesn't clear
  30. return False
  31. else:
  32. print "loading %s from %s with index %d" % (a, b, i)
  33. print "calling %d with %d children" % (b[i], b[i+1])
  34. # now find children
  35. for j in range(1, b[i+1]+1):
  36. # print "%d %d" % (b[i], j)
  37. a.append(j)
  38. f(i+1, k, a)
  39.  
  40. f(0, k, a)
  41. # print v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement