opm-common
Loading...
Searching...
No Matches
blas_lapack.h
1/*
2 Copyright 2010 SINTEF ICT, Applied Mathematics.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_BLAS_LAPACK_HEADER_INCLUDED
21#define OPM_BLAS_LAPACK_HEADER_INCLUDED
22
23#if ! __has_include(<FCMacros.h>)
24#error "Need FCMacros.h to be generated through FortranCInterface"
25#endif
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <FCMacros.h>
32
33#if defined(MATLAB_MEX_FILE) && MATLAB_MEX_FILE
34#include <mex.h>
35#undef MAT_SIZE_T
36#define MAT_SIZE_T mwSignedIndex
37#endif
38
39#ifndef MAT_SIZE_T
40#define MAT_SIZE_T int
41#endif
42
43
44/* C <- a1*op(A)*op(B) + a2*C where op(X) in {X, X.'} */
45void FC_GLOBAL(dgemm,DGEMM)(const char *transA , const char *transB ,
46 const MAT_SIZE_T* m, const MAT_SIZE_T* n , const MAT_SIZE_T* k ,
47 const double* a1, const double* A , const MAT_SIZE_T* ldA,
48 const double* B, const MAT_SIZE_T* ldB,
49 const double* a2, double* C , const MAT_SIZE_T* ldC);
50
51
52/* C <- a1*A*A' + a2*C *or* C <- a1*A'*A + a2*C */
53void FC_GLOBAL(dsyrk,DSYRK)(const char *uplo, const char *trans,
54 const MAT_SIZE_T *n , const MAT_SIZE_T *k ,
55 const double *a1 , const double *A , const MAT_SIZE_T *ldA,
56 const double *a2 , double *C , const MAT_SIZE_T *ldC);
57
58
59void FC_GLOBAL(dgeqrf,DGERF)(const MAT_SIZE_T *m , const MAT_SIZE_T *n ,
60 double *A , const MAT_SIZE_T *ld ,
61 double *tau , double *work,
62 const MAT_SIZE_T *lwork, MAT_SIZE_T *info);
63
64
65void FC_GLOBAL(dorgqr,DORGQR)(const MAT_SIZE_T *m , const MAT_SIZE_T *n , const MAT_SIZE_T *k ,
66 double *A , const MAT_SIZE_T *ld , const double *tau,
67 double *work, const MAT_SIZE_T *lwork, MAT_SIZE_T *info);
68
69/* A <- LU(A) */
70void FC_GLOBAL(dgetrf,DGETRF)(const MAT_SIZE_T *m , const MAT_SIZE_T *n ,
71 double *A , const MAT_SIZE_T *ld,
72 MAT_SIZE_T *ipiv, MAT_SIZE_T *info);
73
74/* B <- A \ B, when A is LU(A) from dgetrf() */
75void FC_GLOBAL(dgetrs,DGETRS)(const char *trans, const MAT_SIZE_T *n,
76 const MAT_SIZE_T *nrhs ,
77 const double *A , const MAT_SIZE_T *lda,
78 const MAT_SIZE_T *ipiv , double *B,
79 const MAT_SIZE_T *ldb , MAT_SIZE_T *info);
80
81/* B <- A \ B, tridiagonal A with bands DL, D, DU */
82void FC_GLOBAL(dgtsv,DGTSV)(const MAT_SIZE_T *n ,
83 const MAT_SIZE_T *nrhs ,
84 double *DL ,
85 double *D ,
86 double *DU ,
87 double *B ,
88 const MAT_SIZE_T *ldb ,
89 MAT_SIZE_T *info);
90
91/* B <- A \ B, band matrix A stored in AB with kl subdiagonals, ku superdiagonals */
92void FC_GLOBAL(dgbsv,DGBSV)(const MAT_SIZE_T *n ,
93 const MAT_SIZE_T *kl ,
94 const MAT_SIZE_T *ku ,
95 const MAT_SIZE_T *nrhs ,
96 double *AB ,
97 const MAT_SIZE_T *ldab ,
98 MAT_SIZE_T *ipiv ,
99 double *B ,
100 const MAT_SIZE_T *ldb ,
101 MAT_SIZE_T *info);
102
103/* B <- A \ B, general solver */
104void FC_GLOBAL(dgesv,DGESV)(const MAT_SIZE_T *n,
105 const MAT_SIZE_T *nrhs ,
106 double *A ,
107 const MAT_SIZE_T *lda ,
108 MAT_SIZE_T *piv ,
109 double *B ,
110 const MAT_SIZE_T *ldb ,
111 MAT_SIZE_T *info);
112
113/* A <- chol(A) */
114void FC_GLOBAL(dpotrf,DPOTRF)(const char *uplo, const MAT_SIZE_T *n,
115 double *A , const MAT_SIZE_T *lda,
116 MAT_SIZE_T *info);
117
118/* B <- (A \ (A' \ B)), when A=DPOTRF(A_orig) */
119void FC_GLOBAL(dpotrs,DPOTRS)(const char *uplo, const MAT_SIZE_T *n , const MAT_SIZE_T *nrhs,
120 double *A , const MAT_SIZE_T *lda,
121 double *B , const MAT_SIZE_T *ldb, MAT_SIZE_T *info);
122
123/* A <- chol(A), packed format. */
124void FC_GLOBAL(dpptrf,DPOTRF)(const char *uplo, const MAT_SIZE_T *n,
125 double *Ap , MAT_SIZE_T *info);
126
127/* A <- (A \ (A' \ eye(n)) when A=DPPTRF(A_orig) (packed format). */
128void FC_GLOBAL(dpptri,DPPTRI)(const char *uplo, const MAT_SIZE_T *n,
129 double *Ap , MAT_SIZE_T *info);
130
131/* y <- a1*op(A)*x + a2*y */
132void FC_GLOBAL(dgemv,DGEMV)(const char *trans,
133 const MAT_SIZE_T *m , const MAT_SIZE_T *n,
134 const double *a1 , const double *A, const MAT_SIZE_T *ldA ,
135 const double *x, const MAT_SIZE_T *incX,
136 const double *a2 , double *y, const MAT_SIZE_T *incY);
137
138
139/* y <- a*x + y */
140void FC_GLOBAL(daxpy,DAXPY)(const MAT_SIZE_T *n, const double *a,
141 const double *x, const MAT_SIZE_T *incx,
142 double *y, const MAT_SIZE_T *incy);
143
144/* s <- x' * y */
145double FC_GLOBAL(ddot,DDOT)(const MAT_SIZE_T *n, const double *x, const MAT_SIZE_T *incx,
146 const double *y, const MAT_SIZE_T *incy);
147
148
149#ifdef __cplusplus
150}
151#endif
152
153#endif /* OPM_BLAS_LAPACK_HEADER_INCLUDED */