[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
float matrix multiplication problem
From: |
John W. Eaton |
Subject: |
float matrix multiplication problem |
Date: |
Thu, 14 Jan 2010 03:18:05 -0500 |
Using the current sources, running Octave with valgrind, and given
x = single (rand (4, 4) + i*rand (4, 4));
then the expression
x'*x;
generates the following diagnostics:
==12836== Conditional jump or move depends on uninitialised value(s)
==12836== at 0x681224F: bool mx_inline_all_real<float>(unsigned long,
std::complex<float> const*) (mx-inlines.cc:214)
==12836== by 0x6826504: FloatComplexNDArray::all_elements_are_real() const
(fCNDArray.cc:536)
==12836== by 0x567F587:
octave_float_complex_matrix::try_narrowing_conversion() (ov-flt-cx-mat.cc:83)
==12836== by 0x56BF551: octave_value::maybe_mutate() (ov.cc:1148)
==12836== by 0x56CD9B3: octave_value::octave_value(FloatComplexMatrix
const&, MatrixType const&) (ov.cc:689)
==12836== by 0x57C7A79: oct_binop_herm_mul(octave_base_value const&,
octave_base_value const&) (op-fcm-fcm.cc:137)
==12836== by 0x56C50E0: do_binary_op(octave_value::compound_binary_op,
octave_value const&, octave_value const&) (ov.cc:2103)
==12836== by 0x574E833: tree_compound_binary_expression::rvalue1(int)
(pt-cbinop.cc:212)
==12836== by 0x5755FB4: tree_evaluator::visit_statement(tree_statement&)
(pt-eval.cc:689)
==12836== by 0x57728F3: tree_statement::accept(tree_walker&)
(pt-stmt.cc:152)
==12836== by 0x5755DBB:
tree_evaluator::visit_statement_list(tree_statement_list&) (pt-eval.cc:725)
==12836== by 0x577291F: tree_statement_list::accept(tree_walker&)
(pt-stmt.cc:216)
As far as I can tell, this is happening at the point where the result
from xgemm is being stuffed into an octave_value object and
maybe_mutate is called to try to narrow the result.
I don't understand why something would be uninitialized here, but the
following change avoids the problem for me:
diff --git a/liboctave/fCMatrix.cc b/liboctave/fCMatrix.cc
--- a/liboctave/fCMatrix.cc
+++ b/liboctave/fCMatrix.cc
@@ -3769,7 +3769,7 @@
{
octave_idx_type lda = a.rows ();
- retval = FloatComplexMatrix (a_nr, b_nc);
+ retval = FloatComplexMatrix (a_nr, b_nc, 0.0);
FloatComplex *c = retval.fortran_vec ();
const char *ctra = get_blas_trans_arg (tra, cja);
I wouldn't think this should be necessary, because I thought CHERK
and the following code to fill in the lower part of the symmetric
matrix would properly initialize everything.
jwe
- float matrix multiplication problem,
John W. Eaton <=