cuSolver's getrf shows unintended behavior

Hi.
I’m trying to use cuSolver’s getrf function.
When I put below 3x3 square, singular matrix as input:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]

the resulted LU matrix from sgetrf was :
[[7.0,8.0,9.0],[0.14285715,0.8571428,1.7142856],[0.5714286,0.4999998,1.788139E-7]]

What I expected was, the product of resulted LU matrix’s diagonal elements should be 0, since the input matrix was a singular matrix.
But, as the result shows, there was no 0 on resulted LU matrix’s diagonal.
(There was a tiny value : 1.788139E-7, which was close to 0, tho)

Is this cuSolver getrf’s intended behavior? Should I regard the sufficiently tiny value as 0?
Or does anybody can get any reasonable different result?

Thanks for your help!

1 Like

I have the same problem. In my case, when I call getrf with devIpiv argument to null(LU), returned devInfo value is 3, so it can be known that it is a singular matrix.

but with devIpiv pointer(LUP), the devInfo value is 0.

In both cases above, the matrix used for getrf calls is singular matrix.