ViennaCL - The Vienna Computing Library  1.6.1
Free open-source GPU-accelerated linear algebra and solver library.
reduce.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_REDUCE_HPP_
2 #define VIENNACL_LINALG_REDUCE_HPP_
3 
4 /* =========================================================================
5  Copyright (c) 2010-2013, Institute for Microelectronics,
6  Institute for Analysis and Scientific Computing,
7  TU Wien.
8  Portions of this software are copyright by UChicago Argonne, LLC.
9 
10  -----------------
11  ViennaCL - The Vienna Computing Library
12  -----------------
13 
14  Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15 
16  (A list of authors and contributors can be found in the PDF manual)
17 
18  License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
25 #include "viennacl/forwards.h"
26 #include "viennacl/tools/tools.hpp"
28 #include "viennacl/meta/tag_of.hpp"
30 
31 namespace viennacl
32 {
33 
34  namespace linalg
35  {
36 
37  template<typename OP, typename NumericT>
39  reduce(vector_base<NumericT> const & vector)
40  {
42  const vector_base<NumericT>,
43  viennacl::op_reduce_vector<OP> >(vector, vector);
44  }
45 
46  template< typename ROP, typename LHS, typename RHS, typename OP>
50  reduce(viennacl::vector_expression<LHS, RHS, OP> const & vector)
51  {
53  const viennacl::vector_expression<LHS, RHS, OP>,
54  viennacl::op_reduce_vector<ROP> >(vector,vector);
55  }
56 
57  //row-wise reduction
58  template<typename ROP, typename NumericT>
60  reduce_rows(matrix_base<NumericT> const & mat)
61  {
62  return viennacl::vector_expression<const matrix_base<NumericT>, const matrix_base<NumericT>, viennacl::op_reduce_rows<ROP> >(mat, mat);
63  }
64 
65  //column-wise reduction
66  template<typename ROP, typename NumericT>
68  reduce_columns(matrix_base<NumericT> const & mat)
69  {
71  }
72 
73 
74  } // end namespace linalg
75 } // end namespace viennacl
76 #endif
77 
78 
Dispatch facility for distinguishing between ublas, STL and ViennaCL types.
Various little tools used here and there in ViennaCL.
This file provides the forward declarations for the main types used within ViennaCL.
A proxy for scalar expressions (e.g. from inner vector products)
Definition: forwards.h:229
An expression template class that represents a binary operation that yields a vector.
Definition: forwards.h:238
viennacl::vector_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, viennacl::op_reduce_columns< ROP > > reduce_columns(matrix_base< NumericT > const &mat)
Definition: reduce.hpp:68
viennacl::vector_expression< const matrix_base< NumericT >, const matrix_base< NumericT >, viennacl::op_reduce_rows< ROP > > reduce_rows(matrix_base< NumericT > const &mat)
Definition: reduce.hpp:60
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:29
viennacl::scalar_expression< const vector_base< NumericT >, const vector_base< NumericT >, viennacl::op_reduce_vector< OP > > reduce(vector_base< NumericT > const &vector)
Definition: reduce.hpp:39
A collection of compile time type deductions.
Simple enable-if variant that uses the SFINAE pattern.