code: def create_matrix_of_literals(
      numeric_triples: np.array,
      entity_to_id: EntityMapping,
  ) -> Tuple[np.ndarray, Dict[str, int]]:
      """Create matrix of literals where each row corresponds to an entity and each column to a literal."""
      data_relations = np.unique(
          np.ndarray.flatten(numeric_triples[:, 1:2])
      )
      data_rel_to_id: Dict[str, int] = {
          value: key for key, value in enumerate(data_relations)
      }
      # Prepare literal matrix, set every literal to zero, and afterwards fill in the corresponding value if available
      num_literals = np.zeros(
          [len(entity_to_id), len(data_rel_to_id)], dtype=np.float32
      )
  
      # TODO vectorize code
      for h, r, lit in numeric_triples:
          try:
              # row define entity, and column the literal. Set the corresponding literal for the entity
              num_literals[entity_to_id[h], data_rel_to_id[r]] = lit
          except KeyError:
              logger.info(
                  "Either entity or relation to literal doesn't exist."
              )
              continue
  
      return num_literals, data_rel_to_id
  
imports: import logging
  import pathlib
  from typing import Any, ClassVar, Dict, Iterable, Mapping, MutableMapping, Optional, TextIO, Tuple, Union
  import numpy
  import pandas
  import torch
  from .triples_factory import TriplesFactory
  from .utils import load_triples
  from ..typing import EntityMapping, LabeledTriples, MappedTriples
label_desc: Use image node_id 1 for calling a global function with example usage: create_matrix_of_literals(numeric_triples, entity_to_id) and returns: num_literals,  data_rel_to_id