code: def procrustes(A, H):
      r"""
      Analytically solves the following Procrustes problem:
  
      .. math::
          \phi(L) =\frac{1}{2}\|AT-H\|^2.
  
      (With no further conditions on :math:`H`)
  
      Under the assumption that :math:`A^*H` has full rank, the analytical
      solution :math:`T` is given by:
  
      .. math::
          T = (A^*HH^*A)^{-\frac{1}{2}}A^*H,
  
      see Navarra, Simoncini (2010).
  
      Parameters
      ----------
      A : numpy matrix
          non rotated factors
      H : numpy matrix
          target matrix
      full_rank : bool (default False)
          if set to true full rank is assumed
  
      Returns
      -------
      The matrix :math:`T`.
  
      References
      ----------
      [1] Navarra, Simoncini (2010) - A guide to empirical orthogonal functions
      for climate data analysis
      """
      return np.linalg.inv(A.T.dot(A)).dot(A.T).dot(H)
  
imports: import numpy
  import scipy
label_desc: Use image node_id 2 for calling a global function with example usage: procrustes(A, H) and returns: np