code: def _objective_function(X, W, R, S, gamma):
          
          subjs = len(X)
          func = .0
          for i in range(subjs):
              func += 0.5 * np.sum((X[i] - W[i].dot(R) - S[i])**2) \
                      + gamma * np.sum(np.abs(S[i]))
          return func
docs: Evaluate the objective function.
  
          .. math:: \\sum_{i=1}^{N} 1/2 \\| X_i - W_i R - S_i \\|_F^2
          .. math:: + /\\gamma * \\|S_i\\|_1
  
          Parameters
          ----------
  
          X : list of array, element i has shape=[voxels_i, timepoints]
              Each element in the list contains the fMRI data for alignment of
              one subject.
  
          W : list of array, element i has shape=[voxels_i, features]
              The orthogonal transforms (mappings) :math:`W_i` for each subject.
  
          R : array, shape=[features, timepoints]
              The shared response.
  
          S : list of array, element i has shape=[voxels_i, timepoints]
              The individual component :math:`S_i` for each subject.
  
          gamma : float, default: 1.0
              Regularization parameter for the sparseness of the individual
              components.
  
          Returns
          -------
  
          func : float
              The RSRM objective function evaluated on the parameters to this
              function.