﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
621	Wrong behaviour in BackDifEq of VMatrix	Víctor de Buen Remiro	Víctor de Buen Remiro	"Function {{{BackDifEq}}} of VMatrix doesn't works fine.
Running this random check for Matrix and VMatrix {{{BackDifEq}}} instances returns different results being the second ones missing sometimes or very large numbers in other cases.

{{{
Real m = 300;
Real  s1 = 5;
Real  s2 = 26;
Real  p1 = IntRand(1,2);
Real  q1 = IntRand(0,2);
Real  p2 = IntRand(1,1);
Real  q2 = IntRand(0,1);
Polyn ar1 = RandStationary(p1,s1);
Polyn ar2 = RandStationary(p2,s2);
Polyn ma1 = RandStationary(q1,s1);
Polyn ma2 = RandStationary(q2,s2);
Polyn ar = ar1*ar2;
Polyn ma = ma1*ma2;

Real p = Degree(ar);
Real q = Degree(ma);
Real n = Max(p,q);


NameBlock CF1 = ARMAProcess::FastCholeskiCovFactor(ar1, ma1, m);
NameBlock CF2 = ARMAProcess::FastCholeskiCovFactor(ar2, ma2, m);
NameBlock CF  = ARMAProcess::FastCholeskiCovFactor(ar,  ma,  m);

VMatrix A = Gaussian(m,1,0,1);

VMatrix Li_ar.f = CholeskiFactor(CF::_.Li_ar,""XXt"",True);

VMatrix L_ma.s  = Convert(CF::_.L_ma,""Cholmod.R.Sparse"");

VMatrix X = CholeskiSolve(Li_ar.f,L_ma.s*A,""PtL"");

VMatrix CF.X = CF::filter(X);

VMatrix cmp.CF   = A | CF.X;

VMatrix CF12.X = CF2::filter(CF1::filter(X));

VMatrix A.n   = Sub(CF12.X, m-n+1, 1, n,  1);
VMatrix A.q   = Sub(CF12.X, m-n+1, 1, q,  1);
VMatrix X.p   = Sub(X,      m-n+1, 1, p,  1);
VMatrix X.m_n = Sub(X,          1, 1, m-n,1);
VMatrix A.m_n = BackDifEq(ar/ma,X.m_n,X.p,A.q);

VMatrix A.m_n_ = Mat2VMat(BackDifEq(ar/ma,VMat2Mat(X.m_n),VMat2Mat(X.p),VMat2Mat(A.q)));

Real error = VMatMax(Abs(A.m_n-A.m_n_));
Real quality = Max(0,1-error);
}}}"	defect	new	normal		Math		blocker			
