int main(void)
{
int host_I[10] = { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3};
int host_J[10] = { 0, 1, 0, 1, 2, 1, 2, 3, 2, 3};
float host_V[10] = { 2,-1,-1, 2,-1,-1, 2,-1,-1, 2};
float host_x[4] = {0,0,0,0};
float host_b[4] = {1,2,2,1};
int * device_I;
cudaMalloc(&device_I, 10 * sizeof(int));
int * device_J;
cudaMalloc(&device_J, 10 * sizeof(int));
float * device_V;
cudaMalloc(&device_V, 10 * sizeof(float));
float * device_x;
cudaMalloc(&device_x, 4 * sizeof(float));
float * device_b;
cudaMalloc(&device_b, 4 * sizeof(float));
cudaMemcpy(device_I, host_I, 10 * sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(device_J, host_J, 10 * sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(device_V, host_V, 10 * sizeof(float), cudaMemcpyHostToDevice);
cudaMemcpy(device_x, host_x, 4 * sizeof(float), cudaMemcpyHostToDevice);
cudaMemcpy(device_b, host_b, 4 * sizeof(float), cudaMemcpyHostToDevice);
thrust::device_ptr<int> wrapped_device_I(device_I);
thrust::device_ptr<int> wrapped_device_J(device_J);
thrust::device_ptr<float> wrapped_device_V(device_V);
thrust::device_ptr<float> wrapped_device_x(device_x);
thrust::device_ptr<float> wrapped_device_b(device_b);
DeviceIndexArrayView row_indices (wrapped_device_I, wrapped_device_I + 10);
DeviceIndexArrayView column_indices(wrapped_device_J, wrapped_device_J + 10);
DeviceValueArrayView values (wrapped_device_V, wrapped_device_V + 10);
DeviceValueArrayView x (wrapped_device_x, wrapped_device_x + 4);
DeviceValueArrayView b (wrapped_device_b, wrapped_device_b + 4);
DeviceIndexArrayView,
DeviceValueArrayView> DeviceView;
DeviceView A(4, 4, 10, row_indices, column_indices, values);
cudaMemcpy(host_x, device_x, 4 * sizeof(float), cudaMemcpyDeviceToHost);
cudaFree(device_I);
cudaFree(device_J);
cudaFree(device_V);
cudaFree(device_x);
cudaFree(device_b);
return 0;
}