 
     // initialize data
     thrust::device_vector<int> array(R * C);
-    for (int i = 0; i < array.size(); i++)
+    for (size_t i = 0; i < array.size(); i++)
         array[i] = rand() % 3;
     
     // allocate storage for row sums and indices


// convert a linear index to a row index
template <typename T>
struct linear_index_to_row_index : public thrust::unary_function<size_t,size_t>
{
    T C; // number of columns
    

                               thrust::plus<int>());

    // print data 
    for(int i = 0; i < R; i++)
    {
        std::cout << "[";
        for(int j = 0; j < C; j++)
            std::cout << std::setw(8) << array[i * C + j] << " ";
        std::cout << "] = " << std::setw(8) << row_sums[i] << "\n";
    }
