next up previous print clean
Next: Adjoints of products are Up: FAMILIAR OPERATORS Previous: Adjoint derivative

Zero padding is the transpose of truncation

Surrounding a dataset by zeros (zero padding) is adjoint to throwing away the extended data (truncation). Let us see why this is so. Set a signal in a vector $\bold x$, and then to make a longer vector $\bold y$,add some zeros at the end of $\bold x$.This zero padding can be regarded as the matrix multiplication
\begin{displaymath}
\bold y\eq
 \left[ 
 \begin{array}
{c}
 \bold I \\  
 \bold 0
 \end{array} \right] 
 \ 
 \bold x\end{displaymath} (4)
The matrix is simply an identity matrix $\bold I$above a zero matrix $\bold 0$.To find the transpose to zero-padding, we now transpose the matrix and do another matrix multiply:
\begin{displaymath}
\tilde {\bold x} \eq
 \left[ 
 \begin{array}
{cc}
 \bold I & \bold 0
 \end{array} \right] 
\ 
\bold y\end{displaymath} (5)
So the transpose operation to zero padding data is simply truncating the data back to its original length. Subroutine zpad1() below pads zeros on both ends of its input. Subroutines for two- and three-dimensional padding are in the library named zpad2() and zpad3().  
# Zero pad.  Surround data by zeros. 1-D
#
subroutine zpad1( adj,add,  data,nd,  padd,np )
integer           adj,add,    d, nd,    p, np
real                        data(nd), padd(np)
call adjnull(     adj,add,  data,nd,  padd,np)
do d= 1, nd {                p = d + (np-nd)/2
        if( adj == 0 )
                        padd(p) = padd(p) + data(d)
        else
                        data(d) = data(d) + padd(p)
        }
return; end


next up previous print clean
Next: Adjoints of products are Up: FAMILIAR OPERATORS Previous: Adjoint derivative
Stanford Exploration Project
12/26/2000