code: def _opt_soft(eigvectors, rot_matrix, n_clusters):
      eigvectors = eigvectors[:, :n_clusters]
      rot_crop_matrix = rot_matrix[1:][:, 1:]
      (x, y) = rot_crop_matrix.shape
      rot_crop_vec = np.reshape(rot_crop_matrix, x * y)
      def susanna_func(rot_crop_vec, eigvectors):
          rot_crop_matrix = np.reshape(rot_crop_vec, (x, y))
          rot_matrix = _fill_matrix(rot_crop_matrix, eigvectors)
          result = 0
          for i in range(0, n_clusters):
              for j in range(0, n_clusters):
                  result += np.power(rot_matrix[j, i], 2) / rot_matrix[0, i]
          return -result
      from scipy.optimize import fmin
      rot_crop_vec_opt = fmin(susanna_func, rot_crop_vec, args=(eigvectors,), disp=False)
      rot_crop_matrix = np.reshape(rot_crop_vec_opt, (x, y))
      rot_matrix = _fill_matrix(rot_crop_matrix, eigvectors)
      return rot_matrix