code: def right(X, i):
      
      if i > X.d-1:
          return np.ones([1, 1])
      answ = np.ones([1, 1])
      cores = tt.tensor.to_list(X)
      for dim in xrange(X.d-1, i-1, -1):
          answ = np.tensordot(cores[dim], answ, 1)
      answ = reshape(answ, (X.r[i], -1))
      return answ.T
docs: Compute the orthogonal matrix Q_{\geq i} as defined in [1].