pzlaset2.c 3.23 KB
Newer Older
1
/**
2 3
 *
 * @file pzlaset2.c
4
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
5 6
 * @copyright 2009-2014 The University of Tennessee and The University of
 *                      Tennessee Research Foundation. All rights reserved.
Mathieu Faverge's avatar
Mathieu Faverge committed
7
 * @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8
 *                      Univ. Bordeaux. All rights reserved.
9
 *
10
 ***
11
 *
12
 * @brief Chameleon zlaset2 parallel algorithm
13
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
14
 * @version 1.0.0
15
 * @comment This file has been automatically generated
16
 *          from Plasma 2.5.0 for CHAMELEON 1.0.0
17 18 19 20 21 22 23
 * @author Hatem Ltaief
 * @author Mathieu Faverge
 * @author Emmanuel Agullo
 * @author Cedric Castagnede
 * @date 2010-11-15
 * @precisions normal z -> s d c
 *
24
 */
25
#include "control/common.h"
26 27

#define A(m,n) A,  m,  n
28
/**
29 30
 *  Parallel initializztion a 2-D array A to 
 *  ALPHA on the offdiagonals.
31
 */
Mathieu Faverge's avatar
Mathieu Faverge committed
32
void chameleon_pzlaset2(cham_uplo_t uplo, CHAMELEON_Complex64_t alpha, 
33 34
                           CHAM_desc_t *A,
                           RUNTIME_sequence_t *sequence, RUNTIME_request_t *request)
35
{
Mathieu Faverge's avatar
Mathieu Faverge committed
36
    CHAM_context_t *chamctxt;
37
    RUNTIME_option_t options;
38 39 40 41 42

    int i, j;
    int ldai, ldaj;
    int tempim;
    int tempjm, tempjn;
43
    int minmn = chameleon_min(A->mt, A->nt);
44

Mathieu Faverge's avatar
Mathieu Faverge committed
45
    chamctxt = chameleon_context_self();
Mathieu Faverge's avatar
Mathieu Faverge committed
46
    if (sequence->status != CHAMELEON_SUCCESS) {
47
        return;
Mathieu Faverge's avatar
Mathieu Faverge committed
48
    }
49

Mathieu Faverge's avatar
Mathieu Faverge committed
50
    RUNTIME_options_init(&options, chamctxt, sequence, request);
51

52
    if (uplo == ChamLower) {
53 54 55 56
       for (j = 0; j < minmn; j++){
           tempjm = j == A->mt-1 ? A->m-j*A->mb : A->mb;
           tempjn = j == A->nt-1 ? A->n-j*A->nb : A->nb;
           ldaj = BLKLDD(A, j);
57
           INSERT_TASK_zlaset2(
58
               &options,
59
               ChamLower, tempjm, tempjn, alpha,
60 61 62 63 64
               A(j, j), ldaj);

           for (i = j+1; i < A->mt; i++){
               tempim = i == A->mt-1 ? A->m-i*A->mb : A->mb;
               ldai = BLKLDD(A, i);
65
               INSERT_TASK_zlaset2(
66
                   &options,
67
                   ChamUpperLower, tempim, tempjn, alpha,
68 69 70 71
                   A(i, j), ldai);
           }
       }
    }
72
    else if (uplo == ChamUpper) {
73 74
       for (j = 1; j < A->nt; j++){
           tempjn = j == A->nt-1 ? A->n-j*A->nb : A->nb;
75
           for (i = 0; i < chameleon_min(j, A->mt); i++){
76 77
               tempim = i == A->mt-1 ? A->m-i*A->mb : A->mb;
               ldai = BLKLDD(A, i);
78
               INSERT_TASK_zlaset2(
79
                   &options,
80
                   ChamUpperLower, tempim, tempjn, alpha,
81 82 83 84 85 86 87
                   A(i, j), ldai);
           }
       }
       for (j = 0; j < minmn; j++){
           tempjm = j == A->mt-1 ? A->m-j*A->mb : A->mb;
           tempjn = j == A->nt-1 ? A->n-j*A->nb : A->nb;
           ldaj = BLKLDD(A, j);
88
           INSERT_TASK_zlaset2(
89
               &options,
90
               ChamUpper, tempjm, tempjn, alpha,
91 92 93 94 95 96 97 98 99
               A(j, j), ldaj);
       }
    }
    else {
       for (i = 0; i < A->mt; i++){
           tempim = i == A->mt-1 ? A->m-i*A->mb : A->mb;
           ldai = BLKLDD(A, i);
           for (j = 0; j < A->nt; j++){
               tempjn = j == A->nt-1 ? A->n-j*A->nb : A->nb;
100
               INSERT_TASK_zlaset2(
101
                   &options,
102
                   ChamUpperLower, tempim, tempjn, alpha,
103 104 105
                   A(i, j), ldai);
           }
       }
106
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
107
    RUNTIME_options_finalize(&options, chamctxt);
108
}