Debian Codegraph @

3rdparty/dissection/src/Driver/C_BlasRoutines.hpp

raw
1 /*! \file C_BlasRoutines.hpp
2 \brief factorization routines LDL^t, LDU, forward/backward substitution
3 \author François-Xavier Roux, ONERA, Laboratoire Jacques-Louis Lions
4 \author Atsushi Suzuki, Laboratoire Jacques-Louis Lions
5 \date Jul. 12th 2015
6 \date Nov. 30th 2016
7 */
8
9 // This file is part of Dissection
10 //
11 // Dissection is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // Linking Dissection statically or dynamically with other modules is making
17 // a combined work based on Disssection. Thus, the terms and conditions of
18 // the GNU General Public License cover the whole combination.
19 //
20 // As a special exception, the copyright holders of Dissection give you
21 // permission to combine Dissection program with free software programs or
22 // libraries that are released under the GNU LGPL and with independent modules
23 // that communicate with Dissection solely through the Dissection-fortran
24 // interface. You may copy and distribute such a system following the terms of
25 // the GNU GPL for Dissection and the licenses of the other code concerned,
26 // provided that you include the source code of that other code when and as
27 // the GNU GPL requires distribution of source code and provided that you do
28 // not modify the Dissection-fortran interface.
29 //
30 // Note that people who make modified versions of Dissection are not obligated
31 // to grant this special exception for their modified versions; it is their
32 // choice whether to do so. The GNU General Public License gives permission to
33 // release a modified version without this exception; this exception also makes
34 // it possible to release a modified version which carries forward this
35 // exception. If you modify the Dissection-fortran interface, this exception
36 // does not apply to your modified version of Dissection, and you must remove
37 // this exception when you distribute your modified version.
38 //
39 // This exception is an additional permission under section 7 of the GNU
40 // General Public License, version 3 ("GPLv3")
41 //
42 // Dissection is distributed in the hope that it will be useful,
43 // but WITHOUT ANY WARRANTY; without even the implied warranty of
44 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 // GNU General Public License for more details.
46 //
47 // You should have received a copy of the GNU General Public License
48 // along with Dissection. If not, see <http://www.gnu.org/licenses/>.
49 //
50
51 # ifndef _DRIVER_C_BLASROUTINES_
52 # define _DRIVER_C_BLASROUTINES_
53 #include <vector>
54 #include <list>
55 #include "Compiler/blas.hpp"
56 #include "Algebra/ColumnMatrix.hpp"
57
58 using std::vector;
59 using std::list;
60
61 template<typename T, typename U, typename Z>
62 Z matrix_infty_norm_(const int n, T *a, const int lda);
63
64 template<typename T, typename U>
65 U matrix_infty_norm(const int n, T *a, const int lda);
66 template<>
67 double matrix_infty_norm<quadruple, double>(const int n, quadruple *a,
68 const int lda);
69
70 template<>
71 double matrix_infty_norm<complex<quadruple>,
72 double>(const int n, complex<quadruple> *a,
73 const int lda);
74
75 #ifndef NO_OCTRUPLE
76 template<>
77 quadruple matrix_infty_norm<octruple, quadruple>(const int n,
78 octruple *a, const int lda);
79
80 template<>
81 quadruple matrix_infty_norm<complex<octruple>,
82 quadruple>(const int n,
83 complex<octruple> *a, const int lda);
84 #endif
85 template<>
86 float matrix_infty_norm<double, float>(const int n, double *a,
87 const int lda);
88
89 template<>
90 float matrix_infty_norm<complex<double>, float>(const int n, complex<double> *a,
91 const int lda);
92
93 template<typename T>
94 void full_ldlt(const int n, T *a, const int lda);
95
96 template<typename T>
97 void full_ldlh(const int n, T *a, const int lda);
98 template<>
99 void full_ldlh<double>(const int n, double *a, const int lda);
100 template<>
101 void full_ldlh<quadruple>(const int n, quadruple *a, const int lda);
102 template<>
103 void full_ldlh<float>(const int n, float *a, const int lda);
104
105 template<typename T>
106 void full_ldu(const int n, T *a, const int lda);
107
108 template<typename T>
109 void FillUpperBlock(const int nrow, T *coef,
110 const int *prow,
111 const int *indcols, const int *indvals,
112 const int *old2new_i, const int *old2new_j,
113 ColumnMatrix<T> &b);
114
115 template<typename T, typename U>
116 bool full_ldlt_permute(int *n0, const int nn0, const int n,
117 T *a, const int lda,
118 double *pivot, int *permute,
119 const double eps, double *fop);
120
121 template<typename T, typename U>
122 bool full_ldu_permute(int *n0, const int nn0, const int n,
123 T *a, const int lda,
124 double *pivot, int *permute,
125 const double eps, double *fop);
126
127 template<typename T, typename U>
128 bool ldu_full_permute(int *nn0, const int n0,
129 const int n, T *a, const int lda,
130 double *pivot, int *permute_right, int *permute_left,
131 const double eps, double *fop);
132
133 template<typename T>
134 void full_fw_multiprofile(bool isTransposed, const int nrow, const int n0,
135 const int ncol,
136 T *a,
137 const int lda,
138 T *y, const int ldy,
139 vector<int> &i0, double *fop);
140
141 template<typename T>
142 void full_fw_single(bool isTransposed, const int nrow, const int n0,
143 T *a, const int lda,
144 T *x,
145 double *fop);
146
147 template<typename T>
148 void full_bw_single(bool isTransposed, const int nrow, const int n0,
149 T *a, const int lda,
150 T *x,
151 double *fop);
152
153 template<typename T>
154 void full_fw_multi(bool isTransposed, const int nrow, const int n0,
155 T *a, const int lda,
156 const int ncol,
157 T *x, const int ldy,
158 double *fop);
159
160 template<typename T>
161 void full_bw_multi(bool isTransposed, const int nrow, const int n0,
162 T *a, const int lda,
163 const int ncol,
164 T *x, const int ldy,
165 double *fop);
166
167 template<typename T>
168 void SparseSchur(const bool isSym, const int dim2, const int dim1,
169 vector<int>& i0,
170 ColumnMatrix<T> &upper,
171 ColumnMatrix<T> &lower,
172 ColumnMatrix<T> &diag,
173 double *fop);
174
175 template<typename T>
176 void full_fwbw_single(const bool isTrans, const int n, const int n0,
177 T *a, const int lda, T *z);
178
179 template<typename T>
180 void full_fwbw_multi(const bool isTrans, const int n, const int n0,
181 T *a, const int lda,
182 const int m, T *x, const int ldx);
183
184 template<typename T>
185 void full_fwbw_part(const int n, T *a, const int lda, T*x);
186
187 template<typename T>
188 void SchurProfileSym(const int nrow, const int ncol, vector<int> &i0,
189 ColumnMatrix<T> &b, ColumnMatrix<T> &c,
190 T* s, const int size_b1, double *fop);
191
192 template<typename T>
193 void SchurProfileUnSym(const int nrow, const int ncol, vector<int> &i0,
194 ColumnMatrix<T> &b, ColumnMatrix<T> &c,
195 T* s, const int size_b1, double *fop);
196
197 template<typename T>
198 void swap_sym_lower(const int n, T *a, const int lda,
199 const int k, const int km, T *col_k, T *col_km);
200
201 template<typename T>
202 void swap_sym_upper(const int n, T *a, const int lda,
203 const int k, const int km, T *col_k, T *col_km);
204
205 template<typename T>
206 void swap_unsym(const int n, T *a, const int lda,
207 const int k, const int km, T *col_k, T *col_km);
208
209 template<typename T>
210 void swap_full(const int n, T *a, const int lda,
211 const int k, const int ki, const int kj, T *coli, T *colj);
212
213 // routines for C_KernDetect.cpp
214 template<typename T, typename Z>
215 void full_fwbw_perturb_single(const int n,
216 T *a, const int lda, T *a_fact, T *x,
217 const int dim_augkern, const Z &eps,
218 bool flag_sym);
219
220 template<typename T, typename Z>
221 void full_fwbw_perturb_multi(const int n, const int m,
222 T *a, const int lda, T *a_fact, T *x,
223 const int dim_augkern, const Z &eps,
224 bool flag_sym);
225 //
226
227 template<typename T>
228 void full_sym_2x2BK(int n, T *a, T *dd1,
229 int *pivot_width, int *permute);
230
231 template<typename T>
232 void C_gemm_symm(const int ncol, const int nrow, const T &alpha,
233 const T *a, const int lda,
234 const T *b, const int ldb,
235 const T &beta,
236 T *c, const int ldc);
237
238 #endif