bitrevorder {gsignal}R Documentation

Permute input to bit-reversed order

Description

Reorder the elements of the input vector in bit-reversed order.

Usage

bitrevorder(x, index.return = FALSE)

Arguments

x

input data, specified as a vector. The length of x must be an integer power of 2.

index.return

logical indicating if the ordering index vector should be returned as well. Default: FALSE.

Details

This function is equivalent to calling digitrevorder(x, 2), and is useful for prearranging filter coefficients so that bit-reversed ordering does not have to be performed as part of an fft or ifft computation.

Value

The bit-reversed input vector. If index.return = TRUE, then a list containing the bit-reversed input vector (y), and the digit-reversed indices (i).

Author(s)

Mike Miller.
Port to to by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

See Also

digitrevorder, fft, ifft

Examples

x <- 0:15
v <- bitrevorder(x)
dec2bin <- function(x, l)
  substr(paste(as.integer(rev(intToBits(x))), collapse = ""),
  32 - l + 1, 32)
x_bin <- sapply(x, dec2bin, 4)
v_bin <- sapply(v, dec2bin, 4)
data.frame(x, x_bin, v, v_bin)


[Package gsignal version 0.3-5 Index]