code: def _get_summation_matrix(series: TimeSeries):
      """
      Returns the matrix S for a series, as defined `here <https://otexts.com/fpp3/reconciliation.html>`_.
  
      The dimension of the matrix is `(n, m)`, where `n` is the number of components and `m` the number
      of base components (components that are not the sum of any other components).
      S[i, j] contains 1 if component i is "made up" of base component j, and 0 otherwise.
      The order of the `n` and `m` components in the matrix match the order of the components in the `series`.
  
      The matrix is built using the ``hierarchy`` property of the ``series``. ``hierarchy`` must be a
      dictionary mapping each (non top-level) component to its parent(s) in the aggregation.
      """
  
      raise_if_not(
          series.has_hierarchy,
          "The provided series must have a hierarchy defined for reconciliation to be performed.",
      )
      hierarchy = series.hierarchy
      components_seq = list(series.components)
      leaves_seq = series.bottom_level_components
      m = len(leaves_seq)
      n = len(components_seq)
      S = np.zeros((n, m))
  
      components_indexes = {c: i for i, c in enumerate(components_seq)}
      leaves_indexes = {l: i for i, l in enumerate(leaves_seq)}
  
      def increment(cur_node, leaf_idx):
          """
          Recursive function filling S for a given base component and all its ancestors
          """
          S[components_indexes[cur_node], leaf_idx] = 1.0
          if cur_node in hierarchy:
              for parent in hierarchy[cur_node]:
                  increment(parent, leaf_idx)
  
      for leaf in leaves_seq:
          leaf_idx = leaves_indexes[leaf]
          increment(leaf, leaf_idx)
  
      return S.astype(series.dtype)
  
imports: from typing import Any, Mapping, Optional
  import numpy
  from darts.dataprocessing.transformers import BaseDataTransformer, FittableDataTransformer
  from darts.timeseries import TimeSeries
  from darts.utils.utils import raise_if_not
label_desc: Use image node_id 1 for calling a global function with example usage: _get_summation_matrix(series) and returns: S