     indices[3] = 7;
    
     // construct transform_iterator
-    thrust::permutation_iterator<Iterator, Iterator> iter(input.begin(), indices.begin());
+    thrust::permutation_iterator<Iterator, Iterator> iter(source.begin(), indices.begin());
 
     thrust::copy(thrust::make_permutation_iterator(source.begin(), indices.begin()),
                  thrust::make_permutation_iterator(source.begin(), indices.begin()) + 4,

    indices[3] = 7;
   
    // construct transform_iterator
    thrust::permutation_iterator<Iterator, Iterator> iter(input.begin(), indices.begin());

    thrust::copy(iter, iter + 4, output.begin());

    ASSERT_EQUAL(output[0], 4);
    ASSERT_EQUAL(output[1], 1);
    ASSERT_EQUAL(output[2], 6);
    ASSERT_EQUAL(output[3], 8);

}
DECLARE_VECTOR_UNITTEST(TestPermutationIterator);


#include <thrusttest/unittest.h>
#include <thrust/iterator/permutation_iterator.h>

#include <thrust/reduce.h>
#include <thrust/transform_reduce.h>
#include <thrust/sequence.h>

template <class Vector>
void TestPermutationIterator(void)
