changeset 11596:a9cf422ed849

avoid apparent bug in ATLAS versions of CHERK/ZHERK
author John W. Eaton <jwe@octave.org>
date Fri, 21 Jan 2011 11:05:21 -0500
parents 5ec6aa05638d
children a066673566da
files liboctave/CMatrix.cc liboctave/ChangeLog liboctave/fCMatrix.cc
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CMatrix.cc
+++ b/liboctave/CMatrix.cc
@@ -3754,7 +3754,12 @@
         {
           octave_idx_type lda = a.rows ();
 
-          retval = ComplexMatrix (a_nr, b_nc);
+          // FIXME -- looking at the reference BLAS, it appears that it
+          // should not be necessary to initialize the output matrix if
+          // BETA is 0 in the call to ZHERK, but ATLAS appears to
+          // use the result matrix before zeroing the elements.
+
+          retval = ComplexMatrix (a_nr, b_nc, 0.0);
           Complex *c = retval.fortran_vec ();
 
           const char ctra = get_blas_trans_arg (tra, cja);
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-21  John W. Eaton  <jwe@octave.org>
+
+	* CMatrix.cc (xgemm): Initialize output matrix for call to ZHERK.
+	* fCMatrix.cc (xgemm): Initialize output matrix for call to CHERK.
+
 2011-01-20  John W. Eaton  <jwe@octave.org>
 
 	* Array-b.cc, Array-d.cc, Array-f.cc, Array-util.cc,
--- a/liboctave/fCMatrix.cc
+++ b/liboctave/fCMatrix.cc
@@ -3750,7 +3750,12 @@
         {
           octave_idx_type lda = a.rows ();
 
-          retval = FloatComplexMatrix (a_nr, b_nc);
+          // FIXME -- looking at the reference BLAS, it appears that it
+          // should not be necessary to initialize the output matrix if
+          // BETA is 0 in the call to CHERK, but ATLAS appears to
+          // use the result matrix before zeroing the elements.
+
+          retval = FloatComplexMatrix (a_nr, b_nc, 0.0);
           FloatComplex *c = retval.fortran_vec ();
 
           const char ctra = get_blas_trans_arg (tra, cja);