Mercurial > hg > octave-shane
changeset 12278:52f6f2989fcd release-3-4-x
don't let uninitialized values escape from DNEUPD
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 28 Jan 2011 14:05:59 -0500 |
parents | 3d38b4916cbf |
children | 18f7aac81ef0 |
files | liboctave/ChangeLog liboctave/eigs-base.cc |
diffstat | 2 files changed, 30 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2011-01-28 John W. Eaton <jwe@octave.org> + + * eigs-base.cc (EigsRealNonSymmetricFunc, + EigsRealNonSymmetricMatrix, EigsRealNonSymmetricMatrixShift): + Initialize eig_vec2 to 0 before calling dneupd. + 2011-01-28 John W. Eaton <jwe@octave.org> * eigs-base.cc: Assume we have ARPACK.
--- a/liboctave/eigs-base.cc +++ b/liboctave/eigs-base.cc @@ -1924,7 +1924,14 @@ Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - Matrix eig_vec2 (n, k + 1); + // FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip + // the assignment to elements of Z that represent imaginary parts. + // Found with valgrind and + // + // A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; + // [vecs, vals, f] = eigs (A, 1) + + Matrix eig_vec2 (n, k + 1, 0.0); double *z = eig_vec2.fortran_vec (); OCTAVE_LOCAL_BUFFER (double, dr, k + 1); @@ -2303,7 +2310,14 @@ Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - Matrix eig_vec2 (n, k + 1); + // FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip + // the assignment to elements of Z that represent imaginary parts. + // Found with valgrind and + // + // A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; + // [vecs, vals, f] = eigs (A, 1) + + Matrix eig_vec2 (n, k + 1, 0.0); double *z = eig_vec2.fortran_vec (); OCTAVE_LOCAL_BUFFER (double, dr, k + 1); @@ -2608,7 +2622,14 @@ Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - Matrix eig_vec2 (n, k + 1); + // FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip + // the assignment to elements of Z that represent imaginary parts. + // Found with valgrind and + // + // A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; + // [vecs, vals, f] = eigs (A, 1) + + Matrix eig_vec2 (n, k + 1, 0.0); double *z = eig_vec2.fortran_vec (); OCTAVE_LOCAL_BUFFER (double, dr, k + 1);