>It does not return the inverse in the third argument, but the LU
>decomposition, not including the diagonal of L, which is all 1.
Thanks for telling me this, I had totally ignored this. probably this is the reason. I will check it out.
> Set TEST2 to an identity matrix, and so the solution will be the inverse.
Since the dimensions are not the same, i.e., I don't have two columns of unknowns, this solution will not help.
>You don't show the declaration or values for IPIV.
>It will sometimes exchange the rows, which you will only know if
>you show IPIV.
Here is one example of what I believed was not correct.
A. CODE:
real:: TEST(2,2) = TRANSPOSE(reshape((/1.,2.,3.,4./), (/2,2/)))
real:: TEST2(2) = (1.,1.)
integer :: ipiv2(2)
integer, parameter :: sizet=2
goto 999
...
999 NRHS=1
print*, 'before solving', test, test2
CALL DGESV(sizet, nrhs, TEST, sizet, IPIV2, TEST2, sizet, INFO)
print*, ' after solving:', test, test2
print*, ' ipiv2 vector: ' ipiv2
B. RESULTS IN CMD:
before solving 1.000000 3.000000 2.000000 4.000000
1.000000 1.000000
after solving: 2.000000 4.000000 -1.7014126E+38 1.375000
0.0000000E+00 0.0000000E+00
ipiv2 vector: 2 2
OUTPUTS OF SOLVING LS: INFO 0
C. WHILE I EXPECT THESE VALUES, YOU CAN PUT THEM IN THE EQUATION AND CHECK.
X1=-1, X2=1 BUT THE OUTPUT IS 0 AND 0.