Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. def cut(A, b, c, x, nat_ind, art_ind, jb):
  2.     m, n = A.shape
  3.  
  4.     items = set(list(jb)) & set(art_ind)
  5.     if items:
  6.         n_i = items.pop()
  7.         m_i = m - (n - n_i)
  8.         for ind in xrange(m_i+1, m):
  9.             coef = A[ind, n_i]
  10.             A[ind] -= coef*A[m_i]
  11.             b[ind] -= coef*b[m_i]
  12.         A = np.delete(np.delete(A, m_i, 0), n_i, 1)
  13.         b = np.delete(b, [m_i])
  14.         jb = np.delete(jb, np.where(jb == n_i)[0])
  15.         change_items = np.where(jb > n_i)[0]
  16.         jb[change_items] -= 1
  17.         c = c[:-1]
  18.         art_ind = range(len(nat_ind), n-1)
  19.         n -= 1
  20.         m -= 1
  21.         x = np.delete(x, [n_i])
  22.     return A, b, c, x, art_ind, jb, n, m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement