GenW(n=8, filter.number=10, family="DaubLeAsymm", bc="periodic")
n
n
times n
. n
should be a power of two.
periodic
or
symmetric
depending on whether you want the returned
matrix to assume periodic or symmetric end-reflection boundary
conditions.
n
that contains the inverse discrete
wavelet transform.
The matrix returned by this function represents the inverse DWT. Since
the matrix (and transform) is orthogonal one can obtain the matrix
representation of the forward transform
simply by transposing the matrix using the t
function in
S-Plus.
The returned matrix is organised as follows. The first column always
corresponds to the linear combination corresponding to the scaling function
coefficient (so the column is constant. The next n/2
columns correspond to the finest scale wavelet coefficients;
the next n/4
columns to the next finest scale and so on
until the last column which corresponds to the coarsest scale
wavelet coefficients.
The matrix is computed by performing successive fast DWTs on unit vectors.
# # Generate the wavelet transform matrix corresponding to the Haar wavelet # transform of order 8 # haarmat <- GenW(8, filter.number=1, family="DaubExPhase") # # Let's look at this matrix # haarmat # [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] #[1,] 0.3535534 0.7071068 0.0000000 0.0000000 0.0000000 0.5 0.0 0.3535534 #[2,] 0.3535534 -0.7071068 0.0000000 0.0000000 0.0000000 0.5 0.0 0.3535534 #[3,] 0.3535534 0.0000000 0.7071068 0.0000000 0.0000000 -0.5 0.0 0.3535534 #[4,] 0.3535534 0.0000000 -0.7071068 0.0000000 0.0000000 -0.5 0.0 0.3535534 #[5,] 0.3535534 0.0000000 0.0000000 0.7071068 0.0000000 0.0 0.5 -0.3535534 #[6,] 0.3535534 0.0000000 0.0000000 -0.7071068 0.0000000 0.0 0.5 -0.3535534 #[7,] 0.3535534 0.0000000 0.0000000 0.0000000 0.7071068 0.0 -0.5 -0.3535534 #[8,] 0.3535534 0.0000000 0.0000000 0.0000000 -0.7071068 0.0 -0.5 -0.3535534 # # As noted above the first column is the l.c. corresponding to the scaling # function coefficient and then the l.c.s corresponding to the wavelet # coefficients from the finest to the coarsest. # # The above matrix represented the inverse DWT. Let's compute the forward # transform matrix representation: # t(haarmat) # [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] #[1,] 0.3535534 0.3535534 0.3535534 0.3535534 0.3535534 0.3535534 0.3535534 0.3535534 #[2,] 0.7071068 -0.7071068 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #[3,] 0.0000000 0.0000000 0.7071068 -0.7071068 0.0000000 0.0000000 0.0000000 0.0000000 #[4,] 0.0000000 0.0000000 0.0000000 0.0000000 0.7071068 -0.7071068 0.0000000 0.0000000 #[5,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.7071068 -0.7071068 #[6,] 0.5000000 0.5000000 -0.5000000 -0.5000000 0.0000000 0.0000000 0.0000000 0.0000000 #[7,] 0.0000000 0.0000000 0.0000000 0.0000000 0.5000000 0.5000000 -0.5000000 -0.5000000 #[8,] 0.3535534 0.3535534 0.3535534 0.3535534 -0.3535534 -0.3535534 -0.3535534 -0.3535534