This example shows how to compute the pseudo inverse of an
n x m matrix with elements of type real.
Note: this example runs on FinSim version 10.0.0 or higher.
module top;
real Q[3:0][2:0];
real IQ[3:0][2:0];
real S[0:0][3:0];
real P[0:0][2:0];
initial begin
#1;
Q = {1.0, 1.0, 1.0,
1.0, 2.0, 1.0,
1.0, 1.0, 2.0,
2.0, 1.0, 1.0};
S = {6.0, 8.0, 9.0, 7.0};
$PrintM(Q, "%e");
$PrintM(S, "%e");
P = S/Q;
$PrintM(P,"%e");
IQ = Q**(-1);
P = S*IQ;
$PrintM(P,"%e");
end
endmodule