MAGMA  magma-1.4.0
Matrix Algebra on GPU and Multicore Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
cpanel_to_q.cpp
Go to the documentation of this file.
1 /*
2  -- MAGMA (version 1.4.0) --
3  Univ. of Tennessee, Knoxville
4  Univ. of California, Berkeley
5  Univ. of Colorado, Denver
6  August 2013
7 
8  @author Mark Gates
9  @generated c Tue Aug 13 19:13:19 2013
10 */
11 #include "common_magma.h"
12 
13 // -------------------------
14 // Put 0s in the upper triangular part of a panel and 1s on the diagonal.
15 // Stores previous values in work array, to be restored later with cq_to_panel.
16 extern "C"
17 void cpanel_to_q(char uplo, magma_int_t ib, magmaFloatComplex *A, magma_int_t lda, magmaFloatComplex *work)
18 {
19  int i, j, k = 0;
20  magmaFloatComplex *col;
21  magmaFloatComplex c_zero = MAGMA_C_ZERO;
22  magmaFloatComplex c_one = MAGMA_C_ONE;
23 
24  if (uplo == 'U' || uplo == 'u'){
25  for(i = 0; i < ib; ++i){
26  col = A + i*lda;
27  for(j = 0; j < i; ++j){
28  work[k] = col[j];
29  col [j] = c_zero;
30  ++k;
31  }
32 
33  work[k] = col[i];
34  col [j] = c_one;
35  ++k;
36  }
37  }
38  else {
39  for(i=0; i<ib; ++i){
40  col = A + i*lda;
41  work[k] = col[i];
42  col [i] = c_one;
43  ++k;
44  for(j=i+1; j<ib; ++j){
45  work[k] = col[j];
46  col [j] = c_zero;
47  ++k;
48  }
49  }
50  }
51 }
52 
53 
54 // -------------------------
55 // Restores a panel, after call to cpanel_to_q.
56 extern "C"
57 void cq_to_panel(char uplo, magma_int_t ib, magmaFloatComplex *A, magma_int_t lda, magmaFloatComplex *work)
58 {
59  int i, j, k = 0;
60  magmaFloatComplex *col;
61 
62  if (uplo == 'U' || uplo == 'u'){
63  for(i = 0; i < ib; ++i){
64  col = A + i*lda;
65  for(j = 0; j <= i; ++j){
66  col[j] = work[k];
67  ++k;
68  }
69  }
70  }
71  else {
72  for(i = 0; i < ib; ++i){
73  col = A + i*lda;
74  for(j = i; j < ib; ++j){
75  col[j] = work[k];
76  ++k;
77  }
78  }
79  }
80 }
int magma_int_t
Definition: magmablas.h:12
void cq_to_panel(char uplo, magma_int_t ib, magmaFloatComplex *A, magma_int_t lda, magmaFloatComplex *work)
Definition: cpanel_to_q.cpp:57
void cpanel_to_q(char uplo, magma_int_t ib, magmaFloatComplex *A, magma_int_t lda, magmaFloatComplex *work)
Definition: cpanel_to_q.cpp:17
#define MAGMA_C_ONE
Definition: magma.h:154
#define A(i, j)
Definition: cprint.cpp:16
#define MAGMA_C_ZERO
Definition: magma.h:153