getrf.hpp
Go to the documentation of this file.
1 /*!
2  *
3  *
4  * \brief Dispatches the GETRF algorithm
5  *
6  * \author O. Krause
7  * \date 2016
8  *
9  *
10  * \par Copyright 1995-2014 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 
31 #ifndef REMORA_KERNELS_GETRF_HPP
32 #define REMORA_KERNELS_GETRF_HPP
33 
34 
35 #include "default/getrf.hpp"
36 
37 namespace remora{namespace kernels {
38 
39 ///\brief Implements the GEneral TRiangular matrix Factorisation GETRF.
40 ///
41 /// It is better known as the LU decomposition with partial row-pivoting for dense matrices.
42 /// The algorithm works in place and does not require additional memory.
43 ///
44 /// The algorithm computes
45 /// A = P * L * U
46 ///
47 /// where L is lower unit-triangular and U upper triangular.
48 ///
49 /// The unit diagonal part of L is not stored explicitely. P is a permutation matrix
50 /// where P(i) stores the index of the row that row i is swapped with.
51 template <typename MatA, typename VecP>
52 void getrf(
53  matrix_expression<MatA, cpu_tag>& A,
54  vector_expression<VecP, cpu_tag>& P
55 ) {
56  REMORA_SIZE_CHECK(A().size1() == A().size2());
57  REMORA_SIZE_CHECK(P().size() == A().size1());
58  return bindings::getrf(A,P);
59 }
60 
61 }}
62 #endif