Eigen  5.0.1
 
Loading...
Searching...
No Matches
lapacke.h
1/*****************************************************************************
2 Copyright (c) 2010, Intel Corp.
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 may be used to endorse or promote products derived from this software
15 without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 THE POSSIBILITY OF SUCH DAMAGE.
28******************************************************************************
29* Contents: Native C interface to LAPACK (subset used by Eigen)
30* Author: Intel Corporation
31* Generated November, 2011
32* Modified: stripped to the subset of declarations actually used by Eigen.
33*****************************************************************************/
34// SPDX-License-Identifier: BSD-3-Clause
35
36#ifndef _MKL_LAPACKE_H_
37
38#ifndef _LAPACKE_H_
39#define _LAPACKE_H_
40
41#ifdef HAVE_LAPACK_CONFIG_H
42#include "lapacke_config.h"
43#endif
44
45#include <stdlib.h>
46
47#ifndef lapack_int
48#ifdef LAPACK_ILP64
49#define lapack_int int64_t
50#else
51#define lapack_int int
52#endif
53#endif
54
55#ifndef lapack_logical
56#define lapack_logical lapack_int
57#endif
58
59#ifndef LAPACK_COMPLEX_CUSTOM
60
61#ifndef lapack_complex_float
62#define lapack_complex_float std::complex<float>
63#endif
64
65#ifndef lapack_complex_float_real
66#define lapack_complex_float_real(z) (creal(z))
67#endif
68
69#ifndef lapack_complex_float_imag
70#define lapack_complex_float_imag(z) (cimag(z))
71#endif
72
73lapack_complex_float lapack_make_complex_float(float re, float im);
74
75#ifndef lapack_complex_double
76#define lapack_complex_double std::complex<double>
77#endif
78
79#ifndef lapack_complex_double_real
80#define lapack_complex_double_real(z) (creal(z))
81#endif
82
83#ifndef lapack_complex_double_imag
84#define lapack_complex_double_imag(z) (cimag(z))
85#endif
86
87lapack_complex_double lapack_make_complex_double(double re, double im);
88
89#endif
90
91#ifdef __cplusplus
92extern "C" {
93#endif /* __cplusplus */
94
95#ifndef LAPACKE_malloc
96#define LAPACKE_malloc(size) malloc(size)
97#endif
98#ifndef LAPACKE_free
99#define LAPACKE_free(p) free(p)
100#endif
101
102#define LAPACK_C2INT(x) (lapack_int)(*((float*)&x))
103#define LAPACK_Z2INT(x) (lapack_int)(*((double*)&x))
104
105#define LAPACK_ROW_MAJOR 101
106#define LAPACK_COL_MAJOR 102
107
108#define LAPACK_WORK_MEMORY_ERROR -1010
109#define LAPACK_TRANSPOSE_MEMORY_ERROR -1011
110
111/* Callback logical functions used to select eigenvalues for Schur form. */
112
113typedef lapack_logical (*LAPACK_S_SELECT2)(const float*, const float*);
114typedef lapack_logical (*LAPACK_S_SELECT3)(const float*, const float*, const float*);
115typedef lapack_logical (*LAPACK_D_SELECT2)(const double*, const double*);
116typedef lapack_logical (*LAPACK_D_SELECT3)(const double*, const double*, const double*);
117
118typedef lapack_logical (*LAPACK_C_SELECT1)(const lapack_complex_float*);
119typedef lapack_logical (*LAPACK_C_SELECT2)(const lapack_complex_float*, const lapack_complex_float*);
120typedef lapack_logical (*LAPACK_Z_SELECT1)(const lapack_complex_double*);
121typedef lapack_logical (*LAPACK_Z_SELECT2)(const lapack_complex_double*, const lapack_complex_double*);
122
123#include "lapacke_mangling.h"
124
125#define LAPACK_lsame LAPACK_GLOBAL(lsame, LSAME)
126lapack_logical LAPACK_lsame(char* ca, char* cb, lapack_int lca, lapack_int lcb);
127
128/*
129 * LAPACKE function prototypes used by Eigen.
130 *
131 * Only the subset of LAPACKE routines that Eigen actually calls is declared
132 * here. If you need the full LAPACKE API, include your system's <lapacke.h>
133 * after including Eigen headers, or define EIGEN_LAPACKE_SYSTEM before
134 * including Eigen to use the system header instead of this bundled subset.
135 */
136
137/* Schur decomposition (gees) — used by RealSchur_LAPACKE.h, ComplexSchur_LAPACKE.h */
138lapack_int LAPACKE_sgees(int matrix_order, char jobvs, char sort, LAPACK_S_SELECT2 select, lapack_int n, float* a,
139 lapack_int lda, lapack_int* sdim, float* wr, float* wi, float* vs, lapack_int ldvs);
140lapack_int LAPACKE_dgees(int matrix_order, char jobvs, char sort, LAPACK_D_SELECT2 select, lapack_int n, double* a,
141 lapack_int lda, lapack_int* sdim, double* wr, double* wi, double* vs, lapack_int ldvs);
142lapack_int LAPACKE_cgees(int matrix_order, char jobvs, char sort, LAPACK_C_SELECT1 select, lapack_int n,
143 lapack_complex_float* a, lapack_int lda, lapack_int* sdim, lapack_complex_float* w,
144 lapack_complex_float* vs, lapack_int ldvs);
145lapack_int LAPACKE_zgees(int matrix_order, char jobvs, char sort, LAPACK_Z_SELECT1 select, lapack_int n,
146 lapack_complex_double* a, lapack_int lda, lapack_int* sdim, lapack_complex_double* w,
147 lapack_complex_double* vs, lapack_int ldvs);
148
149/* QR with column pivoting (geqp3) — used by ColPivHouseholderQR_LAPACKE.h */
150lapack_int LAPACKE_sgeqp3(int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* jpvt,
151 float* tau);
152lapack_int LAPACKE_dgeqp3(int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* jpvt,
153 double* tau);
154lapack_int LAPACKE_cgeqp3(int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda,
155 lapack_int* jpvt, lapack_complex_float* tau);
156lapack_int LAPACKE_zgeqp3(int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda,
157 lapack_int* jpvt, lapack_complex_double* tau);
158
159/* QR factorization (geqrf) — used by HouseholderQR_LAPACKE.h */
160lapack_int LAPACKE_sgeqrf(int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau);
161lapack_int LAPACKE_dgeqrf(int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau);
162lapack_int LAPACKE_cgeqrf(int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda,
163 lapack_complex_float* tau);
164lapack_int LAPACKE_zgeqrf(int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda,
165 lapack_complex_double* tau);
166
167/* SVD via divide-and-conquer (gesdd) — used by BDCSVD_LAPACKE.h */
168lapack_int LAPACKE_sgesdd(int matrix_order, char jobz, lapack_int m, lapack_int n, float* a, lapack_int lda, float* s,
169 float* u, lapack_int ldu, float* vt, lapack_int ldvt);
170lapack_int LAPACKE_dgesdd(int matrix_order, char jobz, lapack_int m, lapack_int n, double* a, lapack_int lda, double* s,
171 double* u, lapack_int ldu, double* vt, lapack_int ldvt);
172lapack_int LAPACKE_cgesdd(int matrix_order, char jobz, lapack_int m, lapack_int n, lapack_complex_float* a,
173 lapack_int lda, float* s, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* vt,
174 lapack_int ldvt);
175lapack_int LAPACKE_zgesdd(int matrix_order, char jobz, lapack_int m, lapack_int n, lapack_complex_double* a,
176 lapack_int lda, double* s, lapack_complex_double* u, lapack_int ldu,
177 lapack_complex_double* vt, lapack_int ldvt);
178
179/* SVD (gesvd) — used by JacobiSVD_LAPACKE.h */
180lapack_int LAPACKE_sgesvd(int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, float* a, lapack_int lda,
181 float* s, float* u, lapack_int ldu, float* vt, lapack_int ldvt, float* superb);
182lapack_int LAPACKE_dgesvd(int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, double* a,
183 lapack_int lda, double* s, double* u, lapack_int ldu, double* vt, lapack_int ldvt,
184 double* superb);
185lapack_int LAPACKE_cgesvd(int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, lapack_complex_float* a,
186 lapack_int lda, float* s, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* vt,
187 lapack_int ldvt, float* superb);
188lapack_int LAPACKE_zgesvd(int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, lapack_complex_double* a,
189 lapack_int lda, double* s, lapack_complex_double* u, lapack_int ldu,
190 lapack_complex_double* vt, lapack_int ldvt, double* superb);
191
192/* LU factorization (getrf) — used by PartialPivLU_LAPACKE.h */
193lapack_int LAPACKE_sgetrf(int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* ipiv);
194lapack_int LAPACKE_dgetrf(int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* ipiv);
195lapack_int LAPACKE_cgetrf(int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda,
196 lapack_int* ipiv);
197lapack_int LAPACKE_zgetrf(int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda,
198 lapack_int* ipiv);
199
200/* Cholesky factorization (potrf) — used by LLT_LAPACKE.h */
201lapack_int LAPACKE_spotrf(int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda);
202lapack_int LAPACKE_dpotrf(int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda);
203lapack_int LAPACKE_cpotrf(int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda);
204lapack_int LAPACKE_zpotrf(int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda);
205
206/* Symmetric/Hermitian eigenvalues (syev/heev) — used by SelfAdjointEigenSolver_LAPACKE.h */
207lapack_int LAPACKE_ssyev(int matrix_order, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* w);
208lapack_int LAPACKE_dsyev(int matrix_order, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* w);
209lapack_int LAPACKE_cheev(int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda,
210 float* w);
211lapack_int LAPACKE_zheev(int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda,
212 double* w);
213
214#ifdef __cplusplus
215}
216#endif /* __cplusplus */
217
218#endif /* _LAPACKE_H_ */
219
220#endif /* _MKL_LAPACKE_H_ */