pzlaset.c 3.8 KB
Newer Older
1
2
/**
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
3
4
 * @copyright 2009-2014 The University of Tennessee and The University of
 *                      Tennessee Research Foundation. All rights reserved.
5
6
 * @copyright 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
 *                      Univ. Bordeaux. All rights reserved.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 *
 **/

/**
 *
 * @file pzlaset.c
 *
 *  MORSE auxiliary routines
 *  MORSE is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver
 *
 * @version 2.5.0
 * @comment This file has been automatically generated
 *          from Plasma 2.5.0 for MORSE 1.0.0
 * @author Hatem Ltaief
 * @author Mathieu Faverge
 * @author Emmanuel Agullo
 * @author Cedric Castagnede
 * @date 2010-11-15
 * @precisions normal z -> s d c
 *
 **/
29
#include "control/common.h"
30
31

#define A(m,n) A,  m,  n
Mathieu Faverge's avatar
Mathieu Faverge committed
32
/*******************************************************************************
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 *  Parallel initialization a 2-D array A to BETA on the diagonal and
 *  ALPHA on the offdiagonals.
 **/
void morse_pzlaset(MORSE_enum uplo,
                          MORSE_Complex64_t alpha, MORSE_Complex64_t beta,
                          MORSE_desc_t *A,
                          MORSE_sequence_t *sequence, MORSE_request_t *request)
{
    MORSE_context_t *morse;
    MORSE_option_t options;

    int i, j;
    int ldai, ldaj;
    int tempim;
    int tempjm, tempjn;
48
    int minmn = chameleon_min(A->mt, A->nt);
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

    morse = morse_context_self();
    if (sequence->status != MORSE_SUCCESS)
        return;

    RUNTIME_options_init(&options, morse, sequence, request);

    if (uplo == MorseLower) {
       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);
           MORSE_TASK_zlaset(
               &options,
               MorseLower, tempjm, tempjn, alpha, beta,
               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);
               MORSE_TASK_zlaset(
                   &options,
                   MorseUpperLower, tempim, tempjn, alpha, alpha,
                   A(i, j), ldai);
           }
       }
    }
    else if (uplo == MorseUpper) {
       for (j = 1; j < A->nt; j++){
           tempjn = j == A->nt-1 ? A->n-j*A->nb : A->nb;
79
           for (i = 0; i < chameleon_min(j, A->mt); i++){
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
               tempim = i == A->mt-1 ? A->m-i*A->mb : A->mb;
               ldai = BLKLDD(A, i);
               MORSE_TASK_zlaset(
                   &options,
                   MorseUpperLower, tempim, tempjn, alpha, alpha,
                   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);
           MORSE_TASK_zlaset(
               &options,
               MorseUpper, tempjm, tempjn, alpha, beta,
               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;
               MORSE_TASK_zlaset(
                   &options,
                   MorseUpperLower, tempim, tempjn, alpha, alpha,
                   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);
           MORSE_TASK_zlaset(
               &options,
               MorseUpperLower, tempjm, tempjn, alpha, beta,
               A(j, j), ldaj);
       }
    }
    RUNTIME_options_finalize(&options, morse);
}