code: def Decoding_logBP(H, Bits, Nodes, Lq, Lc, max_iter=1):
      """Decoding function using Belief Propagation algorithm (logarithmic version)
      IMPORTANT: if H is large (n>1000), H should be scipy.sparse.csr_matrix object to speed up calculations
      (highly recommanded. )
      -----------------------------------
      Parameters:
  
      H: 2D-array (OR scipy.sparse.csr_matrix object) Parity check matrix, shape = (m,n)
      y: n-vector recieved after transmission in the channel. (In general, returned
      by Coding Function)
      Signal-Noise Ratio: SNR = 10log(1/variance) in decibels of the AWGN used in coding.
  
      max_iter: (default = 1) max iterations of the main loop. Increase if decoding is not error-free.
      """
  
      m, n = H.shape
  
      if not len(Lc) == n:
          raise ValueError(
              "La taille de y doit correspondre au nombre de colonnes de H"
          )
  
      if m >= n:
          raise ValueError(
              "H doit avoir plus de colonnes que de lignes"
          )
  
      # var = 10**(-SNR/10)
  
      # ### ETAPE 0: initialisation
  
      # Lc = 2*y/var
  
      # Lq=np.zeros(shape=(m,n))
  
      Lr = np.zeros(shape=(m, n))
  
      count = 0
  
      # prod=np.prod
      # tanh = np.tanh
      # log = np.log
  
      Lq += Lc
  
      # Bits,Nodes = BitsAndNodes(H)
      while True:
          count += 1  # Compteur qui empêche la boucle d'être infinie ..
  
          #### ETAPE 1 : Horizontale
          for i in range(m):
              Ni = Bits[i]
              for j in Ni:
                  Nij = list(Ni)
                  Nij.remove(j)
                  # X = sum (phi0(e) for e in Lq[i,Nij])
                  # s = prod(np.sign(Lq[i,Nij]))
                  # Lr[i,j] = s * phi0(X)
                  Lr[i, j] = G(Lq[i][Nij])
          Lr = np.clip(Lr, -100, 100)
  
          #### ETAPE 2 : Verticale
          for j in range(n):
              Mj = Nodes[j]
  
              for i in Mj:
                  Mji = list(Mj)
                  Mji.remove(i)
  
                  Lq[i, j] = Lc[j] + sum(Lr[Mji][:, j])
  
          #### LLR a posteriori:
          # L_posteriori = np.zeros(n)
          # for j in range(n):
          #     Mj = Nodes[j]
  
          #     L_posteriori[j] = Lc[j] + sum(Lr[Mj,j])
          extrinsic = np.empty(n)
          for j in range(n):
              Mj = Nodes[j]
  
              extrinsic[j] = sum(Lr[Mj][:, j])
  
          L_posteriori = extrinsic + Lc
          # x = np.array(L_posteriori <= 0).astype(int)
          x = np.array(extrinsic <= 0).astype(int)
          product = InCode(H, x)
          # print(count, product)
  
          if product or count >= max_iter:
              break
      # print(count)
      return (
          np.array(L_posteriori <= 0).astype(int),
          Lq - Lc,
          extrinsic,
          product,
      )
  
imports: import numpy
  from math import log, tanh
label_desc: Use image node_id 5 for calling a global function with example usage: Decoding_logBP(H, Bits, Nodes, Lq, Lc, max_iter) and returns: np,  unknown,  extrinsic,  product