@@ -53,7 +53,7 @@ class StencilSetUp {
5353
5454 std::vector<int > stencil_dims = {0 , 0 , 0 };
5555
56- int center_index;
56+ size_t center_index;
5757
5858 std::vector<uint64_t > l_index_1;
5959
@@ -79,9 +79,9 @@ class StencilSetUp {
7979
8080 l_index_1.resize (stencil_index_base.size () - 1 , 0 );
8181
82- int counter = 0 ;
82+ size_t counter = 0 ;
8383
84- for (int i = 0 ; i < l_index_1.size (); ++i) {
84+ for (size_t i = 0 ; i < l_index_1.size (); ++i) {
8585 if (i != center_index) {
8686 l_index_1[counter] = i;
8787 counter++;
@@ -138,7 +138,7 @@ class StencilSetUp {
138138
139139 index.resize (stencil_index_base.size ());
140140
141- for (int i = 0 ; i < stencil_index_base.size (); ++i) {
141+ for (size_t i = 0 ; i < stencil_index_base.size (); ++i) {
142142 index[i] = stencil_index_base[i][0 ] + stencil_index_base[i][1 ] * y_num +
143143 stencil_index_base[i][2 ] * y_num * x_num;
144144 }
@@ -210,15 +210,15 @@ class APRStencils {
210210 stencil.linear_coeffs .resize (num_pts_1, 0 ); // need to include the 0 center
211211 auto offset = 0 ;
212212
213- for (int k1 = 0 ; k1 < stencil.linear_coeffs .size (); ++k1) {
213+ for (size_t k1 = 0 ; k1 < stencil.linear_coeffs .size (); ++k1) {
214214
215215 stencil.linear_coeffs [k1] = coeff_full[k1 + offset];
216216
217217 }
218218
219219 stencil.non_linear_coeffs .resize (num_pts_2, 0 );
220220
221- for (int k1 = 0 ; k1 < stencil.non_linear_coeffs .size (); ++k1) {
221+ for (size_t k1 = 0 ; k1 < stencil.non_linear_coeffs .size (); ++k1) {
222222
223223 stencil.non_linear_coeffs [k1] = coeff_full[k1 + num_pts_1];
224224
@@ -274,13 +274,13 @@ class APRStencils {
274274
275275 auto offset = 0 ;
276276
277- for (int k1 = 0 ; k1 < stencil.linear_coeffs .size (); ++k1) {
277+ for (size_t k1 = 0 ; k1 < stencil.linear_coeffs .size (); ++k1) {
278278
279279 coeff_full[k1 + offset] = stencil.linear_coeffs [k1];
280280
281281 }
282282
283- for (int k1 = 0 ; k1 < stencil.non_linear_coeffs .size (); ++k1) {
283+ for (size_t k1 = 0 ; k1 < stencil.non_linear_coeffs .size (); ++k1) {
284284
285285 coeff_full[k1 + num_pts_linear] = stencil.non_linear_coeffs [k1];
286286
@@ -386,7 +386,7 @@ std::vector<int> sample_without_replacement(int k, int N, std::default_random_en
386386 std::shuffle (result.begin (), result.end (), gen);
387387
388388 return result;
389- };
389+ }
390390
391391class APRDenoise {
392392
@@ -449,7 +449,7 @@ class APRDenoise {
449449
450450 }
451451
452- int pts = std::pow (2 *stencil_sz+1 ,it.number_dimensions ())*train_factor;
452+ uint64_t pts = std::pow (2 *stencil_sz+1 ,it.number_dimensions ())*train_factor;
453453
454454 if (total_parts >= pts){
455455 viable_levels++;
@@ -760,7 +760,7 @@ class APRDenoise {
760760 template <typename T, typename S>
761761 void
762762 assemble_system_guided (APR &apr, ParticleData <T> &parts, ParticleData <T> &parts_g, StencilSetUp &stencilSetUp,
763- Stencil<S> &stencil, int N, int num_rep, int level, float factor = 0.05 ,
763+ Stencil<S> &stencil, uint64_t N, int num_rep, int level, float factor = 0.05 ,
764764 bool verbose = false ) {
765765
766766 timer.verbose_flag = verbose;
@@ -779,7 +779,7 @@ class APRDenoise {
779779 APRReconstruction::interp_img_us_smooth (apr, img, parts, false , delta);
780780 stencilSetUp.calculate_global_index (img);
781781
782- if (total_parts < N) {
782+ if (total_parts < ( uint64_t ) N) {
783783 N = stencilSetUp.l_index_1 .size ()*this ->train_factor ;
784784 }
785785
@@ -805,7 +805,7 @@ class APRDenoise {
805805 std::vector<float > nl_local_vec;
806806 nl_local_vec.resize (stencilSetUp.nl_index_1 .size (), 0 );
807807
808- auto n = ( int ) stencilSetUp.l_index_1 .size () + stencilSetUp.nl_index_1 .size ();
808+ size_t n = stencilSetUp.l_index_1 .size () + stencilSetUp.nl_index_1 .size ();
809809
810810 std::vector<uint64_t > random_index;
811811
@@ -879,7 +879,7 @@ class APRDenoise {
879879
880880 random_index[0 ] = std::rand () % total_p + 1 ;
881881
882- for (int j = 1 ; j < random_index.size (); ++j) {
882+ for (size_t j = 1 ; j < random_index.size (); ++j) {
883883
884884 random_index[j] = random_index[j - 1 ] + std::rand () % total_p + 1 ;
885885 }
@@ -906,20 +906,20 @@ class APRDenoise {
906906 // Get the local stencil of points
907907 const uint64_t global_off_l = y + global_off;
908908
909- for (int i = 0 ; i < stencilSetUp.index .size (); ++i) {
909+ for (size_t i = 0 ; i < stencilSetUp.index .size (); ++i) {
910910 local_vec[i] = pad_img.mesh [global_off_l + stencilSetUp.index [i]];
911911 }
912912
913913 // b_temp[k] = local_vec[stencilSetUp.center_index];
914914 b_temp[k] = parts_g[global_index[r_i]];
915915
916- for (int i = 0 ; i < stencilSetUp.l_index_1 .size (); ++i) {
916+ for (size_t i = 0 ; i < stencilSetUp.l_index_1 .size (); ++i) {
917917 // A_temp(i, k, 0) = local_vec[stencilSetUp.l_index_1[i]];
918918 A (i, k) = local_vec[stencilSetUp.l_index_1 [i]];
919919 }
920920
921921 // Apply the non-linear kernel
922- for (int i = 0 ; i < stencilSetUp.nl_index_1 .size (); ++i) {
922+ for (size_t i = 0 ; i < stencilSetUp.nl_index_1 .size (); ++i) {
923923 // A_temp(i + l_num, k, 0) =
924924 // local_vec[stencilSetUp.nl_index_1[i]] * local_vec[stencilSetUp.nl_index_2[i]];
925925 A (i + l_num, k) =
@@ -957,7 +957,7 @@ class APRDenoise {
957957
958958 if (l == 0 ) {
959959 float eps = .01 ;
960- for (int i = 0 ; i < n; ++i) {
960+ for (size_t i = 0 ; i < n; ++i) {
961961 coeff_store[l][i] = std::rand () * 2 * eps - eps;
962962 }
963963
@@ -996,7 +996,7 @@ class APRDenoise {
996996 }
997997
998998
999- for (int i1 = 0 ; i1 < n; ++i1) {
999+ for (size_t i1 = 0 ; i1 < n; ++i1) {
10001000 coeff (i1) = coeff (i1) / norm_c_ (i1);
10011001 }
10021002
@@ -1024,7 +1024,7 @@ class APRDenoise {
10241024
10251025 int include = std::floor (0.5 * num_rep);
10261026
1027- for (int k1 = 0 ; k1 < stencil.linear_coeffs .size (); ++k1) {
1027+ for (size_t k1 = 0 ; k1 < stencil.linear_coeffs .size (); ++k1) {
10281028
10291029 if (k1 == stencilSetUp.center_index ) {
10301030 offset = -1 ;
@@ -1046,8 +1046,7 @@ class APRDenoise {
10461046
10471047 stencil.non_linear_coeffs .resize (stencilSetUp.nl_index_1 .size (), 0 );
10481048
1049- for (int k1 = 0 ; k1 < stencil.non_linear_coeffs .size (); ++k1) {
1050-
1049+ for (size_t k1 = 0 ; k1 < stencil.non_linear_coeffs .size (); ++k1) {
10511050
10521051 double sum = 0 ;
10531052 double counter = 0 ;
@@ -1068,14 +1067,14 @@ class APRDenoise {
10681067 float factor = 0 ;
10691068 float sum = 0 ;
10701069
1071- for (int j = 0 ; j < stencil.linear_coeffs .size (); ++j) {
1070+ for (size_t j = 0 ; j < stencil.linear_coeffs .size (); ++j) {
10721071 factor = std::max (factor, std::abs (stencil.linear_coeffs [j]));
10731072 sum += stencil.linear_coeffs [j];
10741073 }
10751074
10761075 stencil.linear_coeffs [stencilSetUp.center_index ] = factor;
10771076
1078- for (int j = 0 ; j < stencil.linear_coeffs .size (); ++j) {
1077+ for (size_t j = 0 ; j < stencil.linear_coeffs .size (); ++j) {
10791078 stencil.linear_coeffs [j] = stencil.linear_coeffs [j]*(sum)/(sum+factor);
10801079 }
10811080
@@ -1088,7 +1087,7 @@ class APRDenoise {
10881087
10891088 float c_sum = 0 ;
10901089
1091- for (int l1 = 0 ; l1 < stencil.linear_coeffs .size (); ++l1) {
1090+ for (size_t l1 = 0 ; l1 < stencil.linear_coeffs .size (); ++l1) {
10921091 if (std::isnan (stencil.linear_coeffs [l1])){
10931092 valid_check = false ;
10941093 }
0 commit comments