25 #ifndef DOXYGEN_SHOULD_SKIP_THIS
26 static double done = 1.0;
27 static double dzero = 0.0;
97 work = malloc( M * N *
sizeof(
double) );
105 cblas_dgemm( CblasColMajor, CblasNoTrans, (CBLAS_TRANSPOSE)transB,
110 flops = FLOPS_DGEMM( M, N, K );
163 ldbv = ( B->rk == -1 ) ? -1 : B->rkmax;
168 if ( B->rk > Brkmin ) {
173 pastix_fixdbl_t flops1 = FLOPS_DGEMM( M, B->rk, K ) + FLOPS_DGEMM( M, N, B->rk );
174 pastix_fixdbl_t flops2 = FLOPS_DGEMM( K, N, B->rk ) + FLOPS_DGEMM( M, N, K );
181 if ( flops1 <= flops2 ) {
183 work = malloc( (M * B->rk + M * N) *
sizeof(
double) );
194 cblas_dgemm( CblasColMajor, (CBLAS_TRANSPOSE)transA, (CBLAS_TRANSPOSE)transB,
200 cblas_dgemm( CblasColMajor, CblasNoTrans, (CBLAS_TRANSPOSE)transB,
210 work = malloc( (K * N + M * N) *
sizeof(
double) );
221 cblas_dgemm( CblasColMajor, CblasNoTrans, CblasNoTrans,
227 cblas_dgemm( CblasColMajor, (CBLAS_TRANSPOSE)transA, (CBLAS_TRANSPOSE)transB,
241 AB->
rkmax = B->rkmax;
246 work = malloc( M * B->rk *
sizeof(
double) );
251 cblas_dgemm( CblasColMajor, CblasNoTrans, (CBLAS_TRANSPOSE)transB,
256 flops = FLOPS_DGEMM( M, B->rk, K );
308 ldav = ( A->rk == -1 ) ? -1 : A->rkmax;
314 if ( A->rk > Arkmin ) {
319 pastix_fixdbl_t flops1 = FLOPS_DGEMM( A->rk, N, K ) + FLOPS_DGEMM( M, N, A->rk );
320 pastix_fixdbl_t flops2 = FLOPS_DGEMM( M, K, A->rk ) + FLOPS_DGEMM( M, N, K );
327 if ( flops1 <= flops2 ) {
329 work = malloc( (A->rk * N + M * N) *
sizeof(
double) );
340 cblas_dgemm( CblasColMajor, CblasNoTrans, (CBLAS_TRANSPOSE)transB,
344 (dzero), tmp, A->rk );
346 cblas_dgemm( CblasColMajor, CblasNoTrans, CblasNoTrans,
356 work = malloc( (M * K + M * N) *
sizeof(
double) );
367 cblas_dgemm( CblasColMajor, CblasNoTrans, CblasNoTrans,
373 cblas_dgemm( CblasColMajor, (CBLAS_TRANSPOSE)transA, (CBLAS_TRANSPOSE)transB,
392 work = malloc( A->rk * N *
sizeof(
double) );
397 cblas_dgemm( CblasColMajor, CblasNoTrans, (CBLAS_TRANSPOSE)transB,
401 (dzero), AB->
v, AB->
rkmax );
403 flops = FLOPS_DGEMM( A->rk, N, K );
453 assert( A->rk <= A->rkmax && A->rk > 0 );
454 assert( B->rk <= B->rkmax && B->rk > 0 );
459 ldau = (A->rk == -1) ? A->rkmax : M;
461 ldbu = (B->rk == -1) ? B->rkmax : N;
465 work2 = malloc( A->rk * B->rk *
sizeof(
double) );
472 cblas_dgemm( CblasColMajor, CblasNoTrans, (CBLAS_TRANSPOSE)transB,
476 (dzero), work2, A->rk );
477 flops = FLOPS_DGEMM( A->rk, B->rk, K );
482 flops += lowrank->core_ge2lr( lowrank->use_reltol, lowrank->tolerance, -1, A->rk, B->rk, work2, A->rk, &rArB );
487 if ( rArB.
rk == -1 ) {
488 if ( A->rk <= B->rk ) {
494 work = malloc( A->rk * N *
sizeof(
double) );
504 cblas_dgemm( CblasColMajor, CblasNoTrans, (CBLAS_TRANSPOSE)transB,
506 (done), work2, A->rk,
508 (dzero), AB->
v, AB->
rkmax );
509 flops += FLOPS_DGEMM( A->rk, N, B->rk );
517 work = malloc( B->rk * M *
sizeof(
double) );
526 cblas_dgemm( CblasColMajor, CblasNoTrans, CblasNoTrans,
531 flops += FLOPS_DGEMM( M, B->rk, A->rk );
536 else if ( rArB.
rk == 0 ) {
548 work = malloc( (M + N) * rArB.
rk *
sizeof(
double) );
555 AB->
v = work + M * rArB.
rk;
558 cblas_dgemm( CblasColMajor, CblasNoTrans, CblasNoTrans,
564 cblas_dgemm( CblasColMajor, CblasNoTrans, (CBLAS_TRANSPOSE)transB,
566 (done), rArB.
v, rArB.
rkmax,
568 (dzero), AB->
v, rArB.
rk );
570 flops += FLOPS_DGEMM( M, rArB.
rk, A->rk ) + FLOPS_DGEMM( rArB.
rk, N, B->rk );
BEGIN_C_DECLS typedef int pastix_int_t
#define PASTE_CORE_DLRMM_VOID
Void all the parameters of the core_dlrmm family functions to silent warnings.
static double * core_dlrmm_getws(core_dlrmm_t *params, ssize_t newsize)
Function to get a workspace pointer if space is available in the one provided.
pastix_fixdbl_t core_dfrfr2lr(core_dlrmm_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.
pastix_fixdbl_t core_dlrlr2lr(core_dlrmm_t *params, pastix_lrblock_t *AB, int *infomask)
Perform the operation AB = op(A) * op(B), with A, B, and AB low-rank.
#define PASTE_CORE_DLRMM_PARAMS(_a_)
Initialize all the parameters of the core_dlrmm family functions to ease the access.
pastix_fixdbl_t core_dfrlr2lr(core_dlrmm_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_dlrfr2lr(core_dlrmm_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.
Structure to store all the parameters of the core_dlrmm family functions.
#define PASTIX_LRM3_ALLOCV
Macro to specify if the V part of a low-rank matrix has been allocated and need to be freed or not (U...
#define PASTIX_LRM3_TRANSB
Macro to specify if the the operator on B, still needs to be applied to the V part of the low-rank ma...
#define PASTIX_LRM3_ALLOCU
Macro to specify if the U part of a low-rank matrix has been allocated and need to be freed or not (U...
#define PASTIX_LRM3_ORTHOU
Macro to specify if the U part of a low-rank matrix is orthogonal or not (Used in LRMM functions).
The block low-rank structure to hold a matrix in low-rank form.
void core_dlrfree(pastix_lrblock_t *A)
Free a low-rank matrix.