code: def ind2sub(siz, idx):
      '''
      Translates full-format index into tt.vector one's.
      ----------
      Parameters:
          siz - tt.vector modes
          idx - full-vector index
      Note: not vectorized.
      '''
      n = len(siz)
      subs = _np.empty((n))
      k = _np.cumprod(siz[:-1])
      k = _np.concatenate((_np.ones(1), k))
      for i in xrange(n - 1, -1, -1):
          subs[i] = _np.floor(idx / k[i])
          idx = idx % k[i]
      return subs.astype(_np.int32f ind2sub(siz, idx):
      '''
      Translates full-format index into tt.vector one's.
      ----------
      Parameters:
          siz - tt.vector modes
          idx - full-vector index
      Note: not vectorized.
      '''
      n = len(siz)
      subs = _np.empty((n))
      k = _np.cumprod(siz[:-1])
      k = _np.concatenate((_np.ones(1), k))
      for i in xrange(n - 1, -1, -1):
          subs[i] = _np.floor(idx / k[i])
          idx = idx % k[i]
      return subs.astype(_np.int32)
docs: Translates full-format index into tt.vector one's.
      ----------
      Parameters:
          siz - tt.vector modes
          idx - full-vector index
      Note: not vectorized.