ezp
lightweight C++ wrapper for selected distributed solvers for linear systems
Loading...
Searching...
No Matches
ezp.h
1/*******************************************************************************
2 * Copyright (C) 2025-2026 Theodore Chang
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
17
18#ifndef EZP_H
19#define EZP_H
20
21#include <complex>
22#include <cstdint>
23
24#ifdef EZP_INT64
25using int_t = std::int64_t;
26#else
27using int_t = std::int32_t;
28#endif
29
30using complex8 = std::complex<float>;
31using complex16 = std::complex<double>;
32
33#ifdef EZP_UNDERSCORE
34#define EZP_APPEND_UNDERSCORE(name) name##_
35#else
36#define EZP_APPEND_UNDERSCORE(name) name
37#endif
38
39#define EZP(name) EZP_APPEND_UNDERSCORE(name)
40
41#define numroc EZP(numroc)
42
43#define blacs_exit EZP(blacs_exit)
44#define blacs_get EZP(blacs_get)
45#define blacs_gridexit EZP(blacs_gridexit)
46#define blacs_gridinfo EZP(blacs_gridinfo)
47#define blacs_gridinit EZP(blacs_gridinit)
48#define blacs_pinfo EZP(blacs_pinfo)
49
50#define descinit EZP(descinit)
51
52#define pcdbtrf EZP(pcdbtrf)
53#define pcdbtrs EZP(pcdbtrs)
54#define pcgbtrf EZP(pcgbtrf)
55#define pcgbtrs EZP(pcgbtrs)
56#define pcgemr2d EZP(pcgemr2d)
57#define pcgesvx EZP(pcgesvx)
58#define pcgetrf EZP(pcgetrf)
59#define pcgetrs EZP(pcgetrs)
60#define pcpbtrf EZP(pcpbtrf)
61#define pcpbtrs EZP(pcpbtrs)
62#define pcposvx EZP(pcposvx)
63#define pcpotrf EZP(pcpotrf)
64#define pcpotrs EZP(pcpotrs)
65#define pddbtrf EZP(pddbtrf)
66#define pddbtrs EZP(pddbtrs)
67#define pdgbsv EZP(pdgbsv)
68#define pdgbtrf EZP(pdgbtrf)
69#define pdgbtrs EZP(pdgbtrs)
70#define pdgemr2d EZP(pdgemr2d)
71#define pdgesv EZP(pdgesv)
72#define pdgesvx EZP(pdgesvx)
73#define pdgetrf EZP(pdgetrf)
74#define pdgetrs EZP(pdgetrs)
75#define pdpbtrf EZP(pdpbtrf)
76#define pdpbtrs EZP(pdpbtrs)
77#define pdposv EZP(pdposv)
78#define pdposvx EZP(pdposvx)
79#define pdpotrf EZP(pdpotrf)
80#define pdpotrs EZP(pdpotrs)
81#define psdbtrf EZP(psdbtrf)
82#define psdbtrs EZP(psdbtrs)
83#define psgbsv EZP(psgbsv)
84#define psgbtrf EZP(psgbtrf)
85#define psgbtrs EZP(psgbtrs)
86#define psgemr2d EZP(psgemr2d)
87#define psgesv EZP(psgesv)
88#define psgesvx EZP(psgesvx)
89#define psgetrf EZP(psgetrf)
90#define psgetrs EZP(psgetrs)
91#define pspbtrf EZP(pspbtrf)
92#define pspbtrs EZP(pspbtrs)
93#define psposv EZP(psposv)
94#define psposvx EZP(psposvx)
95#define pspotrf EZP(pspotrf)
96#define pspotrs EZP(pspotrs)
97#define pzdbtrf EZP(pzdbtrf)
98#define pzdbtrs EZP(pzdbtrs)
99#define pzgbtrf EZP(pzgbtrf)
100#define pzgbtrs EZP(pzgbtrs)
101#define pzgemr2d EZP(pzgemr2d)
102#define pzgesvx EZP(pzgesvx)
103#define pzgetrf EZP(pzgetrf)
104#define pzgetrs EZP(pzgetrs)
105#define pzpbtrf EZP(pzpbtrf)
106#define pzpbtrs EZP(pzpbtrs)
107#define pzposvx EZP(pzposvx)
108#define pzpotrf EZP(pzpotrf)
109#define pzpotrs EZP(pzpotrs)
110
111#define igamn2d EZP(igamn2d)
112#define igamx2d EZP(igamx2d)
113#define igebr2d EZP(igebr2d)
114#define pigemr2d EZP(pigemr2d)
115
116#ifdef __cplusplus
117extern "C" {
118#endif
119
120int_t numroc(const int_t* n, const int_t* nb, const int_t* iproc, const int_t* isrcproc, const int_t* nprocs);
121
122void blacs_exit(const int_t* notDone);
123void blacs_get(const int_t* ConTxt, const int_t* what, int_t* val);
124void blacs_gridexit(const int_t* ConTxt);
125void blacs_gridinfo(const int_t* ConTxt, int_t* nprow, int_t* npcol, int_t* myrow, int_t* mycol);
126void blacs_gridinit(int_t* ConTxt, const char* layout, const int_t* nprow, const int_t* npcol);
127void blacs_pinfo(int_t* mypnum, int_t* nprocs);
128
129void descinit(int_t* desc, const int_t* m, const int_t* n, const int_t* mb, const int_t* nb, const int_t* irsrc, const int_t* icsrc, const int_t* ictxt, const int_t* lld, int_t* info);
130
131void pcdbtrf(const int_t* n, const int_t* bwl, const int_t* bwu, complex8* a, const int_t* ja, const int_t* desca, complex8* af, const int_t* laf, complex8* work, const int_t* lwork, int_t* info);
132void pcdbtrs(const char* trans, const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, complex8* a, const int_t* ja, const int_t* desca, complex8* b, const int_t* ib, const int_t* descb, complex8* af, const int_t* laf, complex8* work, const int_t* lwork, int_t* info);
133void pcgbtrf(const int_t* n, const int_t* bwl, const int_t* bwu, complex8* a, const int_t* ja, const int_t* desca, int_t* ipiv, complex8* af, const int_t* laf, complex8* work, const int_t* lwork, int_t* info);
134void pcgbtrs(const char* trans, const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, complex8* a, const int_t* ja, const int_t* desca, int_t* ipiv, complex8* b, const int_t* ib, const int_t* descb, complex8* af, const int_t* laf, complex8* work, const int_t* lwork, int_t* info);
135void pcgemr2d(const int_t* m, const int_t* n, const complex8* a, const int_t* ia, const int_t* ja, const int_t* desca, complex8* b, const int_t* ib, const int_t* jb, const int_t* descb, const int_t* ictxt);
136void pcgesvx(const char* fact, const char* trans, const int_t* n, const int_t* nrhs, complex8* a, const int_t* ia, const int_t* ja, const int_t* desca, complex8* af, const int_t* iaf, const int_t* jaf, const int_t* descaf, int_t* ipiv, char* equed, float* r, float* c, complex8* b, const int_t* ib, const int_t* jb, const int_t* descb, complex8* x, const int_t* ix, const int_t* jx, const int_t* descx, float* rcond, float* ferr, float* berr, complex8* work, const int_t* lwork, float* rwork, const int_t* lrwork, int_t* info);
137void pcgetrf(const int_t* m, const int_t* n, complex8* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* ipiv, int_t* info);
138void pcgetrs(const char* trans, const int_t* n, const int_t* nrhs, const complex8* a, const int_t* ia, const int_t* ja, const int_t* desca, const int_t* ipiv, complex8* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
139void pcpbtrf(const char* uplo, const int_t* n, const int_t* bw, complex8* a, const int_t* ja, const int_t* desca, complex8* af, const int_t* laf, complex8* work, const int_t* lwork, int_t* info);
140void pcpbtrs(const char* uplo, const int_t* n, const int_t* bw, const int_t* nrhs, complex8* a, const int_t* ja, const int_t* desca, complex8* b, const int_t* ib, const int_t* descb, complex8* af, const int_t* laf, complex8* work, const int_t* lwork, int_t* info);
141void pcposvx(const char* fact, const char* uplo, const int_t* n, const int_t* nrhs, complex8* a, const int_t* ia, const int_t* ja, const int_t* desca, complex8* af, const int_t* iaf, const int_t* jaf, const int_t* descaf, char* equed, float* sr, float* sc, complex8* b, const int_t* ib, const int_t* jb, const int_t* descb, complex8* x, const int_t* ix, const int_t* jx, const int_t* descx, float* rcond, float* ferr, float* berr, complex8* work, const int_t* lwork, float* rwork, const int_t* lrwork, int_t* info);
142void pcpotrf(const char* uplo, const int_t* n, complex8* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* info);
143void pcpotrs(const char* uplo, const int_t* n, const int_t* nrhs, const complex8* a, const int_t* ia, const int_t* ja, const int_t* desca, complex8* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
144void pddbtrf(const int_t* n, const int_t* bwl, const int_t* bwu, double* a, const int_t* ja, const int_t* desca, double* af, const int_t* laf, double* work, const int_t* lwork, int_t* info);
145void pddbtrs(const char* trans, const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, double* a, const int_t* ja, const int_t* desca, double* b, const int_t* ib, const int_t* descb, double* af, const int_t* laf, double* work, const int_t* lwork, int_t* info);
146void pdgbsv(const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, double* a, const int_t* ja, const int_t* desca, int_t* ipiv, double* b, const int_t* ib, const int_t* descb, double* work, const int_t* lwork, int_t* info);
147void pdgbtrf(const int_t* n, const int_t* bwl, const int_t* bwu, double* a, const int_t* ja, const int_t* desca, int_t* ipiv, double* af, const int_t* laf, double* work, const int_t* lwork, int_t* info);
148void pdgbtrs(const char* trans, const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, double* a, const int_t* ja, const int_t* desca, int_t* ipiv, double* b, const int_t* ib, const int_t* descb, double* af, const int_t* laf, double* work, const int_t* lwork, int_t* info);
149void pdgemr2d(const int_t* m, const int_t* n, const double* a, const int_t* ia, const int_t* ja, const int_t* desca, double* b, const int_t* ib, const int_t* jb, const int_t* descb, const int_t* ictxt);
150void pdgesv(const int_t* n, const int_t* nrhs, double* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* ipiv, double* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
151void pdgesvx(const char* fact, const char* trans, const int_t* n, const int_t* nrhs, double* a, const int_t* ia, const int_t* ja, const int_t* desca, double* af, const int_t* iaf, const int_t* jaf, const int_t* descaf, int_t* ipiv, char* equed, double* r, double* c, double* b, const int_t* ib, const int_t* jb, const int_t* descb, double* x, const int_t* ix, const int_t* jx, const int_t* descx, double* rcond, double* ferr, double* berr, double* work, const int_t* lwork, int_t* iwork, const int_t* liwork, int_t* info);
152void pdgetrf(const int_t* m, const int_t* n, double* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* ipiv, int_t* info);
153void pdgetrs(const char* trans, const int_t* n, const int_t* nrhs, const double* a, const int_t* ia, const int_t* ja, const int_t* desca, const int_t* ipiv, double* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
154void pdpbtrf(const char* uplo, const int_t* n, const int_t* bw, double* a, const int_t* ja, const int_t* desca, double* af, const int_t* laf, double* work, const int_t* lwork, int_t* info);
155void pdpbtrs(const char* uplo, const int_t* n, const int_t* bw, const int_t* nrhs, double* a, const int_t* ja, const int_t* desca, double* b, const int_t* ib, const int_t* descb, double* af, const int_t* laf, double* work, const int_t* lwork, int_t* info);
156void pdposv(const char* uplo, const int_t* n, const int_t* nrhs, double* a, const int_t* ia, const int_t* ja, const int_t* desca, double* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
157void pdposvx(const char* fact, const char* uplo, const int_t* n, const int_t* nrhs, double* a, const int_t* ia, const int_t* ja, const int_t* desca, double* af, const int_t* iaf, const int_t* jaf, const int_t* descaf, char* equed, double* sr, double* sc, double* b, const int_t* ib, const int_t* jb, const int_t* descb, double* x, const int_t* ix, const int_t* jx, const int_t* descx, double* rcond, double* ferr, double* berr, double* work, const int_t* lwork, int_t* iwork, const int_t* liwork, int_t* info);
158void pdpotrf(const char* uplo, const int_t* n, double* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* info);
159void pdpotrs(const char* uplo, const int_t* n, const int_t* nrhs, const double* a, const int_t* ia, const int_t* ja, const int_t* desca, double* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
160void psdbtrf(const int_t* n, const int_t* bwl, const int_t* bwu, float* a, const int_t* ja, const int_t* desca, float* af, const int_t* laf, float* work, const int_t* lwork, int_t* info);
161void psdbtrs(const char* trans, const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, float* a, const int_t* ja, const int_t* desca, float* b, const int_t* ib, const int_t* descb, float* af, const int_t* laf, float* work, const int_t* lwork, int_t* info);
162void psgbsv(const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, float* a, const int_t* ja, const int_t* desca, int_t* ipiv, float* b, const int_t* ib, const int_t* descb, float* work, const int_t* lwork, int_t* info);
163void psgbtrf(const int_t* n, const int_t* bwl, const int_t* bwu, float* a, const int_t* ja, const int_t* desca, int_t* ipiv, float* af, const int_t* laf, float* work, const int_t* lwork, int_t* info);
164void psgbtrs(const char* trans, const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, float* a, const int_t* ja, const int_t* desca, int_t* ipiv, float* b, const int_t* ib, const int_t* descb, float* af, const int_t* laf, float* work, const int_t* lwork, int_t* info);
165void psgemr2d(const int_t* m, const int_t* n, const float* a, const int_t* ia, const int_t* ja, const int_t* desca, float* b, const int_t* ib, const int_t* jb, const int_t* descb, const int_t* ictxt);
166void psgesv(const int_t* n, const int_t* nrhs, float* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* ipiv, float* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
167void psgesvx(const char* fact, const char* trans, const int_t* n, const int_t* nrhs, float* a, const int_t* ia, const int_t* ja, const int_t* desca, float* af, const int_t* iaf, const int_t* jaf, const int_t* descaf, int_t* ipiv, char* equed, float* r, float* c, float* b, const int_t* ib, const int_t* jb, const int_t* descb, float* x, const int_t* ix, const int_t* jx, const int_t* descx, float* rcond, float* ferr, float* berr, float* work, const int_t* lwork, int_t* iwork, const int_t* liwork, int_t* info);
168void psgetrf(const int_t* m, const int_t* n, float* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* ipiv, int_t* info);
169void psgetrs(const char* trans, const int_t* n, const int_t* nrhs, const float* a, const int_t* ia, const int_t* ja, const int_t* desca, const int_t* ipiv, float* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
170void pspbtrf(const char* uplo, const int_t* n, const int_t* bw, float* a, const int_t* ja, const int_t* desca, float* af, const int_t* laf, float* work, const int_t* lwork, int_t* info);
171void pspbtrs(const char* uplo, const int_t* n, const int_t* bw, const int_t* nrhs, float* a, const int_t* ja, const int_t* desca, float* b, const int_t* ib, const int_t* descb, float* af, const int_t* laf, float* work, const int_t* lwork, int_t* info);
172void psposv(const char* uplo, const int_t* n, const int_t* nrhs, float* a, const int_t* ia, const int_t* ja, const int_t* desca, float* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
173void psposvx(const char* fact, const char* uplo, const int_t* n, const int_t* nrhs, float* a, const int_t* ia, const int_t* ja, const int_t* desca, float* af, const int_t* iaf, const int_t* jaf, const int_t* descaf, char* equed, float* sr, float* sc, float* b, const int_t* ib, const int_t* jb, const int_t* descb, float* x, const int_t* ix, const int_t* jx, const int_t* descx, float* rcond, float* ferr, float* berr, float* work, const int_t* lwork, int_t* iwork, const int_t* liwork, int_t* info);
174void pspotrf(const char* uplo, const int_t* n, float* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* info);
175void pspotrs(const char* uplo, const int_t* n, const int_t* nrhs, const float* a, const int_t* ia, const int_t* ja, const int_t* desca, float* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
176void pzdbtrf(const int_t* n, const int_t* bwl, const int_t* bwu, complex16* a, const int_t* ja, const int_t* desca, complex16* af, const int_t* laf, complex16* work, const int_t* lwork, int_t* info);
177void pzdbtrs(const char* trans, const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, complex16* a, const int_t* ja, const int_t* desca, complex16* b, const int_t* ib, const int_t* descb, complex16* af, const int_t* laf, complex16* work, const int_t* lwork, int_t* info);
178void pzgbtrf(const int_t* n, const int_t* bwl, const int_t* bwu, complex16* a, const int_t* ja, const int_t* desca, int_t* ipiv, complex16* af, const int_t* laf, complex16* work, const int_t* lwork, int_t* info);
179void pzgbtrs(const char* trans, const int_t* n, const int_t* bwl, const int_t* bwu, const int_t* nrhs, complex16* a, const int_t* ja, const int_t* desca, int_t* ipiv, complex16* b, const int_t* ib, const int_t* descb, complex16* af, const int_t* laf, complex16* work, const int_t* lwork, int_t* info);
180void pzgemr2d(const int_t* m, const int_t* n, const complex16* a, const int_t* ia, const int_t* ja, const int_t* desca, complex16* b, const int_t* ib, const int_t* jb, const int_t* descb, const int_t* ictxt);
181void pzgesvx(const char* fact, const char* trans, const int_t* n, const int_t* nrhs, complex16* a, const int_t* ia, const int_t* ja, const int_t* desca, complex16* af, const int_t* iaf, const int_t* jaf, const int_t* descaf, int_t* ipiv, char* equed, double* r, double* c, complex16* b, const int_t* ib, const int_t* jb, const int_t* descb, complex16* x, const int_t* ix, const int_t* jx, const int_t* descx, double* rcond, double* ferr, double* berr, complex16* work, const int_t* lwork, double* rwork, const int_t* lrwork, int_t* info);
182void pzgetrf(const int_t* m, const int_t* n, complex16* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* ipiv, int_t* info);
183void pzgetrs(const char* trans, const int_t* n, const int_t* nrhs, const complex16* a, const int_t* ia, const int_t* ja, const int_t* desca, const int_t* ipiv, complex16* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
184void pzpbtrf(const char* uplo, const int_t* n, const int_t* bw, complex16* a, const int_t* ja, const int_t* desca, complex16* af, const int_t* laf, complex16* work, const int_t* lwork, int_t* info);
185void pzpbtrs(const char* uplo, const int_t* n, const int_t* bw, const int_t* nrhs, complex16* a, const int_t* ja, const int_t* desca, complex16* b, const int_t* ib, const int_t* descb, complex16* af, const int_t* laf, complex16* work, const int_t* lwork, int_t* info);
186void pzposvx(const char* fact, const char* uplo, const int_t* n, const int_t* nrhs, complex16* a, const int_t* ia, const int_t* ja, const int_t* desca, complex16* af, const int_t* iaf, const int_t* jaf, const int_t* descaf, char* equed, double* sr, double* sc, complex16* b, const int_t* ib, const int_t* jb, const int_t* descb, complex16* x, const int_t* ix, const int_t* jx, const int_t* descx, double* rcond, double* ferr, double* berr, complex16* work, const int_t* lwork, double* rwork, const int_t* lrwork, int_t* info);
187void pzpotrf(const char* uplo, const int_t* n, complex16* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* info);
188void pzpotrs(const char* uplo, const int_t* n, const int_t* nrhs, const complex16* a, const int_t* ia, const int_t* ja, const int_t* desca, complex16* b, const int_t* ib, const int_t* jb, const int_t* descb, int_t* info);
189
190void igamn2d(const int_t* ConTxt, const char* scope, const char* top, const int_t* m, const int_t* n, int_t* A, const int_t* lda, int_t* rA, int_t* cA, const int_t* ldia, const int_t* rdest, const int_t* cdest);
191void igamx2d(const int_t* ConTxt, const char* scope, const char* top, const int_t* m, const int_t* n, int_t* A, const int_t* lda, int_t* rA, int_t* cA, const int_t* ldia, const int_t* rdest, const int_t* cdest);
192void igebr2d(const int_t* ConTxt, const char* scope, const char* top, const int_t* m, const int_t* n, int_t* A, const int_t* lda, const int_t* rsrc, const int_t* csrc);
193void pigemr2d(const int_t* m, const int_t* n, const int_t* a, const int_t* ia, const int_t* ja, const int_t* desca, int_t* b, const int_t* ib, const int_t* jb, const int_t* descb, const int_t* ictxt);
194
195void cluster_sparse_solver(void*, const std::int32_t*, const std::int32_t*, const std::int32_t*, const std::int32_t*, const std::int32_t*, const void*, const std::int32_t*, const std::int32_t*, std::int32_t*, const std::int32_t*, std::int32_t*, const std::int32_t*, void*, void*, const std::int32_t*, std::int32_t*);
196void cluster_sparse_solver_64(void*, const std::int64_t*, const std::int64_t*, const std::int64_t*, const std::int64_t*, const std::int64_t*, const void*, const std::int64_t*, const std::int64_t*, std::int64_t*, const std::int64_t*, std::int64_t*, const std::int64_t*, void*, void*, const std::int32_t*, std::int64_t*);
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif // EZP_H