Performs the inverse lifting transform on a detail and scaling coefficient vector with grid X
and corresponding coefficients coeff
. There is a unique correspondence between the grid values and the function values.
invtnp(X, coeff, lengths, lengthsremove, pointsin, removelist,
neighbrs, schemehist, interhist, nadd = length(X) - 2,
intercept = TRUE, neighbours = 1, closest = FALSE, LocalPred = LinearPred)
data vector of the grid used in the transform.
vector of signal function values after inversion.
vector of interval lengths at the start of the transform. This should be the same as intervals(X)
.
vector of interval lengths corresponding to the points added during the transform.
indices into X
of the scaling coefficients in the wavelet decomposition. These are the indices of the X
values which remain after all points in removelist
have been added. For a straight forward-inverse transform implementation, this should be order(X)
.
a vector of indices into X
of the lifted coefficients during the transform (in the reverse order of how they were added).
data vector of the grid used in the transform.
vector of detail and scaling coefficients in the wavelet decomposition of the signal.
vector of interval lengths to be used in the update step of the transform. This is of length pointsin
.
vector of interval lengths corresponding to the points removed during the forward transform.
indices into X
of the scaling coefficients in the wavelet decomposition.
a vector of indices into X
of the lifted coefficients during the transform (in the order of removal).
a list of indices into X
. Each list entry gives the indices of the neighbours of the removed point used at that particular step of the forward transform.
a vector of character strings indicating the type of regression used at each step of the forward transform. This is NULL apart from when AdaptNeigh
is to be used in the transform.
a boolean vector indicating whether or not an intercept was used in the regression curve at each step of the forward transform. This is NULL apart from when AdaptNeigh
is to be used in the transform.
The number of steps to perform of the inverse transform. This corresponds to (length(X)-nkeep
) in the forward transform.
Boolean value for whether or not an intercept is used in the prediction step of the transform.
the number of neighbours in the computation of the predicted value.
a boolean value showing whether or not the neighbours were symmetrical (FALSE) about the removed point during the transform.
The type of regression to be performed. Possible options are LinearPred
, QuadPred
, CubicPred
, AdaptPred
and AdaptNeigh
.
Matt Nunes (nunesrpackages@gmail.com), Marina Knight
This algorithm reconstructs an estimate of a function/signal from information about detail and scaling coefficients in its wavelet decomposition.
Step One. Extract information about the first point to be added in the transform from the last entries in removelist
, lengthsremove
and neighbrs
. Use this information to discover the correct placement of this point in relation to the indices in pointsin
.
Step Two. Using the information about the prediction scheme used in the "forward" transform, use the corresponding version of LocalPred
to obtain prediction weights and value for the lifted point.
Step Three. "Undo" the update step of the transform, and then the prediction step of the transform. The vector of scaling and detail coefficients, as well as the interval lengths are modified accordingly.
Step Four. Remove the added point from removelist
. Update pointsin
and lengths
to contain the added point.
Step Five. Return to step 1 but in the identification of the next point to add, the second to last entries in (the original) removelist
, lengthsremove
and neighbrs
are used to indentify the point and then place it in pointsin
.
The algorithm continues like this until as many points as desired are added.
AdaptNeigh
, AdaptPred
, CubicPred
, fwtnp
, invtnpmp
, LinearPred
, QuadPred
, UndoPointsUpdate
#
# Generate some one-dimensional data: 500 observations.
x2<-runif(500)
f2<-make.signal2("bumps",x=x2)
#
# perform the forward transform...
out<-fwtnp(x2,f2,LocalPred=AdaptPred)
#
# and now invert using the information from out...
#
fhat<-invtnp(x2,out$coeff,out$lengths,out$lengthsremove,out$pointsin,out$removelist,
out$neighbrs,out$schemehist,out$interhist,LocalPred=AdaptPred)
#
# Now compare the original signal with the reconstruction.
sum(abs(f2-fhat$coeff))
#
Run the code above in your browser using DataLab