This example works on FinSim 10_04_31 and subsequent versions.
This example inverts a simple sparse matrice of 4 million x 4 million
elements of type real, uses two norm system functions to measure it and displays all non-zero values on one line and one column.
On a single 32 bit Pentium 1.8GHz processor this example run
in under 92 seconds.
module top;
parameter integer size = 4000000;
real MReal1 [size-1 : 0][size-1 : 0];
real MRInv [size-1 : 0][size-1 : 0];
integer i;
real max, sum;
initial begin
/* declaring sparse matrices */
$ToSparse(MReal1);
$ToSparse(MRInv);
/* initializing matrice to be inverted*/
$Diag(MReal1);
for (i = 0; i < size/2; i++)
begin
MReal1[2*i][i] = 7.0;
end
/*inverting matrix */
MRInv = MReal1 **(-1);
$PrintLine(MRInv, 4*size/10);
$PrintCol(MRInv, 2*size/10);
$display("********displaying norms *********\n");
max = $VpNormAbsMax(MRInv);
sum = $VpNormAbsSum(MRInv);
$display("max=%e, sum=%e\n", max, sum);
end
endmodule // top