vector_max.hpp
Go to the documentation of this file.
1 /*!
2  *
3  *
4  * \brief Kernel for calculating the maximum element of a vector
5  *
6  * \author O. Krause
7  * \date 2016
8  *
9  *
10  * \par Copyright 1995-2015 Shark Development Team
11  *
12  * <BR><HR>
13  * This file is part of Shark.
14  * <http://image.diku.dk/shark/>
15  *
16  * Shark is free software: you can redistribute it and/or modify
17  * it under the terms of the GNU Lesser General Public License as published
18  * by the Free Software Foundation, either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * Shark is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU Lesser General Public License for more details.
25  *
26  * You should have received a copy of the GNU Lesser General Public License
27  * along with Shark. If not, see <http://www.gnu.org/licenses/>.
28  *
29  */
30 #ifndef REMORA_KERNELS_VECTOR_MAX_HPP
31 #define REMORA_KERNELS_VECTOR_MAX_HPP
32 
33 #include "default/vector_max.hpp"
34 #ifdef REMORA_USE_GPU
35 #include "gpu/vector_max.hpp"
36 #endif
37 
38 namespace remora { namespace kernels{
39 
40 ///\brief Computes the index of the maximum element of a vector
41 template<class E, class Device>
42 std::size_t vector_max(
43  vector_expression<E, Device> const& e
44 ) {
45  REMORA_SIZE_CHECK(e().size() == e().size());
46  return bindings::vector_max(e,typename E::evaluation_category::tag());
47 }
48 
49 }}
50 #endif