Eigen  5.0.1-dev+master
 
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// This subset has its own guard and does not define _LAPACKE_H_, so that a system <lapacke.h> included after it still
37// declares the full API. Nothing here conflicts with a later system header; if the system (or MKL) header was included
38// first, this subset is skipped.
39#if !defined(_MKL_LAPACKE_H_) && !defined(_LAPACKE_H_) && !defined(EIGEN_LAPACKE_SUBSET_H_)
40#define EIGEN_LAPACKE_SUBSET_H_
41
42#ifdef HAVE_LAPACK_CONFIG_H
43#include "lapacke_config.h"
44#endif
45
46#include <stdlib.h>
47
48#ifndef lapack_int
49#ifdef LAPACK_ILP64
50#define lapack_int int64_t
51#else
52#define lapack_int int
53#endif
54#endif
55
56#ifndef lapack_logical
57#define lapack_logical lapack_int
58#endif
59
60#ifndef LAPACK_COMPLEX_CUSTOM
61
62#ifndef lapack_complex_float
63#define lapack_complex_float std::complex<float>
64#endif
65
66#ifndef lapack_complex_float_real
67#define lapack_complex_float_real(z) (creal(z))
68#endif
69
70#ifndef lapack_complex_float_imag
71#define lapack_complex_float_imag(z) (cimag(z))
72#endif
73
74#ifndef lapack_complex_double
75#define lapack_complex_double std::complex<double>
76#endif
77
78#ifndef lapack_complex_double_real
79#define lapack_complex_double_real(z) (creal(z))
80#endif
81
82#ifndef lapack_complex_double_imag
83#define lapack_complex_double_imag(z) (cimag(z))
84#endif
85
86#endif
87
88#ifdef __cplusplus
89extern "C" {
90#endif /* __cplusplus */
91
92#ifndef LAPACKE_malloc
93#define LAPACKE_malloc(size) malloc(size)
94#endif
95#ifndef LAPACKE_free
96#define LAPACKE_free(p) free(p)
97#endif
98
99#define LAPACK_ROW_MAJOR 101
100#define LAPACK_COL_MAJOR 102
101
102#define LAPACK_WORK_MEMORY_ERROR -1010
103#define LAPACK_TRANSPOSE_MEMORY_ERROR -1011
104
105/* Callback logical functions used to select eigenvalues for Schur form. */
106
107typedef lapack_logical (*LAPACK_S_SELECT2)(const float*, const float*);
108typedef lapack_logical (*LAPACK_S_SELECT3)(const float*, const float*, const float*);
109typedef lapack_logical (*LAPACK_D_SELECT2)(const double*, const double*);
110typedef lapack_logical (*LAPACK_D_SELECT3)(const double*, const double*, const double*);
111
112typedef lapack_logical (*LAPACK_C_SELECT1)(const lapack_complex_float*);
113typedef lapack_logical (*LAPACK_C_SELECT2)(const lapack_complex_float*, const lapack_complex_float*);
114typedef lapack_logical (*LAPACK_Z_SELECT1)(const lapack_complex_double*);
115typedef lapack_logical (*LAPACK_Z_SELECT2)(const lapack_complex_double*, const lapack_complex_double*);
116
117#include "lapacke_mangling.h"
118
119/*
120 * LAPACKE function prototypes used by Eigen.
121 *
122 * Only the subset of LAPACKE routines that Eigen actually calls is declared
123 * here. For the full LAPACKE API, include your system's <lapacke.h> either
124 * before or after the Eigen headers, or define EIGEN_LAPACKE_SYSTEM before
125 * including Eigen to make Eigen include the system header instead of this
126 * bundled subset.
127 */
128
129/* Schur decomposition (gees) — used by RealSchur_LAPACKE.h, ComplexSchur_LAPACKE.h */
130lapack_int LAPACKE_sgees(int matrix_order, char jobvs, char sort, LAPACK_S_SELECT2 select, lapack_int n, float* a,
131 lapack_int lda, lapack_int* sdim, float* wr, float* wi, float* vs, lapack_int ldvs);
132lapack_int LAPACKE_dgees(int matrix_order, char jobvs, char sort, LAPACK_D_SELECT2 select, lapack_int n, double* a,
133 lapack_int lda, lapack_int* sdim, double* wr, double* wi, double* vs, lapack_int ldvs);
134lapack_int LAPACKE_cgees(int matrix_order, char jobvs, char sort, LAPACK_C_SELECT1 select, lapack_int n,
135 lapack_complex_float* a, lapack_int lda, lapack_int* sdim, lapack_complex_float* w,
136 lapack_complex_float* vs, lapack_int ldvs);
137lapack_int LAPACKE_zgees(int matrix_order, char jobvs, char sort, LAPACK_Z_SELECT1 select, lapack_int n,
138 lapack_complex_double* a, lapack_int lda, lapack_int* sdim, lapack_complex_double* w,
139 lapack_complex_double* vs, lapack_int ldvs);
140
141/* QR with column pivoting (geqp3) — used by ColPivHouseholderQR_LAPACKE.h */
142lapack_int LAPACKE_sgeqp3(int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* jpvt,
143 float* tau);
144lapack_int LAPACKE_dgeqp3(int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* jpvt,
145 double* tau);
146lapack_int LAPACKE_cgeqp3(int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda,
147 lapack_int* jpvt, lapack_complex_float* tau);
148lapack_int LAPACKE_zgeqp3(int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda,
149 lapack_int* jpvt, lapack_complex_double* tau);
150
151/* QR factorization (geqrf) — used by HouseholderQR_LAPACKE.h */
152lapack_int LAPACKE_sgeqrf(int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, float* tau);
153lapack_int LAPACKE_dgeqrf(int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, double* tau);
154lapack_int LAPACKE_cgeqrf(int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda,
155 lapack_complex_float* tau);
156lapack_int LAPACKE_zgeqrf(int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda,
157 lapack_complex_double* tau);
158
159/* SVD via divide-and-conquer (gesdd) — used by BDCSVD_LAPACKE.h */
160lapack_int LAPACKE_sgesdd(int matrix_order, char jobz, lapack_int m, lapack_int n, float* a, lapack_int lda, float* s,
161 float* u, lapack_int ldu, float* vt, lapack_int ldvt);
162lapack_int LAPACKE_dgesdd(int matrix_order, char jobz, lapack_int m, lapack_int n, double* a, lapack_int lda, double* s,
163 double* u, lapack_int ldu, double* vt, lapack_int ldvt);
164lapack_int LAPACKE_cgesdd(int matrix_order, char jobz, lapack_int m, lapack_int n, lapack_complex_float* a,
165 lapack_int lda, float* s, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* vt,
166 lapack_int ldvt);
167lapack_int LAPACKE_zgesdd(int matrix_order, char jobz, lapack_int m, lapack_int n, lapack_complex_double* a,
168 lapack_int lda, double* s, lapack_complex_double* u, lapack_int ldu,
169 lapack_complex_double* vt, lapack_int ldvt);
170
171/* SVD (gesvd) — used by JacobiSVD_LAPACKE.h */
172lapack_int LAPACKE_sgesvd(int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, float* a, lapack_int lda,
173 float* s, float* u, lapack_int ldu, float* vt, lapack_int ldvt, float* superb);
174lapack_int LAPACKE_dgesvd(int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, double* a,
175 lapack_int lda, double* s, double* u, lapack_int ldu, double* vt, lapack_int ldvt,
176 double* superb);
177lapack_int LAPACKE_cgesvd(int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, lapack_complex_float* a,
178 lapack_int lda, float* s, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* vt,
179 lapack_int ldvt, float* superb);
180lapack_int LAPACKE_zgesvd(int matrix_order, char jobu, char jobvt, lapack_int m, lapack_int n, lapack_complex_double* a,
181 lapack_int lda, double* s, lapack_complex_double* u, lapack_int ldu,
182 lapack_complex_double* vt, lapack_int ldvt, double* superb);
183
184/* LU factorization (getrf) — used by PartialPivLU_LAPACKE.h */
185lapack_int LAPACKE_sgetrf(int matrix_order, lapack_int m, lapack_int n, float* a, lapack_int lda, lapack_int* ipiv);
186lapack_int LAPACKE_dgetrf(int matrix_order, lapack_int m, lapack_int n, double* a, lapack_int lda, lapack_int* ipiv);
187lapack_int LAPACKE_cgetrf(int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda,
188 lapack_int* ipiv);
189lapack_int LAPACKE_zgetrf(int matrix_order, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda,
190 lapack_int* ipiv);
191
192/* Cholesky factorization (potrf) — used by LLT_LAPACKE.h */
193lapack_int LAPACKE_spotrf(int matrix_order, char uplo, lapack_int n, float* a, lapack_int lda);
194lapack_int LAPACKE_dpotrf(int matrix_order, char uplo, lapack_int n, double* a, lapack_int lda);
195lapack_int LAPACKE_cpotrf(int matrix_order, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda);
196lapack_int LAPACKE_zpotrf(int matrix_order, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda);
197
198/* Symmetric/Hermitian eigenvalues (syev/heev) — used by SelfAdjointEigenSolver_LAPACKE.h */
199lapack_int LAPACKE_ssyev(int matrix_order, char jobz, char uplo, lapack_int n, float* a, lapack_int lda, float* w);
200lapack_int LAPACKE_dsyev(int matrix_order, char jobz, char uplo, lapack_int n, double* a, lapack_int lda, double* w);
201lapack_int LAPACKE_cheev(int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda,
202 float* w);
203lapack_int LAPACKE_zheev(int matrix_order, char jobz, char uplo, lapack_int n, lapack_complex_double* a, lapack_int lda,
204 double* w);
205
206#ifdef __cplusplus
207}
208#endif /* __cplusplus */
209
210#endif /* EIGEN_LAPACKE_SUBSET_H_ */