18.11.2014 Views

Anais - Engenharia de Redes de Comunicação - UnB

Anais - Engenharia de Redes de Comunicação - UnB

Anais - Engenharia de Redes de Comunicação - UnB

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 3. Syndrome generating function.<br />

3.2.2. Generating words with given weight<br />

As noted, the generator requires ( an algorithm to produce vectors with fixed weight. From<br />

each entry of size ⌊log n<br />

)<br />

2 δn ⌋, this algorithm must output a different vector x ∈ {0, 1}<br />

n<br />

with weight |x| = δn. To build it, we use the lexicographic enumeration function shown<br />

by [Fischer and Stern, 1996].<br />

To explain the working of the lexicographic enumeration, we will use Pascal’s<br />

Triangle. It is formed by the binomial coefficients ( n<br />

k)<br />

where n represents the row and k<br />

the column. The construction follows the Pascal’s rule, which states:<br />

( ) n − 1<br />

+<br />

k − 1<br />

( ) ( n − 1 n<br />

= for 1 ≤ k ≤ n<br />

k k)<br />

Each triangle component t(n, k) = ( n<br />

k)<br />

represents the number of existing words<br />

with size n and weight k. Here t(n, k) equals the sum of two components immediately<br />

above t(n − 1, k) and t(n − 1, k − 1). These components represent, respectively, the<br />

number of words of size n starting with a 0-bit and starting with a 1-bit.<br />

This way, we can generate the output word from an in<strong>de</strong>x i by making an upward<br />

path in Pascal’s Triangle. We start from the component t(n, k) towards the top. When<br />

the in<strong>de</strong>x i is less than or equal to the up-left component t(n − 1, k), we generate a 0-bit<br />

and move to this component. When the in<strong>de</strong>x is higher, we generate a 1-bit and walk to<br />

the up-right component t(n − 1, k − 1), <strong>de</strong>crementing the in<strong>de</strong>x at t(n − 1, k − 1). The<br />

complete algorithm is <strong>de</strong>scribed in pseudoco<strong>de</strong> at the end of this section.<br />

As an example, see Figure 4. We ilustrate a walk to generate a word of size n = 4<br />

and weight k = 2, in<strong>de</strong>x i = 2.<br />

The path begins at the component t(4, 2) = ( 4<br />

2)<br />

= 6. As i = 2 ≤ t(3, 2) = 3, the<br />

algorithm generates a 0-bit and walks to the component t(3, 2). Now, i = 2 > t(2, 2) = 1,<br />

so the algorithm generates a 1 bit, updates the in<strong>de</strong>x i ← i − t(2, 2) and the path goes to<br />

the component t(2, 1). And so it goes until you reach the top of the triangle, forming the<br />

word (0, 1, 0, 1).<br />

129

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!