function OSSRGF_transvection(M,l,H)

%Authors : M. Clausel and B. Vedel, 2008
%clausel@univ-paris12.fr
%beatrice.vedel@ens-lyon.fr

%M. Clausel: Laboratoire d'Analyse Mathˇmatique et Appliquˇe 
% UMR 8050 du CNRS 
% Universitˇ Paris Est, 
% 61 Avenue du Gˇnˇral de Gaulle
%94100 Crˇteil Cedex, France

%B. Vedel: Laboratoire de Physique
%CNRS UMR 5672
%ENS de Lyon
%46, allˇe d'Italie 
%69007 Lyon


%THis program simulates a OSSRGF X satisfying the scaling property
% X(a^Ex)=a^H X(x)
% for the transvection matrix [l  0;  1 l]

%ENTRIES
%M=scale of the cartesian grid (2^(M+1) x 2^(M+1) points)
% l : coefficient of the matrix E
% H= Hurst coefficient between 0 and 1 (strictly)

%OUTPUT
figure()


%COORDINATES

X=(-2*2^M:2:2*2^M)/(2^(M+1));
X(2^M+1)=1/2^M;
Y=(-2*2^M:2:2*2^M)/(2^(M+1));
Y(2^M+1)=1/2^M;
XX=X(ones(1,2*2^M+1),:);
YY=Y(ones(1,2*2^M+1),:)';
clear X Y


%CONSTRUCTION OF THE CLASSICAL PSEUDO-NORM AND OF THE SPECTRAL DENSITY OF THE OSSRGF

%rho = pseudo norm
%rho(x,y)=(abs(x)^(2/l1) + abs(y)^(2/l2) )^(1/2)

rho=(abs(XX)+abs(YY-log(XX).*XX/l)).^(1/l);
clear XX YY

%phi = spectral density constructed from rho
phi=rho.^(H+l);
clear rho


%CONSTRUCTION OF THE FOURIER TRANSFORM W OF THE OSSRGF (WITHOUT RENORMALIZATION)


Z=randn(2*2^M+1,2*2^M+1);
W=fftshift(fft2(Z))./phi;
clear Z

%CONSTRUCTION OF THE OSSRGF (WITH RENORMALIZATION)
T=real(ifft2(ifftshift(W)));
Zp=T-T(2^M+1,2^M+1);
mini=min(min(Zp));
Maxi=max(max(Zp));



figure
imagesc(Zp,[mini Maxi]);
%colormap(gray)


