Page 1 of 1

Bug in [CZ]TREVC3: incorrect results

PostPosted: Mon Aug 29, 2016 12:28 am
by chereshnev
CTREVC3 and ZTREVC3 routines contain bug in call to GEMM. They pass real type ALPHA instead of complex type and GEMM uses some random value from memory as imaginary part. The fix is simple:

Code: Select all
Index: ztrevc3.f
===================================================================
--- ztrevc3.f   (revision 1776)
+++ ztrevc3.f   (working copy)
@@ -593,7 +593,7 @@
 *              When the number of vectors stored reaches NB,
 *              or if this was last vector, do the GEMM
                IF( (IV.EQ.NB) .OR. (KI.EQ.N) ) THEN
-                  CALL ZGEMM( 'N', 'N', N, IV, N-KI+IV, ONE,
+                  CALL ZGEMM( 'N', 'N', N, IV, N-KI+IV, CONE,
      $                        VL( 1, KI-IV+1 ), LDVL,
      $                        WORK( KI-IV+1 + (1)*N ), N,
      $                        CZERO,
Index: ctrevc3.f
===================================================================
--- ctrevc3.f   (revision 1776)
+++ ctrevc3.f   (working copy)
@@ -593,7 +593,7 @@
 *              When the number of vectors stored reaches NB,
 *              or if this was last vector, do the GEMM
                IF( (IV.EQ.NB) .OR. (KI.EQ.N) ) THEN
-                  CALL CGEMM( 'N', 'N', N, IV, N-KI+IV, ONE,
+                  CALL CGEMM( 'N', 'N', N, IV, N-KI+IV, CONE,
      $                        VL( 1, KI-IV+1 ), LDVL,
      $                        WORK( KI-IV+1 + (1)*N ), N,
      $                        CZERO,

Re: Bug in [CZ]TREVC3: incorrect results

PostPosted: Mon Aug 29, 2016 1:45 am
by Julien Langou
Eugene, this is great! This helps a lot. Thanks for your contribution. We will be integrating this very soon. I have just checked and this bug fix clearly helps a lot in having a correct code. Thanks! Cheers, Julien.