lapack icon indicating copy to clipboard operation
lapack copied to clipboard

GESVD returns zero matrix for degenerate matrices

Open amigalemming opened this issue 7 years ago • 5 comments

For M=0 or M=0, GESVD returns a zero matrix for VT or U, respectively. Mathematically correct would be to return an identity matrix.

amigalemming avatar Aug 04 '18 10:08 amigalemming

Seems to be duplicate of #187.

amigalemming avatar Aug 04 '18 10:08 amigalemming

Numerically returning an identity matrix is a waste and it will take time to create that identity matrix for no reason if the matrix is empty.

This would make many computations slower for no functional benefit.

ilayn avatar Aug 04 '18 11:08 ilayn

On Sat, 4 Aug 2018, Ilhan Polat wrote:

Numerically returning an identity matrix is a waste and it will take time to create that identity matrix for no reason if the matrix is empty.

This would make many computations slower for no functional benefit.

It should at least be documented.

amigalemming avatar Aug 04 '18 11:08 amigalemming

I still think, if the programmer requests all orthogonal vectors (JOB='A') then he wants to do something with them. For a 1000x1 matrix GESVD will also compute 999 orthogonal padding vectors, why should it behave differently for 1000x0? Doing nothing for 1000x0 would be correct for the other JOB types.

amigalemming avatar Aug 04 '18 11:08 amigalemming

Ah indeed you are right, my bad. I've overlooked the JOB types issue. It still feels awkward but I see the point for cases where singular vectors are requested.

However checking for zero-size and branching off seems to be a more efficient way in my opinion.

ilayn avatar Aug 05 '18 15:08 ilayn