Guest User

Untitled

a guest
Jul 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class Foo:
  2. def __init__(self, x):
  3. self.x = x # an n-d array
  4.  
  5. def pop_q(q, tuple):
  6. q = zeros(tuple)
  7.  
  8. def set_q(q, i, j=None, qq):
  9. if q.ndim == 1:
  10. q[i] = qq
  11. else if q.ndim == 2:
  12. q[i, :] = qq
  13. else if q.ndim == 3:
  14. q[i, j, :] = qq
  15.  
  16. def get_q(q, i, j=None):
  17. if q.ndim == 1:
  18. return q[i]
  19. else if q.ndim == 2:
  20. return q[i, :]
  21. else if q.ndim == 3:
  22. return q[i, j, :]
Add Comment
Please, Sign In to add comment