Shark machine learning library
About Shark
News!
Contribute
Credits and copyright
Downloads
Getting Started
Installation
Using the docs
Documentation
Tutorials
Quick references
Class list
Global functions
FAQ
Showroom
include
shark
LinAlg
BLAS
kernels
gpu
dot.hpp
Go to the documentation of this file.
1
//===========================================================================
2
/*!
3
*
4
*
5
* \brief -
6
*
7
* \author O. Krause
8
* \date 2016
9
*
10
*
11
* \par Copyright 1995-2015 Shark Development Team
12
*
13
* <BR><HR>
14
* This file is part of Shark.
15
* <http://image.diku.dk/shark/>
16
*
17
* Shark is free software: you can redistribute it and/or modify
18
* it under the terms of the GNU Lesser General Public License as published
19
* by the Free Software Foundation, either version 3 of the License, or
20
* (at your option) any later version.
21
*
22
* Shark is distributed in the hope that it will be useful,
23
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
* GNU Lesser General Public License for more details.
26
*
27
* You should have received a copy of the GNU Lesser General Public License
28
* along with Shark. If not, see <http://www.gnu.org/licenses/>.
29
*
30
*/
31
//===========================================================================
32
#ifndef REMORA_KERNELS_CLBLAS_DOT_HPP
33
#define REMORA_KERNELS_CLBLAS_DOT_HPP
34
35
#include "../../expression_types.hpp"
36
#include "../../detail/traits.hpp"
37
#include <boost/compute/algorithm/inner_product.hpp>
38
39
namespace
remora
{
namespace
bindings {
40
41
template
<
typename
VectorX,
typename
VectorY,
class
result_type>
42
void
dot(
43
vector_expression<VectorX, gpu_tag>
const
& x,
44
vector_expression<VectorY, gpu_tag>
const
& y,
45
result_type& result,
46
dense_tag,
47
dense_tag
48
){
49
result = boost::compute::inner_product(x().begin(),x().end(),y().begin(),
typename
VectorX::value_type(0), x().queue());
50
}
51
52
}}
53
#endif