Nonstationarity: patching |
The adjoint of extracting all the patches is adding them back. Because of the overlaps, the adjoint is not the inverse. In many applications, inverse patching is required; i.e. patching things back together seamlessly. This can be done with weighting functions. You can have any weighting function you wish and I will provide you the patching reconstruction operator in
void mkwallwt(int dim /* number of dimensions */, int* npatch /* number of patches [dim] */, int* nwall /* data size [dim] */, int* nwind /* patch size [dim] */, float* windwt /* window weighting (input) */, float* wallwt /* wall weighting (output) */) /*< make wall weight >*/ { int i, j, ip, np, n, nw; np = 1; n = 1; nw = 1; for (j=0; j < dim; j++) { np *= npatch[j]; n *= nwall[j]; nw *= nwind[j]; } for (i = 0; i < n; i++) { wallwt[i] = 0.; } patch_init(dim, npatch, nwall, nwind); for (ip=0; ip < np; ip++) { patch_lop(true, true, n, nw, wallwt, windwt); patch_close (); } for (i = 0; i < n; i++) { if ( wallwt[i] != 0.) wallwt[i] = 1. / wallwt[i]; } } |
No matrices are needed to show that this method succeeds, because data values are never mixed with one another. An equation for any reconstructed data value as a function of the original value and the weights that hit is . Thus, our process is simply a ``partition of unity.''
To demonstrate the program, I made a random weighting function to use in each window with positive random numbers. The general strategy allows us to use different weights in different windows. That flexibility adds clutter, however, so here we simply use the same weighting function in each window.
The operator is called ``idempotent.'' The word ``idempotent'' means ``self-power,'' because for any , and , thus the numbers 0 and 1 share the property that raised to any power they remain themselves. Likewise, the patching reconstruction operator multiplies every data value by either one or zero. Figure 3 shows the result obtained when a plane of identical constant values is passed into the patching reconstruction operator . The result is constant on the 2-axis, which confirms that there is adequate sampling on the 2-axis, and although the weighting function is made of random numbers, all trace of random numbers has disappeared from the output. On the 1-axis the output is constant, except for being zero in gaps, because the windows do not overlap on the 1-axis.
idempatch
Figure 3. A plane of identical values passed through the idempotent patching reconstruction operator. Results are shown for the same parameters as Figure 2. | |
---|---|
Module patching assists in reusing the patching technique. It takes a linear operator . as its argument and applies it in patches. Mathematically, this is . It is assumed that the input and output sizes for the operator oper are equal.
for (i=0; i < n; i++) data[i] = 0.; patch_init(dim, npatch, nwall, nwind); for (ip = 0; ip < np; ip++) { /* modl -> winmodl */ patch_lop(false, false, n, nw, modl, winmodl); /* winmodl -> windata */ oper(false, false, nw, nw, winmodl, windata); /* apply window weighting */ for (iw=0; iw < nw; iw++) windata[iw] *= windwt[iw]; /* data <- windata */ patch_lop(true, true, n, nw, data, windata); patch_close(); } /* windwt -> wallwt */ mkwallwt(dim, npatch, nwall, nwind, windwt, wallwt); /* apply wall weighting */ for (i=0; i < n; i++) data[i] *= wallwt[i]; |
Nonstationarity: patching |