code: def _retract(X, v):
      """
      Retraction taking tangent vector v at base point X back to manifold of
      orthogonal matrices.
      """
  
      Q, R = np.linalg.qr(X + v)
      for i, ri in enumerate(np.diag(R)):
          if ri < 0:
              Q[:, i] = -1 * Q[:, i]
      return Q
  
file_path: pyRiemann/pyriemann/transfer/_rotate.py
imports: import warnings
  import numpy
  from ..utils.distance import distance
  from ..utils.utils import check_weights
label_desc: Use image node_id 2 for calling a global function with example usage: _retract(X, v) and returns: Q