potrf.hpp
Go to the documentation of this file.
1 /*!
2  *
3  *
4  * \brief Dispatches the POTRF algorithm
5  *
6  * \author O. Krause
7  * \date 2012
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 SHARK_LINALG_BLAS_KERNELS_POTRF_HPP
32 #define SHARK_LINALG_BLAS_KERNELS_POTRF_HPP
33 
34 #ifdef SHARK_USE_ATLAS_LAPACK
35 #include "atlas/potrf.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 shark {
40 namespace blas {
41 namespace bindings {
42 template<class M>
43 struct has_optimized_potrf
44  : public boost::mpl::false_ {};
45 }
46 }
47 }
48 #endif
49 
50 #include "default/potrf.hpp"
51 
52 namespace shark {
53 namespace blas {
54 namespace kernels {
55 
56 ///\brief Implements the POsitive TRiangular matrix Factorisation POTRF.
57 ///
58 /// It is better known as the cholesky decomposition for dense matrices.
59 /// The algorithm works in place and does not require additional memory.
60 template <class Triangular, typename MatA>
61 std::size_t potrf(
63 ) {
64  SIZE_CHECK(A().size1() == A().size2());
65  return bindings::potrf<Triangular>(A, typename bindings::has_optimized_potrf<MatA>::type());
66 }
67 
68 }
69 }
70 }
71 
72 #endif