fwht: Fast Walsh-Hadamard Transform

View source: R/fwht.R View source: R/RcppExports.R

ifwhtR Documentation

Fast Walsh-Hadamard Transform

Description

Compute the (inverse) Fast Walsh-Hadamard transform of a signal.

Usage

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

Value

(Inverse) Fast Walsh Hadamard transform, returned as a vector or matrix.

Author(s)

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

References

https://en.wikipedia.org/wiki/Hadamard_transform

https://en.wikipedia.org/wiki/Fast_Walsh-Hadamard_transform

Examples

x <- c(19, -1, 11, -9, -7, 13, -15, 5)
X <- fwht(x)
all.equal(x, ifwht(X))


gjmvanboxtel/gsignal documentation built on Nov. 22, 2023, 8:19 p.m.