Compute the (inverse) Fast Walsh-Hadamard transform of a signal.
ifwht(x, n = NROW(x), ordering = c("sequency","hadamard","dyadic"))fwht(x, n = NROW(x), ordering = c("sequency","hadamard","dyadic"))
Arguments
x: input data, specified as a numeric vector or matrix. In case of a vector it represents a single signal; in case of a matrix each column is a signal. fwht operates only on signals with length equal to a power of 2. If the length of x is less than a power of 2, its length is padded with zeros to the next greater power of two before processing.
n: transform length, specified as a positive integer scalar. Default: NROW(x).
ordering: order of the Walsh-Hadamard transform coefficients, one of:
"sequency": (Default) Coefficients in order of increasing sequency value, where each row has an additional zero crossing.
"hadamard": Coefficients in normal Hadamard order
"dyadic": Coefficients in Gray code order, where a single bit change occurs from one coefficient to the next
Returns
(Inverse) Fast Walsh Hadamard transform, returned as a vector or matrix.
Examples
x <- c(19,-1,11,-9,-7,13,-15,5)X <- fwht(x)all.equal(x, ifwht(X))