chombo-discharge
Loading...
Searching...
No Matches
CD_LaPackUtils.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
14#ifndef CD_LAPACKUTILS_H
15#define CD_LAPACKUTILS_H
16
17// Std includes
18#include <vector>
19
20// Our includes
21#include <CD_NamespaceHeader.H>
22
24extern "C" void
25dgelss_(int* a_M,
26 int* a_N,
27 int* a_nRHS,
28 double* a_A,
29 int* a_LDA,
30 double* a_B,
31 int* a_LDB,
32 double* a_S,
33 double* a_rcond,
34 int* a_RANK,
35 double* a_WORK,
36 int* a_LWORK,
37 int* a_INFO);
38
39extern "C" void
40dgesdd_(char* a_JOBZ,
41 int* a_M,
42 int* a_N,
43 double* a_A,
44 int* a_LDA,
45 double* a_S,
46 double* a_U,
47 int* a_LDU,
48 double* a_VT,
49 int* a_LDVT,
50 double* a_WORK,
51 int* a_LWORK,
52 int* a_IWORK,
53 int* a_INFO);
54
55extern "C" void
56sgesdd_(char* a_JOBZ,
57 int* a_M,
58 int* a_N,
59 float* a_A,
60 int* a_LDA,
61 float* a_S,
62 float* a_U,
63 int* a_LDU,
64 float* a_VT,
65 int* a_LDVT,
66 float* a_WORK,
67 int* a_LWORK,
68 int* a_IWORK,
69 int* a_INFO);
70
71extern "C" void
72dgemm_(char* a_TRANSA,
73 char* a_TRANSB,
74 int* a_M,
75 int* a_N,
76 int* a_K,
77 double* a_ALPHA,
78 double* a_A,
79 int* a_LDA,
80 double* a_B,
81 int* a_LDB,
82 double* a_BETA,
83 double* a_C,
84 int* a_LDC);
85
86extern "C" void
87sgemm_(char* a_TRANSA,
88 char* a_TRANSB,
89 int* a_M,
90 int* a_N,
91 int* a_K,
92 float* a_ALPHA,
93 float* a_A,
94 int* a_LDA,
95 float* a_B,
96 int* a_LDB,
97 float* a_BETA,
98 float* a_C,
99 int* a_LDC);
100
101extern "C" void
102dgesv_(int* N, int* NRHS, double* A, int* LDA, int* IPIV, double* B, int* LDB, int* INFO);
104
108namespace LaPackUtils {
109
118 int
119 linearIndex(const int irow, const int jcol, const int M, const int N);
120
136 bool
141 const int& a_M,
142 const int& a_N);
143
159 bool
164 const int& a_M,
165 const int& a_N);
166
175 bool
178 const int& a_M,
179 const int& a_N);
180
189 bool
192 const int& a_M,
193 const int& a_N);
194
204 void
206 int& a_M,
207 int& a_N,
209 const char& a_format);
210
218 void
220 int& a_M,
221 int& a_N,
223
231 void
233
243 void
245 const int& a_M,
246 const int& a_N,
248 const char& a_format);
249
257 void
259 const int& a_M,
260 const int& a_N,
262
270 void
272 const int& a_M,
273 const int& a_N,
275} // namespace LaPackUtils
276
277#include <CD_NamespaceFooter.H>
278
279#endif
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26
Namespace containing various useful linear algebra routines using LaPACK.
Definition CD_LaPackUtils.H:108
void deLinearizeMatrix(std::vector< std::vector< double > > &a_A, const int &a_M, const int &a_N, const std::vector< double > &a_linA, const char &a_format)
Delinearize a linearized matrix from column major Fortran to row or major column matrix format.
Definition CD_LaPackUtils.cpp:460
void deLinearizeRowMajorMatrix(std::vector< std::vector< double > > &a_A, const int &a_M, const int &a_N, const std::vector< double > &a_linA)
Delinearize a linearized matrix from column major Fortran to row major form.
Definition CD_LaPackUtils.cpp:439
void linearizeMatrix(std::vector< double > &a_linA, int &a_M, int &a_N, const std::vector< std::vector< double > > &a_A, const char &a_format)
Linearize a matrix to column major Fortran form by assuming row or major column format of the input m...
Definition CD_LaPackUtils.cpp:400
void linearizeRowMajorMatrix(std::vector< double > &a_linA, int &a_M, int &a_N, const std::vector< std::vector< double > > &a_A)
Linearize a matrix to column major Fortran form by row major format of the input matrix.
Definition CD_LaPackUtils.cpp:380
bool computeSVD(std::vector< double > &a_linU, std::vector< double > &a_linSigma, std::vector< double > &a_linVtran, const std::vector< double > &a_linA, const int &a_M, const int &a_N)
Compute the singular value decomposition of a matrix.
Definition CD_LaPackUtils.cpp:30
void linearizeColumnMajorMatrix(std::vector< double > &a_linA, int &a_M, int &a_N, const std::vector< std::vector< double > > &a_A)
Linearize a matrix to column major Fortran form by column major format of the input matrix.
Definition CD_LaPackUtils.cpp:360
int linearIndex(const int irow, const int jcol, const int M, const int N)
Get the index in the linearized matrix of size MxN.
Definition CD_LaPackUtils.cpp:24
bool computePseudoInverse(std::vector< double > &a_linAplus, const std::vector< double > &a_linA, const int &a_M, const int &a_N)
Compute the pseudoinverse of matrix through singular value decomposition.
Definition CD_LaPackUtils.cpp:164
void deLinearizeColumnMajorMatrix(std::vector< std::vector< double > > &a_A, const int &a_M, const int &a_N, const std::vector< double > &a_linA)
Delinearize a linearized matrix from column major Fortran to column major form.
Definition CD_LaPackUtils.cpp:418