Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:57

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2014 Roshan <thisisroshansmail@gmail.com>
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 // See http://boostorg.github.com/compute for more information.
0009 //---------------------------------------------------------------------------//
0010 
0011 #ifndef BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP
0012 #define BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP
0013 
0014 #include <boost/compute/system.hpp>
0015 #include <boost/compute/algorithm/copy.hpp>
0016 
0017 namespace boost {
0018 namespace compute {
0019 
0020 /// Performs left rotation such that element at n_first comes to the
0021 /// beginning and the output is stored in range starting at result.
0022 ///
0023 /// Space complexity: \Omega(1)
0024 ///
0025 /// \see rotate()
0026 template<class InputIterator, class OutputIterator>
0027 inline void rotate_copy(InputIterator first,
0028                         InputIterator n_first,
0029                         InputIterator last,
0030                         OutputIterator result,
0031                         command_queue &queue = system::default_queue())
0032 {
0033     size_t count = detail::iterator_range_size(first, n_first);
0034     size_t count2 = detail::iterator_range_size(n_first, last);
0035 
0036     ::boost::compute::copy(first+count, last, result, queue);
0037     ::boost::compute::copy(first, first+count, result+count2, queue);
0038 }
0039 
0040 } //end compute namespace
0041 } //end boost namespace
0042 
0043 #endif // BOOST_COMPUTE_ALGORITHM_ROTATE_COPY_HPP