Skip to main content
. 2021 Mar 12;21(6):2024. doi: 10.3390/s21062024
Algorithm 3fX(VX,D): Encoding a value with subroutines XG and XL
  • Input:

    Value to be encoded VX, vector size D

  • Ensure:

    VXR and D3

  • Output:

    Array of vectors x0,L,x0,G,x1,L,x1,G,,xD3,L,xD3,G

  • 1:

    ND2 {Number of vectors}

  • 2:

    iD2 {Highest power of 2}

  • 3:

    n0 {Current vector}

  • 4:

    whilen<Ndo {0n<N}

  • 5:

    if VX2i then

  • 6:

      xn,LXL(2i,D)

  • 7:

      xn,RXG(2i,D)

  • 8:

      nn+1

  • 9:

      VXVX2i

  • 10:

    else if VX=0 then

  • 11:

      xn,LXL(0,D)

  • 12:

      xn,RXG(0,D)

  • 13:

      nn+1

  • 14:

    else

  • 15:

      ii1

  • 16:

    end if

  • 17:

    end while

  • 18:

    return x0,L,x0,G,x1,L,x1,G,,xN1,L,xN1,G