def _f3_matrix_multiplication(matrix, backend):
  """
  Computes X @ X^H @ X and X^H @ X.
  """
  matrix_dag_matrix = backend.matmul(
      matrix.conj(), matrix, transpose_A=True, transpose_B=False)
  matrix3 = backend.matmul(
      matrix, matrix_dag_matrix, transpose_A=False, transpose_B=False)
  return matrix3, matrix_dag_matrix