Engee documentation

bitrevorder

Rearranges the input data bits in reverse order.

Library

EngeeDSP

Syntax

Function call

  • y, i = bitrevorder(x) — returns the input data bits x in reverse order and their indexes i So that y = x(i).

Arguments

Input arguments

# x — input data

+ vector | the matrix

Details

Input data specified as a vector or matrix. Length or number of lines x must be an integer power of a number 2. If x — the matrix, then the permutation of the bits occurs in the first dimension x, the size of which is larger 1.

Типы данных

Float32, Float64

Support for complex numbers

Yes

Output arguments

# y — input data bits in reverse order

+ vector | the matrix

Details

The input data bits are in reverse order, returned as a vector or matrix. Argument y has the same size as x.

# i — indexes of the rearranged bits

+ vector | the matrix

Details

The indexes of the rearranged bits returned as a vector or matrix. Indexing starts with 1.

Examples

Reverse the order of the bits in the vector

Details

Let’s set the input vector. We get a vector containing the bits in reverse order and their indexes.

import EngeeDSP.Functions: bitrevorder

x = (0:7)'

y, i = bitrevorder(x)

println("x\ty\tj")
println("__________________")
for j in 1:length(x)
    println(x[j],"\t",y[j],"\t", i[j])
end
x	y	j
__________________
0	0	1
1	4	5
2	2	3
3	6	7
4	1	2
5	5	6
6	3	4
7	7	8

Additional Info

The bits are in reverse order

Details

Function bitrevorder It is useful for pre-tuning the filter coefficients, which avoids the need to use the reverse bit order in calculations. fft or ifft.

The reverse bit order can improve the execution efficiency of external applications or Engee models. Functions fft and ifft linear input and output data are processed.

Using bitrevorder equivalent to using digitrevorder in the base number system 2.

This table shows the numbers from 0 before 7, their corresponding bits, the bits in reverse order, and the corresponding indexes.

Linear index Bits The bits are in reverse order The bit indexes are in reverse order

0

000

000

0

1

001

100

4

2

010

010

2

3

011

110

6

4

100

001

1

5

101

101

5

6

110

011

3

7

111

111

7