filter is corrupting its input state array (Scilab 6 regression)
Reported by Vincent Belaïche
mwe.sce (445 bytes, text/plain)
Script demonstrating the problem
BUG DESCRIPTION:
----------------
When I run the attached script I get this output:
si=
1.170D-46
-2.335D-46
1.760D-46
-5.328D-47
3.710D-48
But si should be exactly equal to 0, not modified as it is an *INPUT*.
There seems to be some memory corruption issue --- that is why I marked the problem as major.
ERROR LOG:
----------
exec ~/Documents/bugs/scilab-xxxx/mwe.sce
--> [cells fact zzeros zpoles] = eqiir('lp','ellip',...
--> [2*%pi/10,4*%pi/10],0.02,0.001);
--> h = fact*poly(zzeros,'z')/poly(zpoles,'z');
--> b = coeff(h.num)($:-1:1);
--> a = coeff(h.den)($:-1:1);
--> si=zeros(max(length(a),length(b))-1,1);
--> pulse=zeros(1000,1);
--> pulse(5)=1;
--> [impulse_response so]=filter(b,a,pulse,si);
--> disp(si,'si=');
si=
1.170D-46
-2.335D-46
1.760D-46
-5.328D-47
3.710D-48
HOW TO REPRODUCE THE BUG:
-------------------------
Play the attached script.
OTHER INFORMATION:
------------------