potrs.h
Go to the documentation of this file.
1 //===========================================================================
2 /*!
3  * \author O. Krause
4  * \date 2011
5  *
6  * \par Copyright (c) 1998-2011:
7  * Institut f&uuml;r Neuroinformatik<BR>
8  * Ruhr-Universit&auml;t Bochum<BR>
9  * D-44780 Bochum, Germany<BR>
10  * Phone: +49-234-32-25558<BR>
11  * Fax: +49-234-32-14209<BR>
12  * eMail: Shark-admin@neuroinformatik.ruhr-uni-bochum.de<BR>
13  * www: http://www.neuroinformatik.ruhr-uni-bochum.de<BR>
14  * <BR>
15  *
16  *
17  * <BR><HR>
18  * This file is part of Shark. This library is free software;
19  * you can redistribute it and/or modify it under the terms of the
20  * GNU General Public License as published by the Free Software
21  * Foundation; either version 3, or (at your option) any later version.
22  *
23  * This library is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this library; if not, see <http://www.gnu.org/licenses/>.
30  *
31  */
32 //===========================================================================
33 // Based on the boost::numeric bindings
34 /*
35  *
36  * Copyright (c) Kresimir Fresl 2002
37  *
38  * Distributed under the Boost Software License, Version 1.0.
39  * (See accompanying file LICENSE_1_0.txt or copy at
40  * http://www.boost.org/LICENSE_1_0.txt)
41  *
42  * Author acknowledges the support of the Faculty of Civil Engineering,
43  * University of Zagreb, Croatia.
44  *
45  */
46 
47 #ifndef SHARK_LINALG_IMPL_NUMERIC_BINDINGS_ATLAS_POTRS_H
48 #define SHARK_LINALG_IMPL_NUMERIC_BINDINGS_ATLAS_POTRS_H
49 #include "cblas_inc.h"
50 
51 namespace shark {namespace detail {namespace bindings {
52 
53 inline int potrs(CBLAS_ORDER Order, CBLAS_UPLO Uplo,
54  int N, int NRHS,
55  float const *A, int lda, float *B, int ldb
56 ){
57  return clapack_spotrs(Order, Uplo, N, NRHS, A, lda, B, ldb);
58 }
59 
60 inline int potrs(CBLAS_ORDER Order, CBLAS_UPLO Uplo,
61  int N, int NRHS,
62  double const *A, int lda, double *B, int ldb
63 ){
64  return clapack_dpotrs(Order, Uplo, N, NRHS, A, lda, B, ldb);
65 }
66 
67 inline int potrs(CBLAS_ORDER Order, CBLAS_UPLO Uplo,
68  int N, int NRHS,
69  std::complex<float> const *A, int lda,
70  std::complex<float> *B, int ldb
71 ){
72  return clapack_cpotrs(Order, Uplo, N, NRHS,
73  static_cast<void const *>(A), lda,
74  static_cast<void *>(B), ldb
75  );
76 }
77 
78 inline int potrs(CBLAS_ORDER Order, CBLAS_UPLO Uplo,
79  int N, int NRHS,
80  std::complex<double> const *A, int lda,
81  std::complex<double> *B, int ldb
82 ) {
83  return clapack_zpotrs(Order, Uplo, N, NRHS,
84  static_cast<void const *>(A), lda,
85  static_cast<void *>(B), ldb
86  );
87 }
88 
89 // potrs(): solves a system of linear equations A * X = B
90 // using the Cholesky factorization computed by potrf()
91 template <typename SymmA, typename MatrB>
93  CBLAS_ORDER stor_ord= (CBLAS_ORDER)storage_order<typename SymmA::orientation_category>::value;
94 
95  SIZE_CHECK(a().size1() == a().size2());
96 
97  int n = a().size1();
98  int nrhs = b().size1();
99 
100  SIZE_CHECK(a().size1() == b().size1());
101 
102  return potrs(stor_ord, uplo, n, nrhs,
107 }
108 
109 }}}
110 #endif