Thrust
binary_search.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2013 NVIDIA Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
22 #pragma once
23 
24 #include <thrust/detail/config.h>
25 #include <thrust/detail/execution_policy.h>
26 #include <thrust/pair.h>
27 
28 THRUST_NAMESPACE_BEGIN
29 
46 // Scalar Functions //
49 
50 
100 template<typename DerivedPolicy, typename ForwardIterator, typename LessThanComparable>
101 __host__ __device__
102 ForwardIterator lower_bound(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
103  ForwardIterator first,
104  ForwardIterator last,
105  const LessThanComparable &value);
106 
107 
152 template <class ForwardIterator, class LessThanComparable>
153 ForwardIterator lower_bound(ForwardIterator first,
154  ForwardIterator last,
155  const LessThanComparable& value);
156 
157 
211 template<typename DerivedPolicy, typename ForwardIterator, typename T, typename StrictWeakOrdering>
212 __host__ __device__
213 ForwardIterator lower_bound(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
214  ForwardIterator first,
215  ForwardIterator last,
216  const T &value,
217  StrictWeakOrdering comp);
218 
219 
268 template <class ForwardIterator, class T, class StrictWeakOrdering>
269 ForwardIterator lower_bound(ForwardIterator first,
270  ForwardIterator last,
271  const T& value,
272  StrictWeakOrdering comp);
273 
274 
325 template<typename DerivedPolicy, typename ForwardIterator, typename LessThanComparable>
326 __host__ __device__
327 ForwardIterator upper_bound(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
328  ForwardIterator first,
329  ForwardIterator last,
330  const LessThanComparable &value);
331 
332 
378 template <class ForwardIterator, class LessThanComparable>
379 ForwardIterator upper_bound(ForwardIterator first,
380  ForwardIterator last,
381  const LessThanComparable& value);
382 
383 
437 template<typename DerivedPolicy, typename ForwardIterator, typename T, typename StrictWeakOrdering>
438 __host__ __device__
439 ForwardIterator upper_bound(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
440  ForwardIterator first,
441  ForwardIterator last,
442  const T &value,
443  StrictWeakOrdering comp);
444 
493 template <class ForwardIterator, class T, class StrictWeakOrdering>
494 ForwardIterator upper_bound(ForwardIterator first,
495  ForwardIterator last,
496  const T& value,
497  StrictWeakOrdering comp);
498 
499 
549 template <typename DerivedPolicy, typename ForwardIterator, typename LessThanComparable>
550 __host__ __device__
551 bool binary_search(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
552  ForwardIterator first,
553  ForwardIterator last,
554  const LessThanComparable& value);
555 
556 
601 template <class ForwardIterator, class LessThanComparable>
602 bool binary_search(ForwardIterator first,
603  ForwardIterator last,
604  const LessThanComparable& value);
605 
606 
659 template <typename DerivedPolicy, typename ForwardIterator, typename T, typename StrictWeakOrdering>
660 __host__ __device__
661 bool binary_search(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
662  ForwardIterator first,
663  ForwardIterator last,
664  const T& value,
665  StrictWeakOrdering comp);
666 
667 
715 template <class ForwardIterator, class T, class StrictWeakOrdering>
716 bool binary_search(ForwardIterator first,
717  ForwardIterator last,
718  const T& value,
719  StrictWeakOrdering comp);
720 
721 
784 template <typename DerivedPolicy, typename ForwardIterator, typename LessThanComparable>
785 __host__ __device__
787 equal_range(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
788  ForwardIterator first,
789  ForwardIterator last,
790  const LessThanComparable& value);
791 
792 
850 template <class ForwardIterator, class LessThanComparable>
852 equal_range(ForwardIterator first,
853  ForwardIterator last,
854  const LessThanComparable& value);
855 
856 
923 template <typename DerivedPolicy, typename ForwardIterator, typename T, typename StrictWeakOrdering>
924 __host__ __device__
926 equal_range(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
927  ForwardIterator first,
928  ForwardIterator last,
929  const T& value,
930  StrictWeakOrdering comp);
931 
932 
994 template <class ForwardIterator, class T, class StrictWeakOrdering>
996 equal_range(ForwardIterator first,
997  ForwardIterator last,
998  const T& value,
999  StrictWeakOrdering comp);
1000 
1001 
1008 // Vector Functions //
1011 
1012 
1077 template <typename DerivedPolicy, typename ForwardIterator, typename InputIterator, typename OutputIterator>
1078 __host__ __device__
1079 OutputIterator lower_bound(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
1080  ForwardIterator first,
1081  ForwardIterator last,
1082  InputIterator values_first,
1083  InputIterator values_last,
1084  OutputIterator result);
1085 
1086 
1144 template <class ForwardIterator, class InputIterator, class OutputIterator>
1145 OutputIterator lower_bound(ForwardIterator first,
1146  ForwardIterator last,
1147  InputIterator values_first,
1148  InputIterator values_last,
1149  OutputIterator result);
1150 
1151 
1219 template <typename DerivedPolicy, typename ForwardIterator, typename InputIterator, typename OutputIterator, typename StrictWeakOrdering>
1220 __host__ __device__
1221 OutputIterator lower_bound(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
1222  ForwardIterator first,
1223  ForwardIterator last,
1224  InputIterator values_first,
1225  InputIterator values_last,
1226  OutputIterator result,
1227  StrictWeakOrdering comp);
1228 
1229 
1292 template <class ForwardIterator, class InputIterator, class OutputIterator, class StrictWeakOrdering>
1293 OutputIterator lower_bound(ForwardIterator first,
1294  ForwardIterator last,
1295  InputIterator values_first,
1296  InputIterator values_last,
1297  OutputIterator result,
1298  StrictWeakOrdering comp);
1299 
1300 
1365 template <typename DerivedPolicy, typename ForwardIterator, typename InputIterator, typename OutputIterator>
1366 __host__ __device__
1367 OutputIterator upper_bound(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
1368  ForwardIterator first,
1369  ForwardIterator last,
1370  InputIterator values_first,
1371  InputIterator values_last,
1372  OutputIterator result);
1373 
1374 
1432 template <class ForwardIterator, class InputIterator, class OutputIterator>
1433 OutputIterator upper_bound(ForwardIterator first,
1434  ForwardIterator last,
1435  InputIterator values_first,
1436  InputIterator values_last,
1437  OutputIterator result);
1438 
1439 
1509 template <typename DerivedPolicy, typename ForwardIterator, typename InputIterator, typename OutputIterator, typename StrictWeakOrdering>
1510 __host__ __device__
1511 OutputIterator upper_bound(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
1512  ForwardIterator first,
1513  ForwardIterator last,
1514  InputIterator values_first,
1515  InputIterator values_last,
1516  OutputIterator result,
1517  StrictWeakOrdering comp);
1518 
1519 
1582 template <class ForwardIterator, class InputIterator, class OutputIterator, class StrictWeakOrdering>
1583 OutputIterator upper_bound(ForwardIterator first,
1584  ForwardIterator last,
1585  InputIterator values_first,
1586  InputIterator values_last,
1587  OutputIterator result,
1588  StrictWeakOrdering comp);
1589 
1590 
1656 template <typename DerivedPolicy, typename ForwardIterator, typename InputIterator, typename OutputIterator>
1657 __host__ __device__
1658 OutputIterator binary_search(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
1659  ForwardIterator first,
1660  ForwardIterator last,
1661  InputIterator values_first,
1662  InputIterator values_last,
1663  OutputIterator result);
1664 
1665 
1724 template <class ForwardIterator, class InputIterator, class OutputIterator>
1725 OutputIterator binary_search(ForwardIterator first,
1726  ForwardIterator last,
1727  InputIterator values_first,
1728  InputIterator values_last,
1729  OutputIterator result);
1730 
1731 
1802 template <typename DerivedPolicy, typename ForwardIterator, typename InputIterator, typename OutputIterator, typename StrictWeakOrdering>
1803 __host__ __device__
1804 OutputIterator binary_search(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
1805  ForwardIterator first,
1806  ForwardIterator last,
1807  InputIterator values_first,
1808  InputIterator values_last,
1809  OutputIterator result,
1810  StrictWeakOrdering comp);
1811 
1812 
1876 template <class ForwardIterator, class InputIterator, class OutputIterator, class StrictWeakOrdering>
1877 OutputIterator binary_search(ForwardIterator first,
1878  ForwardIterator last,
1879  InputIterator values_first,
1880  InputIterator values_last,
1881  OutputIterator result,
1882  StrictWeakOrdering comp);
1883 
1884 
1896 THRUST_NAMESPACE_END
1897 
1898 #include <thrust/detail/binary_search.inl>
1899 
thrust::pair< ForwardIterator, ForwardIterator > equal_range(ForwardIterator first, ForwardIterator last, const T &value, StrictWeakOrdering comp)
Definition: pair.h:48
OutputIterator upper_bound(ForwardIterator first, ForwardIterator last, InputIterator values_first, InputIterator values_last, OutputIterator result, StrictWeakOrdering comp)
OutputIterator lower_bound(ForwardIterator first, ForwardIterator last, InputIterator values_first, InputIterator values_last, OutputIterator result, StrictWeakOrdering comp)
A type encapsulating a heterogeneous pair of elements.
OutputIterator binary_search(ForwardIterator first, ForwardIterator last, InputIterator values_first, InputIterator values_last, OutputIterator result, StrictWeakOrdering comp)