function [x, y] = IWTC_PO(wcR, wcI, L, cofilt)
% IWT_PO -- Inverse Wavelet Transform (periodized, orthogonal)
%  Usage
%    x = IWTC_PO(wcR, wcI,L, cofilt)
%  Inputs
%    wcR     real part of 1-d complex prthogonal wavelet transform: length(wc) = 2^J.
%    wcI     imaginary part 1-d complex orthogonal wavelet transform: length(wc) = 2^J.
%    L       Coarsest scale (2^(-L) = scale of V_0); L << J;
%    cofilt  Complex orthonormal wavelet filter
%  Outputs
%    x      1-d signal reconstructed from wc
%
%  Description
%    Suppose [wcR wcI] = FWTC_PO(x, L, cofilt).
%    Then x can be reconstructed by
%   x = IWTC_PO(wcR, wcI, L, cofilt)
%
%   A complex filter qmfR+i*qmfI can be obtained by MakeCONFilter.m
       qmfR =  real(cofilt);
       qmfI =  imag(cofilt);
    wcoefR = ShapeAsRow(wcR);
    wcoefI = ShapeAsRow(wcI);
	xr =  wcoefR(1:2^L);
	xi =   wcoefI(1:2^L);
	[n,J] = dyadlength(wcoefR);
	for j=L:J-1
		xrr = UpDyadLo(xr,qmfR) + UpDyadHi(wcoefR(dyad(j)),qmfR)  ;
		xri = UpDyadLo(xr,-qmfI) + UpDyadHi(wcoefR(dyad(j)),qmfI)  ;
		xir = UpDyadLo(xi,qmfR) + UpDyadHi(wcoefI(dyad(j)),qmfR)  ;
		xii = UpDyadLo(xi,-qmfI) + UpDyadHi(wcoefI(dyad(j)),qmfI)  ;
                xr =    xrr - xii;
                xi =    xri + xir  ;
	end
    x = ShapeLike(  xr , wcR );
    y = ShapeLike(  xi , wcI );
%
% Copyright (c) 2001 Angelini, Katul, Lina, and Vidakovic, GaTech.
%     

