1% Nm = LagkJointMomentsFromMRAP(H, K, L, prec)
3% Returns the lag-L joint moments of a marked rational
8% H : list/cell of matrices of shape(M,M), length(N)
9% The H0...HN matrices of the MRAP to check
11% The dimension of the matrix of joint moments to
12% compute. If K=0, the MxM joint moments will be
13% computed. The
default value
is 0
15% The lag at which the joint moments are computed.
16% The
default value
is 1
17% prec : double, optional
18% Numerical precision to check
if the input
is valid.
19% The
default value
is 1e-14
23% Nm : list/cell of matrices of shape(K+1,K+1), length(N)
24% The matrices containing the lag-L joint moments,
25% starting from moment 0.
27function Nm = LagkJointMomentsFromMRAP (H, K, L)
29 global BuToolsCheckInput;
30 if isempty(BuToolsCheckInput)
31 BuToolsCheckInput =
true;
34 if BuToolsCheckInput && ~CheckMRAPRepresentation(H)
35 error(
'LagkJointMomentsFromMRAP: Input isn''t a valid MRAP representation!');
48 sumH = SumMatrixList(H(2:end));
51 pi = DRPSolve(iH0*sumH);
52 Pw = eye(size(H{1},1));
60 Pl = (iH0*sumH)^(L-1);
67 Nmm(i,j)=sum(pi*H0p{i}*iH0*H{m+1}*Pl*H0p{j});