comparison libinterp/dldfcn/__ilu__.cc @ 19986:8bc45a00c8d6

avoid warnings about uninitialized variables * __ilu__.cc (ilu_tp): Initialize tl, partial_row_sum, and partial_col_sum to T(0).
author John W. Eaton <jwe@octave.org>
date Fri, 20 Feb 2015 02:04:15 -0500
parents 4197fc428c7d
children ca7599ae464d
comparison
equal deleted inserted replaced
19985:fc789d4e362e 19986:8bc45a00c8d6
587 octave_idx_type* cidx_in = sm.cidx (); 587 octave_idx_type* cidx_in = sm.cidx ();
588 octave_idx_type* ridx_in = sm.ridx (); 588 octave_idx_type* ridx_in = sm.ridx ();
589 T* data_in = sm.data (); 589 T* data_in = sm.data ();
590 octave_idx_type jrow, i, j, k, jj, c, total_len_l, total_len_u, p_perm, 590 octave_idx_type jrow, i, j, k, jj, c, total_len_l, total_len_u, p_perm,
591 max_ind, max_len_l, max_len_u; 591 max_ind, max_len_l, max_len_u;
592 T tl, aux, maximum; 592 T zero = T(0);
593
594 T tl = zero, aux, maximum;
593 595
594 max_len_u = nnz_u; 596 max_len_u = nnz_u;
595 max_len_u += (0.1 * max_len_u) > n ? 0.1 * max_len_u : n; 597 max_len_u += (0.1 * max_len_u) > n ? 0.1 * max_len_u : n;
596 max_len_l = nnz_l; 598 max_len_l = nnz_l;
597 max_len_l += (0.1 * max_len_l) > n ? 0.1 * max_len_l : n; 599 max_len_l += (0.1 * max_len_l) > n ? 0.1 * max_len_l : n;
610 Array <T> data_out_u (dim_vector (max_len_u, 1)); 612 Array <T> data_out_u (dim_vector (max_len_u, 1));
611 T* data_u = data_out_u.fortran_vec(); 613 T* data_u = data_out_u.fortran_vec();
612 614
613 // Working arrays and permutation arrays 615 // Working arrays and permutation arrays
614 octave_idx_type w_len_u, w_len_l; 616 octave_idx_type w_len_u, w_len_l;
615 T total_sum, partial_col_sum, partial_row_sum; 617 T total_sum, partial_col_sum = zero, partial_row_sum = zero;
616 std::set <octave_idx_type> iw_l; 618 std::set <octave_idx_type> iw_l;
617 std::set <octave_idx_type> iw_u; 619 std::set <octave_idx_type> iw_u;
618 std::set <octave_idx_type>::iterator it, it2; 620 std::set <octave_idx_type>::iterator it, it2;
619 OCTAVE_LOCAL_BUFFER (T, w_data, n); 621 OCTAVE_LOCAL_BUFFER (T, w_data, n);
620 OCTAVE_LOCAL_BUFFER (octave_idx_type, iperm, n); 622 OCTAVE_LOCAL_BUFFER (octave_idx_type, iperm, n);
621 octave_idx_type* perm = perm_vec.fortran_vec (); 623 octave_idx_type* perm = perm_vec.fortran_vec ();
622 OCTAVE_LOCAL_BUFFER (octave_idx_type, uptr, n); 624 OCTAVE_LOCAL_BUFFER (octave_idx_type, uptr, n);
623 625
624 626
625 T zero = T(0);
626 cidx_l[0] = cidx_in[0]; 627 cidx_l[0] = cidx_in[0];
627 cidx_u[0] = cidx_in[0]; 628 cidx_u[0] = cidx_in[0];
628 for (i = 0; i < n; i++) 629 for (i = 0; i < n; i++)
629 { 630 {
630 w_data[i] = 0; 631 w_data[i] = 0;