 
function A=matr_transP(M,Par,vx,si)
%[vx,M]--size  of signal
%Par -- spline order
%A-- wavelet packet transform matrix
%si=1--for decomposition
%si=-1 -- for reconstruction
n=0:M-1;

     y=(cos(pi*(n)/M)).^Par;
    y=repmat(y,vx,1);
    [y0, y1]=havshB(y);
 w=exp(2*i*si*pi*(n)/M);
 w=repmat(w,vx,1);
 [w0, w1]=havshB(w);
 [u0,~]=juviP(2*Par,M);
 u0=repmat(u0,vx,1);
[u1,~]=juviP(2*Par,M/2);   
u1=repmat(u1,vx,1);
[u00, u01]=havshB(u0);
  s0=sqrt(u00./(1*u1+eps)).*y0;
  s1=sqrt(u01./(1*u1+eps)).*y1;  
  A={s0 s1;w0.*s1 w1.*s0};
  
  
if si==-1

  A=transpose(A);
end
% Copyright (c) 2013. Valery A. Zheludev
