%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                           %    
%        IDCexponents.m     %
%                           %   
%   Abry & Riedi & Chainais %
%
%         mars 2003         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Input :
%           Law :
%                   -> 0 : IDC, Log-Normal  
%                   -> 1 : CPC, F = Log-Normal distribution, (mu,sigma2)
%                   -> 2 : CPC, F = exponential distribution (Temp) 
%                   -> 3 : CPC, F = Dirac (Wi=Cte=W0) (log-Poisson ou She-Leveque) (W0<1)
%           q   : order of desired exponents,
%           ParamLaw : parameters of the law of random measure, (cf.
%                      distribution G)
%           C : multiplicative constant (increases the density of multipliers of the cascade),
%           H   : Hurst exponent of used fBm.
%
% Output :
%           TtheoQ : exponents C\phi(q)     of Qr, IDC noise,
%           TtheoA : exponents q+C\phi(q)   of A , IDC motion,
%           TtheoV : exponents qH+C\phi(qH) of V , IDC fBm.
%
% [TtheoQ,TtheoA,TtheoV] = IDCexponents(Law,q,ParamLaw,C,H) ;
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [TtheoQ,TtheoA,TtheoV] = IDCexponents(Law,q,ParamLaw,C,H) ;

switch Law
    case 0,  %%% IDC Log Normal
        mu=-ParamLaw(1)/2;
        sigma2=ParamLaw(1);
        H1 = -C*(mu+sigma2/2) ;
        TtheoQ = -C*(mu*q+sigma2/2*q.^2) ;% -q*H1 ;        % Qr
        TtheoA = q + TtheoQ ;                      % Ar 
        qh = q * H;
        TtheoV = qh -(mu+H1)*qh-sigma2/2*qh.^2 ;    % Vr
    case 1, %%% CPC, F=log-Normal
        mu = ParamLaw(1) ;
	    sigma2 = ParamLaw(2) ;
        H1 = C*(1 - exp(mu+sigma2/2)) ;  % for normalization \E Qr = 1
    	TtheoQ = C*(1-exp(mu*q+sigma2/2*q.^2))-q*H1 ;        % Qr
	    TtheoA = q + TtheoQ ;    % Ar
        qh = H  * q ;
	    TtheoV = qh + C*(1-exp(mu*qh+sigma2/2*qh.^2))-qh*H1  ; % Vr
    case 2, %%% CPC, F=log-exponentiel=powerlaw
	    Temp = ParamLaw(1) ;
   	    TtheoQ = -C*((1+Temp).^q./(1+q*Temp)-1) ;     % Qr 
	    TtheoA = -C*((1+Temp).^q./(1+q*Temp)-1) + q ; % Ar
	    qh = H  * q ;
	    TtheoV = -C*((1+Temp).^qh./(1+qh*Temp)-1) + qh ; % Vr
    case 3, %%% CPC, F = Dirac >> She-Leveque
        W0 = ParamLaw(1) ;
        H1=C*(1-W0) ;
    	TtheoQ = -q*H1 + C*(1-W0.^q) ;     % Qr 
	    TtheoA = q + TtheoQ ; % Ar
        qh = H  * q ;
	    TtheoV = qh -qh*H1 + C*(1-W0.^qh) ; % Vr
end

% TtheoQ=TtheoQ';
% TtheoA=TtheoA';
% TtheoV=TtheoV';
