PEXSI
 All Classes Namespaces Files Functions Variables Friends Pages
lapack.hpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012 The Regents of the University of California,
3  through Lawrence Berkeley National Laboratory.
4 
5  Authors: Jack Poulson and Lin Lin
6 
7  This file is part of PEXSI. All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions are met:
11 
12  (1) Redistributions of source code must retain the above copyright notice, this
13  list of conditions and the following disclaimer.
14  (2) Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation
16  and/or other materials provided with the distribution.
17  (3) Neither the name of the University of California, Lawrence Berkeley
18  National Laboratory, U.S. Dept. of Energy nor the names of its contributors may
19  be used to endorse or promote products derived from this software without
20  specific prior written permission.
21 
22  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
26  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33  You are under no obligation whatsoever to provide any bug fixes, patches, or
34  upgrades to the features, functionality or performance of the source code
35  ("Enhancements") to anyone; however, if you choose to make your Enhancements
36  available either publicly, or directly to Lawrence Berkeley National
37  Laboratory, without imposing a separate written license agreement for such
38  Enhancements, then you hereby grant the following license: a non-exclusive,
39  royalty-free perpetual license to install, use, modify, prepare derivative
40  works, incorporate into other computer software, distribute, and sublicense
41  such enhancements or derivative works thereof, in binary and source code form.
42 */
46 #include "environment.hpp"
47 
48 namespace PEXSI {
49 
53 namespace lapack {
54 
55  typedef int Int;
56  typedef std::complex<float> scomplex;
57  typedef std::complex<double> dcomplex;
58 
59 
60  // *********************************************************************
61  // Cholesky factorization
62  // *********************************************************************
63 
64  void Potrf( char uplo, Int n, const float* A, Int lda );
65  void Potrf( char uplo, Int n, const double* A, Int lda );
66  void Potrf( char uplo, Int n, const scomplex* A, Int lda );
67  void Potrf( char uplo, Int n, const dcomplex* A, Int lda );
68 
69 
70  // *********************************************************************
71  // LU factorization (with partial pivoting)
72  // *********************************************************************
73 
74  void Getrf( Int m, Int n, float* A, Int lda, Int* p );
75  void Getrf( Int m, Int n, double* A, Int lda, Int* p );
76  void Getrf( Int m, Int n, scomplex* A, Int lda, Int* p );
77  void Getrf( Int m, Int n, dcomplex* A, Int lda, Int* p );
78 
79  // *********************************************************************
80  // For reducing well-conditioned Hermitian generalized-definite EVP's
81  // to standard form.
82  // *********************************************************************
83 
84  void Hegst
85  ( Int itype, char uplo,
86  Int n, float* A, Int lda, const float* B, Int ldb );
87  void Hegst
88  ( Int itype, char uplo,
89  Int n, double* A, Int lda, const double* B, Int ldb );
90  void Hegst
91  ( Int itype, char uplo,
92  Int n, scomplex* A, Int lda, const scomplex* B, Int ldb );
93  void Hegst
94  ( Int itype, char uplo,
95  Int n, dcomplex* A, Int lda, const dcomplex* B, Int ldb );
96 
97  // *********************************************************************
98  // For solving the standard eigenvalue problem using the divide and
99  // conquer algorithm
100  // *********************************************************************
101 
102  void Syevd
103  ( char jobz, char uplo, Int n, double* A, Int lda, double* eigs );
104 
105  // *********************************************************************
106  // For solving the generalized eigenvalue problem using the divide and
107  // conquer algorithm
108  // *********************************************************************
109 
110  void Sygvd
111  ( int itype, char jobz, char uplo, Int n, double* A, Int lda,
112  double* B, Int ldb, double* eigs );
113 
114 
115 
116  // *********************************************************************
117  // For computing the inverse of a triangular matrix
118  // *********************************************************************
119 
120  void Trtri
121  ( char uplo, char diag, Int n, const float* A, Int lda );
122  void Trtri
123  ( char uplo, char diag, Int n, const double* A, Int lda );
124  void Trtri
125  ( char uplo, char diag, Int n, const scomplex* A, Int lda );
126  void Trtri
127  ( char uplo, char diag, Int n, const dcomplex* A, Int lda );
128 
129 
130  // *********************************************************************
131  // Compute the SVD of a general matrix using a divide and conquer algorithm
132  // *********************************************************************
133 
134  void DivideAndConquerSVD
135  ( Int m, Int n, float* A, Int lda,
136  float* s, float* U, Int ldu, float* VTrans, Int ldvt );
137  void DivideAndConquerSVD
138  ( Int m, Int n, double* A, Int lda,
139  double* s, double* U, Int ldu, double* VTrans, Int ldvt );
140  void DivideAndConquerSVD
141  ( Int m, Int n, scomplex* A, Int lda,
142  float* s, scomplex* U, Int ldu, scomplex* VAdj, Int ldva );
143  void DivideAndConquerSVD
144  ( Int m, Int n, dcomplex* A, Int lda,
145  double* s, dcomplex* U, Int ldu, dcomplex* VAdj, Int ldva );
146 
147  //
148  // Compute the SVD of a general matrix using the QR algorithm
149  //
150 
151  void QRSVD
152  ( Int m, Int n, float* A, Int lda,
153  float* s, float* U, Int ldu, float* VTrans, Int ldvt );
154  void QRSVD
155  ( Int m, Int n, double* A, Int lda,
156  double* s, double* U, Int ldu, double* VTrans, Int ldvt );
157  void QRSVD
158  ( Int m, Int n, scomplex* A, Int lda,
159  float* s, scomplex* U, Int ldu, scomplex* VAdj, Int ldva );
160  void QRSVD
161  ( Int m, Int n, dcomplex* A, Int lda,
162  double* s, dcomplex* U, Int ldu, dcomplex* VAdj, Int ldva );
163 
164 
165  // *********************************************************************
166  // Compute the singular values of a general matrix using the QR algorithm
167  // *********************************************************************
168 
169  void SingularValues( Int m, Int n, float* A, Int lda, float* s );
170  void SingularValues( Int m, Int n, double* A, Int lda, double* s );
171  void SingularValues( Int m, Int n, scomplex* A, Int lda, float* s );
172  void SingularValues( Int m, Int n, dcomplex* A, Int lda, double* s );
173 
174  // *********************************************************************
175  // Compute the SVD of a bidiagonal matrix using the QR algorithm
176  // *********************************************************************
177 
178  void BidiagQRAlg
179  ( char uplo, Int n, Int numColsVTrans, Int numRowsU,
180  float* d, float* e, float* VTrans, Int ldVTrans, float* U, Int ldU );
181  void BidiagQRAlg
182  ( char uplo, Int n, Int numColsVTrans, Int numRowsU,
183  double* d, double* e, double* VTrans, Int ldVTrans, double* U, Int ldU );
184  void BidiagQRAlg
185  ( char uplo, Int n, Int numColsVAdj, Int numRowsU,
186  float* d, float* e, scomplex* VAdj, Int ldVAdj, scomplex* U, Int ldU );
187  void BidiagQRAlg
188  ( char uplo, Int n, Int numColsVAdj, Int numRowsU,
189  double* d, double* e, dcomplex* VAdj, Int ldVAdj, dcomplex* U, Int ldU );
190 
191  // *********************************************************************
192  // Compute the linear least square problem using SVD
193  // *********************************************************************
194  void SVDLeastSquare( Int m, Int n, Int nrhs, float * A, Int lda,
195  float * B, Int ldb, float * S, float rcond,
196  Int* rank );
197  void SVDLeastSquare( Int m, Int n, Int nrhs, double * A, Int lda,
198  double * B, Int ldb, double * S, double rcond,
199  Int* rank );
200  void SVDLeastSquare( Int m, Int n, Int nrhs, scomplex * A, Int lda,
201  scomplex * B, Int ldb, float * S, float rcond,
202  Int* rank );
203  void SVDLeastSquare( Int m, Int n, Int nrhs, dcomplex * A, Int lda,
204  dcomplex * B, Int ldb, double * S, double rcond,
205  Int* rank );
206 
207  // *********************************************************************
208  // Copy
209  // *********************************************************************
210 
211  void Lacpy( char uplo, Int m, Int n, const double* A, Int lda,
212  double* B, Int ldb );
213 
214  void Lacpy( char uplo, Int m, Int n, const dcomplex* A, Int lda,
215  dcomplex* B, Int ldb );
216 
217  // *********************************************************************
218  // Inverting a factorized matrix: Getri
219  // *********************************************************************
220 
221 
222  void Getri ( Int n, double* A, Int lda, const Int* ipiv );
223 
224  void Getri ( Int n, dcomplex* A, Int lda, const Int* ipiv );
225 
226 
227 } // namespace lapack
228 } // namespace PEXSI
Environmental variables.