DenseLinAlgPack: Concreate C++ Classes for Dense Blas-Compatible Linear Algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DenseLinAlgPack_LAPACK_Cpp.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef LAPACK_CPP_H
43 #define LAPACK_CPP_H
44 
45 #include "DenseLinAlgPack_LAPACK_C_Decl.hpp"
46 #include "DenseLinAlgPack_BLAS_Cpp.hpp"
47 
48 // Cpp Declarations for calling LAPACK functions that
49 // use function overloading to remove the floating point
50 // typeds from the names and use enumerations to replace
51 // the char arguments.
52 
53 namespace LAPACK_Cpp {
54 
55 typedef FortranTypes::f_int f_int;
56 typedef FortranTypes::f_real f_real;
57 typedef FortranTypes::f_dbl_prec f_dbl_prec;
58 typedef FortranTypes::f_logical f_logical;
59 
60 // xPOTRF
61 
62 inline
64 void potrf( BLAS_Cpp::Uplo uplo
65  , const f_int& n, f_dbl_prec* A, const f_int& lda
66  , f_int* info )
67 {
68  LAPACK_C_Decl::dpotrf( BLAS_Cpp::UploChar[uplo]
69  ,n ,A ,lda ,info );
70 }
71 
72 // xGEQRF
73 
74 inline
76 void geqrf( const f_int& m
77  , const f_int& n, f_dbl_prec* A, const f_int& lda
78  , f_dbl_prec* tau, f_dbl_prec* work
79  , const f_int& lwork, f_int* info )
80 {
81  LAPACK_C_Decl::dgeqrf(m,n,A,lda,tau,work,lwork,info);
82 }
83 
84 // xORMQR
85 
86 inline
88 void ormqr( BLAS_Cpp::Side side, BLAS_Cpp::Transp trans
89  , const f_int& m, const f_int& n
90  , const f_int& k, const f_dbl_prec* A, const f_int& lda
91  , const f_dbl_prec* tau, f_dbl_prec* C, const f_int& ldc
92  , f_dbl_prec* work, const f_int& lwork, f_int* info )
93 {
94  LAPACK_C_Decl::dormqr( BLAS_Cpp::SideChar[side]
95  , BLAS_Cpp::TransChar[trans], m, n, k, A, lda
96  , tau, C, ldc, work, lwork, info );
97 
98 }
99 
100 // xSYTRF
101 
102 inline
103 //
104 void sytrf( BLAS_Cpp::Uplo uplo, const f_int& n, f_dbl_prec A[]
105  , const f_int& lda, f_int ipiv[], f_dbl_prec work[], const f_int& lwork
106  , f_int* info )
107 {
108  LAPACK_C_Decl::dsytrf( BLAS_Cpp::UploChar[uplo]
109  , n, A, lda, ipiv, work, lwork, info );
110 }
111 
112 // xSYTRS
113 
114 inline
116 void sytrs( BLAS_Cpp::Uplo uplo
117  , const f_int& n, const f_int& nrhs, const f_dbl_prec A[]
118  , const f_int& lda, const f_int ipiv[], f_dbl_prec B[]
119  , const f_int& ldb, f_int* info )
120 {
121  LAPACK_C_Decl::dsytrs( BLAS_Cpp::UploChar[uplo]
122  , n, nrhs, A, lda, ipiv, B, ldb, info );
123 }
124 
125 // xGETRF
126 
127 inline
128 //
129 void getrf(
130  const f_int& m, const f_int& n, f_dbl_prec A[]
131  ,const f_int& lda, f_int ipiv[], f_int* info )
132 {
133  LAPACK_C_Decl::dgetrf( m, n, A, lda, ipiv, info );
134 }
135 
136 // xGETRS
137 
138 inline
140 void getrs(
142  ,const f_int& n, const f_int& nrhs, const f_dbl_prec A[]
143  , const f_int& lda, const f_int ipiv[], f_dbl_prec B[]
144  , const f_int& ldb, f_int* info )
145 {
146  LAPACK_C_Decl::dgetrs(
147  BLAS_Cpp::TransChar[trans], n, nrhs, A, lda, ipiv, B, ldb, info
148  );
149 }
150 
151 } // end namespace LAPACK_Cpp
152 
153 #endif // LAPACK_CPP_H
Uplo
Side
Transp