%% givexpIDC2D.m
%
% P. Chainais, juin 2006
%
%
%% Use
%
% [TtheoQ] = givexpIDC2D(q,ChoixLoi,ParamLoi);
%
%
%% Input
%
% * *q*: order of desired exponents,
% * *ChoixLoi*:
%
% -> 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)
%
% -> 4 : CPC, Bessel I forms, lambda>0.
% 
% * *ParamLoi*: parameters of the law of random measure, (cf. distribution G)
%
%
%% Output
%   
% * *TtheoQ*: exponents c\phi(q) of Qr, IDC noise,
%


function [TtheoQ] = givexpIDC2D(q,ChoixLoi,ParamLoi) ;

C = ParamLoi(end) ; 

switch ChoixLoi
    case 0,  %%% IDC Log Normal
        mu=ParamLoi(1);
        sigma2=ParamLoi(2);
        H1 = -C*(mu+sigma2/2) ;
        TtheoQ = -C*(mu*q+sigma2/2*q.^2)-q*H1 ;        % Qr
    case 1, %%% CPC, F=log-Normal
        mu = ParamLoi(1) ;
	    sigma2 = ParamLoi(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
    case 2, %%% CPC, F=log-exponentiel=powerlaw
	    Temp = ParamLoi(1) ;
   	    TtheoQ = -C*((1+Temp).^q./(1+q*Temp)-1) ;     % Qr 
    case 3, %%% CPC, F = Dirac >> She-Leveque
        W0 = ParamLoi(1) ;
        H1=C*(1-W0) ;
    	TtheoQ = -q*H1 + C*(1-W0.^q) ;     % Qr 
    case 4, %%% Bessel I forms, F = exponential sur (0,1)
        lam=ParamLoi(1) ;
        H1 = C/(lam+1);
        TtheoQ = ones(size(q)) ;
        TtheoQ(find(q<=-lam)) = NaN*ones(size(find(q<=-lam))) ;
        TtheoQ(find(q>-lam)) = C*q(find(q>-lam)).*(1-q(find(q>-lam)))./((lam+1)*(q(find(q>-lam))+lam));
    otherwise,
        error('Error : ChoixLoi must be 1, 2, 3, or 4 !\n')

end

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