This example works on FinSim 10_07_15 and subsequent versions. It run on an Intel i3 2.3GHz processor in 18 seconds.
This example shows how to find the roots of a polynomial and how to find the polynomial given the roots. Note that the polynomial is not sparse, as all its coefficients are non-zero. Also note that the coefficients are in a close range: -6 to 15.
module top;
parameter size = 5131;
real d, p[0:size-1], p1[0:size-1];
VpFCartesian r[0:size-2];
initial begin
/* set the values of the coefficients of the polynomial p */
$InitM(p, 1.599);
p[0] = 15;
p[1000] = 2;
p [size-2] = 3;
p [size-1] = -6;
/* compute the roots r of polynomial p */
r = $Roots(p);
$PrintM(r, "%e");
/* compute the polynomial p1 corresponding to the roots r */
p1 = $Poly(r);
$PrintM(p1, "%e");
/* compare p and p1 */
d = $VpDistAbsMax(p, p1);
$display("distance = %e\n", d);
end
endmodule // top