@@ -38,8 +38,8 @@ mt19937 rng;
3838* @param end last value
3939*/
4040void linspace_f64 ( double *out, const unsigned int len, const double start, const double end ) {
41+ unsigned int i;
4142 double incr;
42- int i;
4343
4444 incr = (end-start) / (len-1 );
4545 for ( i = 0 ; i < len-1 ; i++ ) {
@@ -63,8 +63,8 @@ void linspace_f64( double *out, const unsigned int len, const double start, cons
6363* @param end last value
6464*/
6565void linspace_i32 ( int *out, const unsigned int len, const int start, const int end ) {
66+ unsigned int i;
6667 int incr;
67- int i;
6868
6969 incr = (end-start) / (len-1 );
7070 for ( i = 0 ; i < len-1 ; i++ ) {
@@ -82,7 +82,7 @@ void linspace_i32( int *out, const unsigned int len, const int start, const int
8282* @param b upper bound (exclusive)
8383*/
8484void rand_array_f64 ( double *out, const unsigned int len, const double a, const double b ) {
85- int i;
85+ unsigned int i;
8686
8787 // Define a uniform distribution for generating pseudorandom numbers:
8888 uniform_real_distribution<> randu ( a, b );
@@ -101,7 +101,7 @@ void rand_array_f64( double *out, const unsigned int len, const double a, const
101101* @param b upper bound (exclusive)
102102*/
103103void rand_array_i32 ( int *out, const unsigned int len, const int a, const int b ) {
104- int i;
104+ unsigned int i;
105105
106106 // Define a uniform distribution for generating pseudorandom numbers:
107107 uniform_int_distribution<> randi ( a, b );
@@ -119,7 +119,7 @@ void rand_array_i32( int *out, const unsigned int len, const int a, const int b
119119* @param len array length
120120*/
121121void write_array_f64 ( FILE *f, const double *x, const unsigned int len ) {
122- int i;
122+ unsigned int i;
123123
124124 for ( i = 0 ; i < len; i++ ) {
125125 fprintf ( f, " %.17g" , x[ i ] );
@@ -137,7 +137,7 @@ void write_array_f64( FILE *f, const double *x, const unsigned int len ) {
137137* @param len array length
138138*/
139139void write_array_i32 ( FILE *f, const int *x, const unsigned int len ) {
140- int i;
140+ unsigned int i;
141141
142142 for ( i = 0 ; i < len; i++ ) {
143143 fprintf ( f, " %d" , x[ i ] );
@@ -204,9 +204,9 @@ void write_data_as_json( FILE *f, const double *x, const double *y, const unsign
204204* @param name output filename
205205*/
206206void generate ( double *x, const unsigned int len, const char *name ) {
207+ unsigned int i;
207208 double *y;
208209 FILE *f;
209- int i;
210210
211211 // Allocate an output array:
212212 y = (double *) malloc ( len * sizeof (double ) ); // TODO
@@ -235,8 +235,8 @@ void generate( double *x, const unsigned int len, const char *name ) {
235235* Main execution sequence.
236236*/
237237int main ( void ) {
238+ unsigned int len;
238239 double *x;
239- int len;
240240
241241 // Define the array length:
242242 len = 1000 ;
0 commit comments