Stationary Wavelet Transform
WaveletsExt.SWT.isdwt
WaveletsExt.SWT.isdwt!
WaveletsExt.SWT.isdwt_step
WaveletsExt.SWT.isdwt_step!
WaveletsExt.SWT.isdwtall
WaveletsExt.SWT.iswpd
WaveletsExt.SWT.iswpd!
WaveletsExt.SWT.iswpdall
WaveletsExt.SWT.iswpt
WaveletsExt.SWT.iswpt!
WaveletsExt.SWT.iswptall
WaveletsExt.SWT.sdwt
WaveletsExt.SWT.sdwt!
WaveletsExt.SWT.sdwt_step
WaveletsExt.SWT.sdwt_step!
WaveletsExt.SWT.sdwtall
WaveletsExt.SWT.swpd
WaveletsExt.SWT.swpd!
WaveletsExt.SWT.swpdall
WaveletsExt.SWT.swpt
WaveletsExt.SWT.swpt!
WaveletsExt.SWT.swptall
Transforms on 1 Signal
Public API
WaveletsExt.SWT.sdwt
— Functionsdwt(x, wt[, L])
Computes the stationary discrete wavelet transform (SDWT) for L
levels.
Arguments
x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:maxtransformlevels(x)
) Number of levels of decomposition.
Returns
::Matrix{T}
or ::Array{T,3}
: Output from SDWT on x
.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SDWT
xw = sdwt(x, wt)
WaveletsExt.SWT.sdwt!
— Functionsdwt!(xw, x, wt[, L])
Same as sdwt
but without array allocation.
Arguments
xw::AbstractArray{T,2}
orxw::AbstractArray{T,3} where T<:Number
: An allocated array of dimension(n,L+1)
to write the outputs ofx
onto.x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:maxtransformlevels(x)
) Number of levels of decomposition.
Returns
xw::Array{T,2}
or xw::Array{T,3}
: Output from SDWT on x
.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine, 7)
wt = wavelet(WT.haar)
# SDWT
xw = Matrix{Float64}(undef, (128,5))
sdwt!(xw, x, wt, 4)
See also: sdwt
WaveletsExt.SWT.isdwt
— Functionisdwt(xw, wt[, sm])
Computes the inverse stationary discrete wavelet transform (iSDWT) on xw
.
Arguments
xw::AbstractArray{T,2}
orxw::AbstractArray{T,3} where T<:Number
: SDWT-transformed array.wt::OrthoFilter
: Orthogonal wavelet filter.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
::Vector{T}
or ::Matrix{T}
: Inverse transformed signal.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SDWT
xw = sdwt(x, wt)
# Shift-based iSDWT
x̂ = isdwt(xw, wt, 5)
# Average-based iSDWT
x̃ = isdwt(xw, wt)
See also: isdwt_step
, iswpt
, sdwt
WaveletsExt.SWT.isdwt!
— Functionisdwt!(x, xw, wt[, sm])
Same as isdwt
but with no array allocation.
Arguments
x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Allocation for reconstructed signal.xw::AbstractArray{T,2}
orxw::AbstractArray{T,3} where T<:Number
: SDWT-transformed array.wt::OrthoFilter
: Orthogonal wavelet filter.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
x::Vector{T}
or x::Matrix{T}
: Inverse transformed signal.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SDWT
xw = sdwt(x, wt)
# Shift-based iSDWT
x̂ = similar(x)
isdwt!(x̂, xw, wt, 5)
# Average-based iSDWT
isdwt(x̂, xw, wt)
See also: isdwt
WaveletsExt.SWT.swpt
— Functionswpt(x, wt[, L])
Computes L
levels of stationary wavelet packet transform (SWPT) on x
.
Arguments
x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:maxtransformlevels(x)
) Number of levels of decomposition.
Returns
::Matrix{T}
or ::Array{T,3}
: Output from SWPT on x
.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SWPT
xw = swpt(x, wt)
WaveletsExt.SWT.swpt!
— Functionswpt!(xw, x, wt[, L])
Same as swpt
but without array allocation.
Arguments
xw::AbstractArray{T,2}
orxw::AbstractArray{T,3} where T<:Number
: Allocation for transformed signal.x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:maxtransformlevels(x)
) Number of levels of decomposition.
Returns
xw::Matrix{T}
or xw::Array{T,3}
: Output from SWPT on x
.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SWPT
xw = Array{Float64,2}(undef, (128,128))
swpt!(xw, x, wt)
See also: swpt
WaveletsExt.SWT.iswpt
— Functioniswpt(xw, wt[, sm])
Computes the inverse stationary wavelet packet transform (iSWPT) on xw
.
Arguments
xw::AbstractArray{T,2}
orxw::AbstractArray{T,3} where T<:Number
: SWPT-transformed array.wt::OrthoFilter
: Orthogonal wavelet filter.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
::Vector{T}
or ::Matrix{T}
: Inverse transformed signal.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SWPT
xw = swpt(x, wt)
# Shift-based iSWPT
x̂ = iswpt(xw, wt, 5)
# Average-based iSWPT
x̃ = iswpt(xw, wt)
See also: isdwt_step
, isdwt
, swpt
WaveletsExt.SWT.iswpt!
— Functioniswpt!(x, xw, wt[, sm])
Same as iswpt
but with no array allocation.
Arguments
x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Allocation for inverse transform.xw::AbstractArray{T,2}
orxw::AbstractArray{T,3} where T<:Number
: SWPT-transformed array.wt::OrthoFilter
: Orthogonal wavelet filter.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
x::Vector{T}
or x::Matrix{T}
: Inverse transformed signal.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SWPT
xw = swpt(x, wt)
# Shift-based iSWPT
x̂ = similar(x)
iswpt!(x̂, xw, wt, 5)
# Average-based iSWPT
iswpt!(x̂, xw, wt)
See also: iswpt
WaveletsExt.SWT.swpd
— Functionswpd(x, wt[, L])
Computes L
levels of stationary wavelet packet decomposition (SWPD) on x
.
Arguments
x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:maxtransformlevels(x)
) Number of levels of decomposition.
Returns
::Matrix{T}
or ::Array{T,3}
: Output from SWPD on x
.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SWPD
xw = swpd(x, wt)
WaveletsExt.SWT.swpd!
— Functionswpd!(xw, x, wt[, L])
Same as swpd
but without array allocation.
Arguments
xw::AbstractArray{T,2}
orxw::AbstractArray{T,3} where T<:Number
: Allocation for transformed signal.x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:maxtransformlevels(x)
) Number of levels of decomposition.
Returns
xw::Matrix{T}
or xw::Array{T,3}
: Output from SWPD on x
.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SWPD
xw = Matrix{T}(undef, (128, 255))
swpd!(xw, x, wt)
See also: swpd
WaveletsExt.SWT.iswpd
— Functioniswpd(xw, wt, L, sm)
iswpd(xw, wt[, L])
iswpd(xw, wt, tree[, sm])
Computes the inverse stationary wavelet packet transform (iSWPT) on xw
.
This function might not be very useful if one is looking to reconstruct a raw decomposed signal. The purpose of this function would be better utilized in applications such as denoising, where a signal is decomposed (swpd
) and thresholded (denoise
/denoiseall
) before being reconstructed.
Arguments
xw::AbstractArray{T,2}
orx::AbstractArray{T,3} where T<:Number
: SWPD-transformed array.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:maxtransformlevels(x)
orminimum(size(xw)[1:end-1]) |> maxtransformlevels
) Number of levels of decomposition used for reconstruction.tree::BitVector
: Binary/Quad tree for inverse transform to be computed accordingly.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
::Vector{T}
or ::Matrix{T}
: Inverse transformed signal.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SWPD
xw = swpt(x, wt)
# Shift-based iSWPD
x̂ = iswpd(xw, wt, maxtransformlevels(xw,1), 5)
# Average-based iSWPD
x̃ = iswpd(xw, wt)
See also: isdwt_step
, iswpt
, swpd
, iswpd!
WaveletsExt.SWT.iswpd!
— Functioniswpd!(x, xw, wt, L, sm)
iswpd!(x, xw, wt[, L])
iswpd!(x, xw, wt, tree, sm)
iswpd!(x, xw, wt, tree)
Same as iswpd
but with no array allocation.
Arguments
x::AbstractVector{T}
orx::AbstractMatrix{T} where T<:Number
: Allocated array for output.xw::AbstractArray{T,2}
orxw::AbstractArray{T,3} where T<:Number
: SWPD-transformed array.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:maxtransformlevels(x)
orminimum(size(xw)[1:end-1]) |> maxtransformlevels
) Number of levels of decomposition used for reconstruction.tree::BitVector
: Binary/Quad tree for inverse transform to be computed accordingly.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
x::Vector{T}
or x::Matrix{T}
: Inverse transformed signal.
Examples
using Wavelets, WaveletsExt
# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)
# SWPD
xw = swpd(x, wt)
# ISWPD
x̂ = similar(x)
iswpd!(x̂, xw, wt, 4, 5)
iswpd!(x̂, xw, wt, maketree(x), 5)
iswpd!(x̂, xw, wt, 4)
iswpd!(x̂, xw, wt, maketree(x))
See also: iswpd
Transforms on Multiple Signals
Public API
WaveletsExt.SWT.sdwtall
— Functionsdwtall(x, wt[, L])
Computes the stationary discrete wavelet transform (SDWT) on each slice of signal.
Arguments
x::AbstractArray{T} where T<:Number
: InputN-1
-D signals, where each signal is sliced at dimensionN
.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:Wavelets.maxtransformlevels(xᵢ)
) Number of levels of wavelet transforms.
Returns
::Array{T}
: Slices of transformed signals.
Examples
using Wavelets, WaveletsExt
# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)
# SDWT on all signals in x
xw = sdwtall(x, wt)
See also: sdwt
WaveletsExt.SWT.isdwtall
— Functionisdwtall(xw[, wt])
isdwtall(xw, wt, sm)
Computes the inverse stationary discrete wavelet transform (ISDWT) on each slice of signal.
Arguments
xw::AbstractArray{T} where T<:Number
: SDWT-transformed signal.wt::OrthoFilter
: (Default:nothing
) Orthogonal wavelet filter.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
::Array{T}
: Slices of reconstructed signals.
Examples
using Wavelets, WaveletsExt
# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)
# SDWT on all signals in x
xw = sdwtall(x, wt)
# ISDWT on all signals in xw
x̂ = isdwtall(xw)
See also: isdwt
WaveletsExt.SWT.swptall
— Functionswptall(x, wt[, L])
Computes the stationary wavelet packet transform (SWPT) on each slice of signal.
Arguments
x::AbstractArray{T} where T<:Number
: InputN-1
-D signals, where each signal is sliced at dimensionN
.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:Wavelets.maxtransformlevels(xᵢ)
) Number of levels of wavelet transforms.
Returns
::Array{T}
: Slices of transformed signals.
Examples
using Wavelets, WaveletsExt
# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)
# SWPT on all signals in x
xw = swptall(x, wt)
See also: swpt
WaveletsExt.SWT.iswptall
— Functioniswptall(xw[, wt])
iswptall(xw, wt, sm)
Computes the inverse stationary wavelet packet transform (ISWPT) on each slice of signal.
Arguments
xw::AbstractArray{T} where T<:Number
: SWPT-transformed signal.wt::Union{OrthoFilter, Nothing}
: (Default:nothing
) Orthogonal wavelet filter.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
::Array{T}
: Slices of reconstructed signals.
Examples
using Wavelets, WaveletsExt
# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)
# SWPT on all signals in x
xw = swptall(x, wt)
# ISWPT on all signals in xw
x̂ = iswptall(xw)
See also: iswpt
WaveletsExt.SWT.swpdall
— Functionswpdall(x, wt[, L])
Computes the stationary wavelet packet decomposition (SWPD) on each slice of signal.
Arguments
x::AbstractArray{T} where T<:Number
: InputN-1
-D signals, where each signal is sliced at dimensionN
.wt::OrthoFilter
: Orthogonal wavelet filter.L::Integer
: (Default:Wavelets.maxtransformlevels(xᵢ)
) Number of levels of wavelet transforms.
Returns
::Array{T}
: Slices of transformed signals.
Examples
using Wavelets, WaveletsExt
# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)
# SWPD on all signals in x
xw = swpdall(x, wt)
See also: swpd
WaveletsExt.SWT.iswpdall
— Functioniswpdall(xw, wt, L, sm)
iswpdall(xw, wt[, L])
iswpdall(xw, wt, tree, sm)
iswpdall(xw, wt, tree)
Computes the inverse autocorrelation wavelet packet decomposition (ISWPD) on each slice of signal.
Arguments
xw::AbstractArray{T} where T<:Number
: SWPD-transformed signal.wt::Union{OrthoFilter, Nothing}
: (Default:nothing
) Orthogonal wavelet filter.L::Integer
: (Default:minimum(size(xw)[1:end-2]) |> maxtransformlevels
) Number of levels of wavelet transforms.tree::BitVector
: Binary tree for inverse transform to be computed accordingly.sm::Integer
: Ifsm
is included as an argument, thesm
-shifted inverse transform will be computed. This results in significantly faster computation, but fails to fully utilize the strength of redundant wavelet transforms.
Returns
::Array{T}
: Slices of reconstructed signals.
Examples
using Wavelets, WaveletsExt
# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)
# SWPD on all signals in x
xw = swpdall(x, wt)
# ISWPD on all signals in xw
x̂ = iswpdall(xw)
x̂ = iswpdalll(xw, maketree(x))
x̂ = iswpdall(xw, 5)
See also: iswpd
Single Step Transforms
Private API
WaveletsExt.SWT.sdwt_step
— Functionsdwt_step(v, d, h, g)
Perform one level of the stationary discrete wavelet transform (SDWT) on the vector v
, which is the d
-th level scaling coefficients (Note the 0th level scaling coefficients is the raw signal). The vectors h
and g
are the detail and scaling filters.
Arguments
v::AbstractArray{T} where T<:Number
: Array of coefficients from a node at leveld
.d::Integer
: Depth level ofv
.h::Vector{S} where S<:Number
: High pass filter.g::Vector{S} where S<:Number
: Low pass filter.
Returns
w₁::AbstractVector{T} where T<:Number
orw₁::AbstractMatrix{T} where T<:Number
: Output from low pass filter (1D case); or output from low + low pass filter (2D case).w₂::AbstractVector{T} where T<:Number
orw₂::AbstractMatrix{T} where T<:Number
: Output from high pass filter (1D case); or output from low + high pass filter (2D case).w₃::AbstractVector{T} where T<:Number
orw₃::AbstractMatrix{T} where T<:Number
: Output from high + low pass filter (2D case).w₄::AbstractVector{T} where T<:Number
orw₄::AbstractMatrix{T} where T<:Number
: Output from high + high pass filter (2D case).
Examples
using Wavelets, WaveletsExt
# Setup
v = randn(8)
wt = wavelet(WT.haar)
g, h = WT.makereverseqmfpair(wt, true)
# One step of SDWT
SWT.sdwt_step(v, 0, h, g)
See also: sdwt_step!
WaveletsExt.SWT.sdwt_step!
— Functionsdwt_step!(w₁, w₂, v, d, h, g)
Same as sdwt_step
but without array allocation.
Arguments
w₁::AbstractVector{T} where T<:Number
orw₁::AbstractMatrix{T} where T<:Number
: Vector allocation for output from low pass filter (1D case); or matrix allocation for output from low + low pass filter (2D case).w₂::AbstractVector{T} where T<:Number
orw₂::AbstractMatrix{T} where T<:Number
: Vector allocation for output from high pass filter (1D case); or matrix allocation for output from low + high pass filter (2D case).w₃::AbstractVector{T} where T<:Number
orw₃::AbstractMatrix{T} where T<:Number
: Matrix allocation for output from high + low pass filter (2D case).w₄::AbstractVector{T} where T<:Number
orw₄::AbstractMatrix{T} where T<:Number
: Matrix allocation for output from high + high pass filter (2D case).v::AbstractArray{T} where T<:Number
: Array of coefficients from a node at leveld
.d::Integer
: Depth level ofv
.h::Vector{S} where S<:Number
: High pass filter.g::Vector{S} where S<:Number
: Low pass filter.
Returns
w₁::AbstractVector{T} where T<:Number
orw₁::AbstractMatrix{T} where T<:Number
: Output from low pass filter (1D case); or output from low + low pass filter (2D case).w₂::AbstractVector{T} where T<:Number
orw₂::AbstractMatrix{T} where T<:Number
: Output from high pass filter (1D case); or output from low + high pass filter (2D case).w₃::AbstractVector{T} where T<:Number
orw₃::AbstractMatrix{T} where T<:Number
: Output from high + low pass filter (2D case).w₄::AbstractVector{T} where T<:Number
orw₄::AbstractMatrix{T} where T<:Number
: Output from high + high pass filter (2D case).
Examples
using Wavelets, WaveletsExt
# Setup
v = randn(8)
wt = wavelet(WT.haar)
g, h = WT.makereverseqmfpair(wt, true)
w₁ = zeros(8)
w₂ = zeros(8)
# One step of SDWT
SWT.sdwt_step!(w₁, w₂, v, 0, h, g)
See also: sdwt_step
WaveletsExt.SWT.isdwt_step
— Functionisdwt_step(w₁, w₂, d, h, g)
isdwt_step(w₁, w₂, d, sv, sw, h, g)
Perform one level of the inverse stationary discrete wavelet transform (ISDWT) on the vectors w₁
and w₂
, which are the d+1
-th level scaling coefficients (Note the 0th level scaling coefficients is the raw signal). The vectors h
and g
are the detail and scaling filters.
One can decide to choose the average-based inverse transform or the shift-based inverse transform. For shift based, one needs to specify the shifts of the parent and children nodes; for the average based, the output is the average of all possible shift-based inverse transform outputs.
Arguments
w₁::AbstractVector{T} where T<:Number
orw₁::AbstractMatrix{T} where T<:Number
: Coefficients of left child node (1D case); or coefficients from top left child node (2D case).w₂::AbstractVector{T} where T<:Number
orw₂::AbstractMatrix{T} where T<:Number
: Coefficients of right child node (1D case); or coefficients from top right child node (2D case).w₃::AbstractVector{T} where T<:Number
orw₃::AbstractMatrix{T} where T<:Number
: Coefficients from bottom left child node (2D case).w₄::AbstractVector{T} where T<:Number
orw₄::AbstractMatrix{T} where T<:Number
: Coefficients from bottom right child node (2D case).d::Integer
: Depth level of parent node ofw₁
andw₂
.sv::Integer
: Shift of parent nodev
.sw::Integer
: Shift of children nodesw₁
andw₂
.h::Vector{S} where S<:Number
: High pass filter.g::Vector{S} where S<:Number
: Low pass filter.
Returns
v::Vector{T}
: Reconstructed coefficients.
Examples
using Wavelets, WaveletsExt
# Setup
v = randn(8)
wt = wavelet(WT.haar)
g, h = WT.makereverseqmfpair(wt, true)
# One step of SDWT
w₁, w₂ = SWT.sdwt_step(v, 0, h, g)
# One step of ISDWT
v̂ = SWT.isdwt_step(w₁, w₂, 0, h, g) # Average based
ṽ = SWT.isdwt_step(w₁, w₂, 0, 0, 1, h, g) # Shift based
See also: isdwt_step!
WaveletsExt.SWT.isdwt_step!
— Functionisdwt_step!(v, w₁, w₂, d, h, g)
isdwt_step!(v, w₁, w₂, d, sv, sw, h, g[; add2out])
Same as isdwt_step
but without array allocation.
Arguments
v::AbstractArray{T} where T<:Number
: Array allocation for reconstructed coefficients.w₁::AbstractVector{T} where T<:Number
orw₁::AbstractMatrix{T} where T<:Number
: Coefficients of left child node (1D case); or coefficients from top left child node (2D case).w₂::AbstractVector{T} where T<:Number
orw₂::AbstractMatrix{T} where T<:Number
: Coefficients of right child node (1D case); or coefficients from top right child node (2D case).w₃::AbstractVector{T} where T<:Number
orw₃::AbstractMatrix{T} where T<:Number
: Coefficients from bottom left child node (2D case).w₄::AbstractVector{T} where T<:Number
orw₄::AbstractMatrix{T} where T<:Number
: Coefficients from bottom right child node (2D case).d::Integer
: Depth level of parent node ofw₁
andw₂
.sv::Integer
: Shift of parent nodev
.sw::Integer
: Shift of children nodesw₁
andw₂
.h::Vector{S} where S<:Number
: High pass filter.g::Vector{S} where S<:Number
: Low pass filter.
Keyword Arguments
add2out::Bool
: (Default:false
) Whether to add computed result directly to outputv
or rewrite computed result tov
.
Returns
v::Array{T}
: Reconstructed coefficients.
Examples
using Wavelets, WaveletsExt
# Setup
v = randn(8)
v̂ = similar(v)
ṽ = similar(v)
wt = wavelet(WT.haar)
g, h = WT.makereverseqmfpair(wt, true)
# One step of SDWT
w₁, w₂ = SWT.sdwt_step(v, 0, h, g)
# One step of ISDWT
SWT.isdwt_step!(v̂, w₁, w₂, 0, h, g) # Average based
SWT.isdwt_step!(ṽ, w₁, w₂, 0, 0, 1, h, g) # Shift based
See also: isdwt_step