Skip to content

[C/Z]LAUUM / [C/Z]LAUU2 only reads the real part of the complex values on the diagonal of input matrix #1427

Description

@langou

This is related to work of @jprhyne with #1402
And discussion from @ACSimon33 at #1373 (comment) to use LAUUM in LARFT

So we are reviewing [C/Z]LAUUM / [C/Z]LAUU2, it appeared that [C/Z]LAUUM / [C/Z]LAUU2 only reads the real part of the complex values on the diagonal of input matrix

See line 164 at:

lapack/SRC/zlauu2.f

Lines 163 to 178 in 8835bfa

DO 10 I = 1, N
AII = DBLE( A( I, I ) )
IF( I.LT.N ) THEN
A( I, I ) = AII*AII + DBLE( ZDOTC( N-I, A( I, I+1 ),
$ LDA,
$ A( I, I+1 ), LDA ) )
CALL ZLACGV( N-I, A( I, I+1 ), LDA )
CALL ZGEMV( 'No transpose', I-1, N-I, ONE, A( 1,
$ I+1 ),
$ LDA, A( I, I+1 ), LDA, DCMPLX( AII ),
$ A( 1, I ), 1 )
CALL ZLACGV( N-I, A( I, I+1 ), LDA )
ELSE
CALL ZDSCAL( I, AII, A( 1, I ), 1 )
END IF
10 CONTINUE

And so, @jprhyne and I were wondering whether that was a good idea or not. This "feature" is not even described in the comment of the routine. (@jprhyne plans on fixing this by adding some comments if we leave it like that.)

On the hand, one application of LAUUM is multiplication of Cholesky factors and so the diagonal is real. So it does not hurt to set the imaginary part of the complex number to zero. In our LARFT application, the diagonal of the triangular matrix is also real since the triangular matrix is unit. So there is no real harm to leave it as is.

But this is weird. It feels like some users might want to form U U^T where U has a non-zero imaginary part for the diagonal elements. I think it would not be too hard to do and give the routine a broader useage case.

I think if there is no broad support, @jprhyne and I plan to leave the feature in and document it.

If support for changing things, let it known.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions