PaStiX Handbook 6.4.0
Loading...
Searching...
No Matches
pastix_zlrcores.h
Go to the documentation of this file.
1/**
2 * @file pastix_zlrcores.h
3 *
4 * PaStiX kernel header.
5 *
6 * @copyright 2016-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
7 * Univ. Bordeaux. All rights reserved.
8 *
9 * @version 6.4.0
10 * @author Mathieu Faverge
11 * @author Pierre Ramet
12 * @author Xavier Lacoste
13 * @author Esragul Korkmaz
14 * @author Nolan Bredel
15 * @date 2024-07-05
16 * @generated from /builds/2mk6rsew/0/solverstack/pastix/kernels/pastix_zlrcores.h, normal z -> z, Tue Feb 25 14:34:35 2025
17 *
18 */
19#ifndef _pastix_zlrcores_h_
20#define _pastix_zlrcores_h_
21
22#include "pastix_lowrank.h"
23
24/**
25 *
26 * @addtogroup kernel_lr
27 * @{
28 * This module contains all the low-rank kernels working on pastix_lr_t
29 * matrix representations.
30 *
31 * @name PastixComplex64 low-rank kernels
32 * @{
33 */
36int core_zlrsze ( int copy, pastix_int_t M, pastix_int_t N, pastix_lrblock_t *A, pastix_int_t newrk, pastix_int_t newrkmax, pastix_int_t rklimit );
37int core_zlr2ge ( pastix_trans_t trans, pastix_int_t M, pastix_int_t N, const pastix_lrblock_t *Alr, pastix_complex64_t *A, pastix_int_t lda );
38
39void core_zlrcpy ( const pastix_lr_t *lowrank,
40 pastix_trans_t transA, pastix_complex64_t alpha,
43 pastix_int_t offx, pastix_int_t offy );
44
45void core_zlrconcatenate_u( pastix_complex64_t alpha,
48 pastix_int_t offx,
49 pastix_complex64_t *u1u2 );
50void core_zlrconcatenate_v( pastix_trans_t transA1, pastix_complex64_t alpha,
53 pastix_int_t offy,
54 pastix_complex64_t *v1v2 );
55
56double core_zlrnrm( pastix_normtype_t ntype, int transV,
58 const pastix_lrblock_t *A );
59
61char *core_zlrpack( pastix_int_t M, pastix_int_t N, const pastix_lrblock_t *A, char *buffer );
62char *core_zlrunpack( pastix_int_t M, pastix_int_t N, pastix_lrblock_t *A, char *buffer );
63const char * core_zlrunpack2( pastix_int_t M, pastix_int_t N, pastix_lrblock_t *A, const char *input, char **outptr );
64
65/**
66 * @}
67 * @}
68 *
69 * @addtogroup kernel_lr_lrmm
70 * @{
71 * This are the kernels to compute the low-rank updates
72 *
73 * @name PastixComplex64 LRMM low-rank kernels
74 * @{
75 */
76
77/**
78 * @brief Structure to store all the parameters of the core_zlrmm family functions
79 */
80typedef struct core_zlrmm_s {
81 const pastix_lr_t *lowrank; /**< The lowrank structure */
82 pastix_trans_t transA; /**< Specify op(A) and is equal to PastixNoTrans, PastixTrans, or PastixConjTrans */
83 pastix_trans_t transB; /**< Specify op(B) and is equal to PastixNoTrans, PastixTrans, or PastixConjTrans */
84 pastix_int_t M; /**< Number of rows of the A matrix */
85 pastix_int_t N; /**< Number of columns of the B matrix */
86 pastix_int_t K; /**< Number of columns of the A matrix (= number of rows of the B matrix) */
87 pastix_int_t Cm; /**< Number of rows of the C matrix that receives the AB contribution */
88 pastix_int_t Cn; /**< Number of columns of the C matrix that receives the AB contribution */
89 pastix_int_t offx; /**< Horizontal offsets of the AB product in the C matrix */
90 pastix_int_t offy; /**< Vertical offsets of the AB product in the C matrix */
91 pastix_complex64_t alpha; /**< The alpha factor */
92 const pastix_lrblock_t *A; /**< The A matrix described in a low-rank structure */
93 const pastix_lrblock_t *B; /**< The B matrix described in a low-rank structure */
94 pastix_complex64_t beta; /**< The beta factor */
95 pastix_lrblock_t *C; /**< The C matrix described in a low-rank structure */
96 pastix_complex64_t *work; /**< The pointer to an available workspace */
97 pastix_int_t lwork; /**< The size of the given workspace */
98 pastix_int_t lwused; /**< The size of the workspace that is already used */
99 pastix_atomic_lock_t *lock; /**< The lock to protect the concurrent accesses on the C matrix */
101
102/**
103 * @brief Initialize all the parameters of the core_zlrmm family functions to ease the access
104 */
105#define PASTE_CORE_ZLRMM_PARAMS(_a_) \
106 const pastix_lr_t *lowrank = (_a_)->lowrank; \
107 pastix_trans_t transA = (_a_)->transA; \
108 pastix_trans_t transB = (_a_)->transB; \
109 pastix_int_t M = (_a_)->M; \
110 pastix_int_t N = (_a_)->N; \
111 pastix_int_t K = (_a_)->K; \
112 pastix_int_t Cm = (_a_)->Cm; \
113 pastix_int_t Cn = (_a_)->Cn; \
114 pastix_int_t offx = (_a_)->offx; \
115 pastix_int_t offy = (_a_)->offy; \
116 pastix_complex64_t alpha = (_a_)->alpha; \
117 const pastix_lrblock_t *A = (_a_)->A; \
118 const pastix_lrblock_t *B = (_a_)->B; \
119 pastix_complex64_t beta = (_a_)->beta; \
120 pastix_lrblock_t *C = (_a_)->C; \
121 pastix_complex64_t *work = (_a_)->work; \
122 pastix_int_t lwork = (_a_)->lwork; \
123 pastix_atomic_lock_t *lock = (_a_)->lock;
124
125/**
126 * @brief Void all the parameters of the core_zlrmm family functions to silent warnings
127 */
128#define PASTE_CORE_ZLRMM_VOID \
129 (void)lowrank; \
130 (void)transA; \
131 (void)transB; \
132 (void)M; \
133 (void)N; \
134 (void)K; \
135 (void)Cm; \
136 (void)Cn; \
137 (void)offx; \
138 (void)offy; \
139 (void)alpha; \
140 (void)A; \
141 (void)B; \
142 (void)beta; \
143 (void)C; \
144 (void)work; \
145 (void)lwork; \
146 (void)lock
147
148/**
149 * @brief Function to get a workspace pointer if space is available in the one provided
150 * @param[inout] params The parameters structure for core_zlrmm family functions
151 * @param[in] newsize The required workspace size in number of elements
152 * @return The pointer to the workspace if enough space available, NULL otherwise.
153 */
154static inline pastix_complex64_t *
156 ssize_t newsize )
157{
158 pastix_complex64_t *work = NULL;
159 if ( (params->lwused + newsize) <= params->lwork )
160 {
161 work = params->work + params->lwused;
162 params->lwused += newsize;
163 }
164 /* else */
165 /* { */
166 /* if ( (params->work == NULL) || (params->lwused == 0) ) */
167 /* { */
168 /* params->work = realloc( params->work, newsize * sizeof(pastix_complex64_t) ); */
169 /* params->lwork = newsize; */
170 /* params->lwused = newsize; */
171 /* work = params->work; */
172 /* } */
173 /* } */
174 return work;
175}
176
177/**
178 * @}
179 * @name update_fr Functions to perform the update on a full-rank matrix
180 * @{
181 */
186
187/**
188 * @}
189 * @name update_lr Functions to prepare the AB product for an update on a low-rank matrix
190 * @{
191 */
194 int *infomask,
195 pastix_int_t Kmax );
198 int *infomask,
199 pastix_int_t Brkmin );
202 int *infomask,
203 pastix_int_t Arkmin );
206 int *infomask );
207
208/**
209 * @}
210 * @name add_lr Functions to add the AB contribution in a low-rank format to any C matrix
211 * @{
212 */
214 const pastix_lrblock_t *AB,
215 pastix_trans_t transV,
216 int infomask );
217
218/**
219 * @}
220 */
222
223/**
224 * @}
225 *
226 * @addtogroup kernel_lr_svd
227 * @{
228 * This is the SVD implementation of the low-rank kernels based on the LAPACK
229 * GESVD function.
230 *
231 * @name PastixComplex64 SVD low-rank kernels
232 * @{
233 */
234pastix_fixdbl_t core_zge2lr_svd( int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit,
236 const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr );
237pastix_fixdbl_t core_zrradd_svd( const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr,
240 pastix_int_t offx, pastix_int_t offy);
241
242/**
243 * @}
244 * @}
245 *
246 * @addtogroup kernel_lr_rrqr
247 * @{
248 * These are the rank-revealing QR implementations to generate the low-rank
249 * representations of a full rank matrix.
250 *
251 * @name PastixComplex64 main template to convert a full rank matrix to low-rank
252 * @{
253 */
254
255/**
256 * @brief TODO
257 */
258typedef int (*core_zrrqr_cp_t)( double tol, pastix_int_t maxrank, int refine, pastix_int_t nb,
260 pastix_complex64_t *A, pastix_int_t lda,
261 pastix_int_t *jpvt, pastix_complex64_t *tau,
262 pastix_complex64_t *work, pastix_int_t lwork, double *rwork );
263
264/**
265 * @brief TODO
266 */
267typedef int (*core_zrrqr_rt_t)( double tol, pastix_int_t maxrank, pastix_int_t nb,
269 pastix_complex64_t *A, pastix_int_t lda, pastix_complex64_t *tau,
270 pastix_complex64_t *B, pastix_int_t ldb, pastix_complex64_t *tau_b,
271 pastix_complex64_t *work, pastix_int_t lwork, double normA );
272
273/**
274 * @}
275 * @name PastixComplex64 Rank Revealing QR kernels for low-rank
276 * @{
277 */
280 const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr );
281pastix_fixdbl_t core_zrradd_pqrcp( const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr,
284 pastix_int_t offx, pastix_int_t offy );
285
288 const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr );
289pastix_fixdbl_t core_zrradd_rqrcp( const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr,
292 pastix_int_t offx, pastix_int_t offy );
293
296 const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr );
297pastix_fixdbl_t core_zrradd_tqrcp( const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr,
300 pastix_int_t offx, pastix_int_t offy );
301
304 const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr );
305
306
308 int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit,
310 const void *Avoid, pastix_int_t lda,
311 pastix_lrblock_t *Alr );
313 int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit,
315 const void *Avoid, pastix_int_t lda,
316 pastix_lrblock_t *Alr);
317
319 const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr,
322 pastix_int_t offx, pastix_int_t offy );
323
324/**
325 * @}
326 * @}
327 *
328 * @addtogroup kernel_lr_debug
329 * @{
330 * This is the debug routines for the low rank kernels.
331 *
332 * @name PastixComplex64 low-rank debug functions
333 * @{
334 */
336 pastix_int_t N,
337 const pastix_complex64_t *A,
338 pastix_int_t lda );
339
341 pastix_int_t N,
342 const pastix_complex64_t *A,
343 pastix_int_t lda );
344
346 const pastix_complex64_t *A, pastix_int_t lda,
347 const pastix_complex64_t *B, pastix_int_t ldb );
348
349/**
350 * @}
351 * @}
352 */
353
354#endif /* _pastix_zlrcores_h_ */
BEGIN_C_DECLS typedef int pastix_int_t
Definition datatypes.h:51
double pastix_fixdbl_t
Definition datatypes.h:65
int core_zlrdbg_check_orthogonality_AB(pastix_int_t M, pastix_int_t NA, pastix_int_t NB, const pastix_complex64_t *A, pastix_int_t lda, const pastix_complex64_t *B, pastix_int_t ldb)
Check the orthogonality of the matrix A relatively to the matrix B.
void core_zlrdbg_printsvd(pastix_int_t M, pastix_int_t N, const pastix_complex64_t *A, pastix_int_t lda)
Print the svd values of the given matrix.
Definition core_zlrdbg.c:45
int core_zlrdbg_check_orthogonality(pastix_int_t M, pastix_int_t N, const pastix_complex64_t *A, pastix_int_t lda)
Check the orthogonality of the matrix A.
const pastix_lrblock_t * A
pastix_complex64_t alpha
pastix_trans_t transB
pastix_atomic_lock_t * lock
const pastix_lrblock_t * B
const pastix_lr_t * lowrank
pastix_int_t M
pastix_int_t offy
pastix_int_t lwused
pastix_trans_t transA
pastix_int_t Cm
pastix_int_t lwork
pastix_int_t N
pastix_lrblock_t * C
pastix_complex64_t beta
pastix_int_t K
pastix_int_t offx
pastix_complex64_t * work
pastix_int_t Cn
static pastix_complex64_t * core_zlrmm_getws(core_zlrmm_t *params, ssize_t newsize)
Function to get a workspace pointer if space is available in the one provided.
struct core_zlrmm_s core_zlrmm_t
Structure to store all the parameters of the core_zlrmm family functions.
pastix_fixdbl_t core_zfrlr2fr(core_zlrmm_t *params)
Perform the operation C = alpha * op(A) * op(B) + beta C, with A and C full-rank and B low-rank.
pastix_fixdbl_t core_zlrlr2fr(core_zlrmm_t *params)
Perform the operation C = alpha * op(A) * op(B) + beta C, with A and B low-rank and C full-rank.
pastix_fixdbl_t core_zfrlr2lr(core_zlrmm_t *params, pastix_lrblock_t *AB, int *infomask, pastix_int_t Brkmin)
Perform the operation AB = op(A) * op(B), with A full-rank and B and AB low-rank.
pastix_fixdbl_t core_zlrmm(core_zlrmm_t *params)
Compute the matrix matrix product when involved matrices are stored in a low-rank structure.
Definition core_zlrmm.c:278
pastix_fixdbl_t core_zfrfr2fr(core_zlrmm_t *params)
Perform the full-rank operation C = alpha * op(A) * op(B) + beta C.
Definition core_zxx2fr.c:48
pastix_fixdbl_t core_zlrfr2fr(core_zlrmm_t *params)
Perform the operation C = alpha * op(A) * op(B) + beta C, with B and C full-rank and A low-rank.
pastix_fixdbl_t core_zlrfr2lr(core_zlrmm_t *params, pastix_lrblock_t *AB, int *infomask, pastix_int_t Arkmin)
Perform the operation AB = op(A) * op(B), with B full-rank and A and AB low-rank.
pastix_fixdbl_t core_zfrfr2lr(core_zlrmm_t *params, pastix_lrblock_t *AB, int *infomask, pastix_int_t Kmax)
Perform the operation AB = op(A) * op(B), with A and B full-rank and AB low-rank.
Definition core_zxx2lr.c:66
pastix_fixdbl_t core_zlrlr2lr(core_zlrmm_t *params, pastix_lrblock_t *AB, int *infomask)
Perform the operation AB = op(A) * op(B), with A, B, and AB low-rank.
pastix_fixdbl_t core_zlradd(core_zlrmm_t *params, const pastix_lrblock_t *AB, pastix_trans_t transV, int infomask)
Perform the addition of two low-rank matrices.
Structure to store all the parameters of the core_zlrmm family functions.
Structure to define the type of function to use for the low-rank kernels and their parameters.
The block low-rank structure to hold a matrix in low-rank form.
pastix_fixdbl_t core_zrradd_pqrcp(const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr, pastix_int_t M1, pastix_int_t N1, const pastix_lrblock_t *A, pastix_int_t M2, pastix_int_t N2, pastix_lrblock_t *B, pastix_int_t offx, pastix_int_t offy)
Add two LR structures A=(-u1) v1^T and B=u2 v2^T into u2 v2^T.
int(* core_zrrqr_cp_t)(double tol, pastix_int_t maxrank, int refine, pastix_int_t nb, pastix_int_t m, pastix_int_t n, pastix_complex64_t *A, pastix_int_t lda, pastix_int_t *jpvt, pastix_complex64_t *tau, pastix_complex64_t *work, pastix_int_t lwork, double *rwork)
TODO.
pastix_fixdbl_t core_zge2lr_rqrcp(int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit, pastix_int_t m, pastix_int_t n, const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr)
Convert a full rank matrix in a low rank matrix, using RQRCP.
pastix_fixdbl_t core_zge2lr_rqrrt(int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit, pastix_int_t m, pastix_int_t n, const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr)
Convert a full rank matrix in a low rank matrix, using RQRRT.
pastix_fixdbl_t core_zge2lr_qrrt(core_zrrqr_rt_t rrqrfct, int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit, pastix_int_t m, pastix_int_t n, const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr)
Template to convert a full rank matrix into a low rank matrix through QR decompositions.
pastix_fixdbl_t core_zge2lr_pqrcp(int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit, pastix_int_t m, pastix_int_t n, const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr)
Convert a full rank matrix in a low rank matrix, using PQRCP.
pastix_fixdbl_t core_zge2lr_qrcp(core_zrrqr_cp_t rrqrfct, int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit, pastix_int_t m, pastix_int_t n, const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr)
Template to convert a full rank matrix into a low rank matrix through QR decompositions.
pastix_fixdbl_t core_zrradd_qr(core_zrrqr_cp_t rrqrfct, const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr, pastix_int_t M1, pastix_int_t N1, const pastix_lrblock_t *A, pastix_int_t M2, pastix_int_t N2, pastix_lrblock_t *B, pastix_int_t offx, pastix_int_t offy)
Template to perform the addition of two low-rank structures with compression kernel based on QR decom...
pastix_fixdbl_t core_zrradd_tqrcp(const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr, pastix_int_t M1, pastix_int_t N1, const pastix_lrblock_t *A, pastix_int_t M2, pastix_int_t N2, pastix_lrblock_t *B, pastix_int_t offx, pastix_int_t offy)
Add two LR structures A=(-u1) v1^T and B=u2 v2^T into u2 v2^T.
int(* core_zrrqr_rt_t)(double tol, pastix_int_t maxrank, pastix_int_t nb, pastix_int_t m, pastix_int_t n, pastix_complex64_t *A, pastix_int_t lda, pastix_complex64_t *tau, pastix_complex64_t *B, pastix_int_t ldb, pastix_complex64_t *tau_b, pastix_complex64_t *work, pastix_int_t lwork, double normA)
TODO.
pastix_fixdbl_t core_zge2lr_tqrcp(int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit, pastix_int_t m, pastix_int_t n, const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr)
Convert a full rank matrix in a low rank matrix, using TQRCP.
pastix_fixdbl_t core_zrradd_rqrcp(const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr, pastix_int_t M1, pastix_int_t N1, const pastix_lrblock_t *A, pastix_int_t M2, pastix_int_t N2, pastix_lrblock_t *B, pastix_int_t offx, pastix_int_t offy)
Add two LR structures A=(-u1) v1^T and B=u2 v2^T into u2 v2^T.
pastix_fixdbl_t core_zrradd_svd(const pastix_lr_t *lowrank, pastix_trans_t transA1, const void *alphaptr, pastix_int_t M1, pastix_int_t N1, const pastix_lrblock_t *A, pastix_int_t M2, pastix_int_t N2, pastix_lrblock_t *B, pastix_int_t offx, pastix_int_t offy)
Add two LR structures A=(-u1) v1^T and B=u2 v2^T into u2 v2^T.
pastix_fixdbl_t core_zge2lr_svd(int use_reltol, pastix_fixdbl_t tol, pastix_int_t rklimit, pastix_int_t m, pastix_int_t n, const void *Avoid, pastix_int_t lda, pastix_lrblock_t *Alr)
Convert a full rank matrix in a low rank matrix, using SVD.
void core_zlrcpy(const pastix_lr_t *lowrank, pastix_trans_t transA, pastix_complex64_t alpha, pastix_int_t M1, pastix_int_t N1, const pastix_lrblock_t *A, pastix_int_t M2, pastix_int_t N2, pastix_lrblock_t *B, pastix_int_t offx, pastix_int_t offy)
Copy a small low-rank structure into a large one.
char * core_zlrunpack(pastix_int_t M, pastix_int_t N, pastix_lrblock_t *A, char *buffer)
Unpack low rank data and fill the cblk concerned by the computation.
void core_zlrconcatenate_v(pastix_trans_t transA1, pastix_complex64_t alpha, pastix_int_t M1, pastix_int_t N1, const pastix_lrblock_t *A, pastix_int_t N2, pastix_lrblock_t *B, pastix_int_t offy, pastix_complex64_t *v1v2)
Concatenate right parts of two low-rank matrices.
int core_zlrsze(int copy, pastix_int_t M, pastix_int_t N, pastix_lrblock_t *A, pastix_int_t newrk, pastix_int_t newrkmax, pastix_int_t rklimit)
Resize a low-rank matrix.
char * core_zlrpack(pastix_int_t M, pastix_int_t N, const pastix_lrblock_t *A, char *buffer)
Pack low-rank data by side.
size_t core_zlrgetsize(pastix_int_t M, pastix_int_t N, pastix_lrblock_t *A)
Compute the size of a block to send in LR.
const char * core_zlrunpack2(pastix_int_t M, pastix_int_t N, pastix_lrblock_t *A, const char *input, char **outptr)
Unpack low rank data and fill the cblk concerned by the computation.
void core_zlrconcatenate_u(pastix_complex64_t alpha, pastix_int_t M1, pastix_int_t N1, const pastix_lrblock_t *A, pastix_int_t M2, pastix_lrblock_t *B, pastix_int_t offx, pastix_complex64_t *u1u2)
Concatenate left parts of two low-rank matrices.
double core_zlrnrm(pastix_normtype_t ntype, int transV, pastix_int_t M, pastix_int_t N, const pastix_lrblock_t *A)
Compute the norm of a low-rank matrix.
Definition core_zlrnrm.c:48
int core_zlr2ge(pastix_trans_t trans, pastix_int_t M, pastix_int_t N, const pastix_lrblock_t *Alr, pastix_complex64_t *A, pastix_int_t lda)
Convert a low rank matrix into a dense matrix.
void core_zlrfree(pastix_lrblock_t *A)
Free a low-rank matrix.
void core_zlralloc(pastix_int_t M, pastix_int_t N, pastix_int_t rkmax, pastix_lrblock_t *A)
Allocate a low-rank matrix.
enum pastix_normtype_e pastix_normtype_t
Norms.
enum pastix_trans_e pastix_trans_t
Transpostion.