/home/kcamus/qaas_runs/169-443-9681/intel/AMG/build/AMG/AMG/parcsr_ls/par_interp.c: 2750 - 2975
--------------------------------------------------------------------------------

2750:        if (trunc_factor > 0)
[...]
2877:                for (i = start; i < stop; i++)
2878:                {
2879:                 /* Note P_diag_i[stop] is the starting point for the next thread 
2880:                  * in j and data, not the stop point for this thread */
2881:                 last_index = P_diag_i[i+1];
2882:                 last_index_offd = P_offd_i[i+1];
2883:                 if(i == stop-1)
2884:                 {  
2885:                     last_index -= num_lost_per_thread[my_thread_num];   
2886:                     last_index_offd -= num_lost_offd_per_thread[my_thread_num]; 
2887:                 }  
2888: 
2889:                 row_sum = 0;
2890:                 num_elmts = last_index-P_diag_i[i] + last_index_offd-P_offd_i[i];
2891:                 if (max_elmts < num_elmts)
2892:                 {
2893:                   /* copy both diagonal and off-diag parts of row i to _aux_ arrays */
2894:                   cnt = 0;
2895:                   for (j = P_diag_i[i]; j < last_index; j++)
2896:                   {
2897:                      P_aux_j[cnt] = P_diag_j[j];
2898:                      P_aux_data[cnt++] = P_diag_data[j];
2899:                      row_sum += P_diag_data[j];
2900:                   }
2901:                   num_lost += cnt;
2902:                   cnt1 = cnt;
2903:                   for (j = P_offd_i[i]; j < last_index_offd; j++)
2904:                   {
2905:                      P_aux_j[cnt] = P_offd_j[j]+num_cols;
2906:                      P_aux_data[cnt++] = P_offd_data[j];
2907:                      row_sum += P_offd_data[j];
2908:                   }
2909:                   num_lost_offd += cnt-cnt1;
2910:                   
2911:                   /* sort data */
2912:                   hypre_qsort2abs(P_aux_j,P_aux_data,0,cnt-1);
2913:                   scale = 0;
2914:                   if (i > start)
2915:                   {
2916:                      P_diag_i[i] = cnt_diag;
2917:                      P_offd_i[i] = cnt_offd;
2918:                   }
2919:                   for (j = 0; j < max_elmts; j++)
2920:                   {
2921:                      scale += P_aux_data[j];
2922:                      if (P_aux_j[j] < num_cols)
2923:                      {
2924:                         P_diag_j[cnt_diag] = P_aux_j[j];
2925:                         P_diag_data[cnt_diag++] = P_aux_data[j];
2926:                      }
2927:                      else
2928:                      {
2929:                         P_offd_j[cnt_offd] = P_aux_j[j]-num_cols;
2930:                         P_offd_data[cnt_offd++] = P_aux_data[j];
2931:                      }
2932:                   }
2933:                   num_lost -= cnt_diag-P_diag_i[i];
2934:                   num_lost_offd -= cnt_offd-P_offd_i[i];
2935: 
2936:                   /* normalize row of P */
2937:                   if (scale != 0.)
2938:                   {
2939:                      if (scale != row_sum)
2940:                      {
2941:                         scale = row_sum/scale;
2942:                         for (j = P_diag_i[i]; j < cnt_diag; j++)
2943:                                P_diag_data[j] *= scale;
2944:                         for (j = P_offd_i[i]; j < cnt_offd; j++)
2945:                                P_offd_data[j] *= scale;
[...]
2955:                   if (P_diag_i[i] != cnt_diag)
2956:                   {
2957:                      start_j = P_diag_i[i];
2958:                      P_diag_i[i] = cnt_diag;
2959:                      for (j = start_j; j < last_index; j++)
2960:                      {
2961:                         P_diag_j[cnt_diag] = P_diag_j[j];
2962:                         P_diag_data[cnt_diag++] = P_diag_data[j];
[...]
2968:                   if (P_offd_i[i] != cnt_offd)
2969:                   {
2970:                      start_j = P_offd_i[i];
2971:                      P_offd_i[i] = cnt_offd;
2972:                      for (j = start_j; j < last_index_offd; j++)
2973:                      {
2974:                         P_offd_j[cnt_offd] = P_offd_j[j];
2975:                         P_offd_data[cnt_offd++] = P_offd_data[j];
