trmm.hpp
Go to the documentation of this file.
1 /*!
2  *
3  *
4  * \brief Triangular Matrix-Matrix multiplication kernel
5  *
6  * \author O. Krause
7  * \date 2012
8  *
9  *
10  * \par Copyright 1995-2014 Shark Developcbment 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 
31 #ifndef REMORA_KERNELS_TRMM_HPP
32 #define REMORA_KERNELS_TRMM_HPP
33 
34 #ifdef REMORA_USE_CBLAS
35 #include "cblas/trmm.hpp"
36 #else
37 // if no bindings are included, we have to provide the default has_optimized_gemv
38 // otherwise the binding will take care of this
39 namespace remora{ namespace bindings{
40 template<class M1, class M2>
41 struct has_optimized_trmm
42 : public std::false_type{};
43 }}
44 #endif
45 
46 #include "default/trmm.hpp"
47 
48 namespace remora{namespace kernels{
49 
50 ///\brief Implements the TRiangular Matrix Matrix multiply.
51 ///
52 /// It computes B=A*B in place, where A is a triangular matrix and B a dense matrix
53 template <bool Upper,bool Unit,typename MatA, typename MatB>
54 void trmm(
55  matrix_expression<MatA, cpu_tag> const &A,
56  matrix_expression<MatB, cpu_tag>& B
57 ){
58  REMORA_SIZE_CHECK(A().size1() == A().size2());
59  REMORA_SIZE_CHECK(A().size1() == B().size1());
60 
61  bindings::trmm<Upper,Unit>(A,B,typename bindings::has_optimized_trmm<MatA, MatB>::type());
62 }
63 
64 }}
65 
66 #ifdef REMORA_USE_CLBLAST
67 #include "clBlast/trmm.hpp"
68 #elif REMORA_USE_GPU
69 #include "gpu/trmm.hpp"
70 #endif
71 
72 #endif