code: def compute_groups_matrix(groups: List):
      """Generate matrix which notes factor membership of groups
  
      Computes a k-by-g matrix which notes factor membership of groups
      where:
          k is the number of variables (factors)
          g is the number of groups
      Also returns a g-length list of unique group_names whose positions
      correspond to the order of groups in the k-by-g matrix
  
      Parameters
      ----------
      groups : List
          Group names corresponding to each variable
  
      Returns
      -------
      tuple
          containing group matrix assigning parameters to
          groups and a list of unique group names
      """
      num_vars = len(groups)
      unique_group_names, number_of_groups = extract_group_names(groups)
  
      indices = dict(
          [(x, i) for (i, x) in enumerate(unique_group_names)]
      )
  
      output = np.zeros((num_vars, number_of_groups), dtype=int)
  
      for parameter_row, group_membership in enumerate(groups):
          group_index = indices[group_membership]
          output[parameter_row, group_index] = 1
  
      return output, unique_group_names
  
file_path: SALib/src/SALib/util/__init__.py
imports: from collections import OrderedDict
  from typing import Dict, Tuple
  import warnings
  import numpy
  import scipy
  from typing import List
  from .util_funcs import avail_approaches, read_param_file, _check_bounds, _check_groups
  from .problem import ProblemSpec
  from .results import ResultDict
label_desc: Use image node_id 6 for calling a global function with example usage: compute_groups_matrix(groups) and returns: output,  unique_group_names