PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
core_cgbelr.c
Go to the documentation of this file.
1 
15 #include <lapacke.h>
16 #include "common.h"
17 /***************************************************************************/
70 /***************************************************************************/
74 #define A(_m, _n) (PLASMA_Complex32_t *)plasma_geteltaddr(A, ((_m)-1), ((_n)-1), eltsize)
75 #define V(_m) &(V[(_m)-1])
76 #define TAU(_m) &(TAU[(_m)-1])
77 int
78 CORE_cgbelr(int uplo, int N,
79  PLASMA_desc *A,
82  int st,
83  int ed,
84  int eltsize)
85 {
86  int NB, J1, J2;
87  int len1, len2, t1ed, t2st;
88  int i;
89  static PLASMA_Complex32_t zzero = 0.0;
90  PLASMA_desc vA=*A;
91 
92  /* Check input arguments */
93  if (N < 0) {
94  coreblas_error(2, "Illegal value of N");
95  return -2;
96  }
97  if (ed <= st) {
98  coreblas_error(6, "Illegal value of st and ed (internal)");
99  return -6;
100  }
101 
102  /* Quick return */
103  if (N == 0)
104  return PLASMA_SUCCESS;
105 
106  NB = A->mb;
107  if( uplo == PlasmaLower ){
108  /* ========================
109  * LOWER CASE
110  * ========================*/
111  for (i = ed; i >= st+1 ; i--){
112  /* generate Householder to annihilate a(i+k-1,i) within the band*/
113  *V(i) = *A(i, (st-1));
114  *A(i, (st-1)) = zzero;
115  LAPACKE_clarfg_work( 2, A((i-1),(st-1)), V(i), 1, TAU(i));
116 
117  /* apply reflector from the left (horizontal row) and from the right for only the diagonal 2x2.*/
118  J1 = st;
119  J2 = i-2;
120  t1ed = (J2/NB)*NB;
121  t2st = max(t1ed+1,J1);
122  len1 = t1ed-J1+1;
123  len2 = J2-t2st+1;
124  if(len1>0)CORE_clarfx2(PlasmaLeft, len1 , *V(i), conjf(*TAU(i)), A(i-1, J1 ), ELTLDD(vA, (i-1)), A(i, J1 ), ELTLDD(vA, i) );
125  if(len2>0)CORE_clarfx2(PlasmaLeft, len2 , *V(i), conjf(*TAU(i)), A(i-1, t2st), ELTLDD(vA, (i-1)), A(i, t2st), ELTLDD(vA, i) );
126  CORE_clarfx2ce(PlasmaLower, V(i), TAU(i), A(i-1,i-1), A(i,i-1), A(i,i));
127  }
128  /* APPLY RIGHT ON THE REMAINING ELEMENT OF KERNEL 1 */
129  for (i = ed; i >= st+1 ; i--){
130  J1 = i+1;
131  J2 = min(ed,N);
132  t1ed = (J2/NB)*NB;
133  t2st = max(t1ed+1,J1);
134  len1 = t1ed-J1+1;
135  len2 = J2-t2st+1;
136  if(len1>0)CORE_clarfx2(PlasmaRight, len1, conjf(*V(i)), conjf(*TAU(i)), A(J1,i-1), ELTLDD(vA, J1) , A(J1 , i), ELTLDD(vA, J1) );
137  if(len2>0)CORE_clarfx2(PlasmaRight, len2, conjf(*V(i)), conjf(*TAU(i)), A(t2st,i-1), ELTLDD(vA, t2st), A(t2st, i), ELTLDD(vA, t2st) );
138  }
139  } else {
140  /* ========================
141  * UPPER CASE
142  * ========================*/
143  for (i = ed; i >= st+1 ; i--){
144  /* generate Householder to annihilate a(i+k-1,i) within the band*/
145  *V(i) = *A((st-1), i);
146  *A((st-1), i) = zzero;
147  LAPACKE_clarfg_work( 2, A((st-1), (i-1)), V(i), 1, TAU(i));
148 
149  /* apply reflector from the left (horizontal row) and from the right for only the diagonal 2x2.*/
150  J1 = st;
151  J2 = i-2;
152  t1ed = (J2/NB)*NB;
153  t2st = max(t1ed+1,J1);
154  len1 = t1ed-J1+1;
155  len2 = J2-t2st+1;
156  if(len1>0)CORE_clarfx2(PlasmaRight, len1, conjf(*V(i)), conjf(*TAU(i)), A(J1,i-1), ELTLDD(vA, J1) , A(J1 , i), ELTLDD(vA, J1) );
157  if(len2>0)CORE_clarfx2(PlasmaRight, len2, conjf(*V(i)), conjf(*TAU(i)), A(t2st,i-1), ELTLDD(vA, t2st), A(t2st, i), ELTLDD(vA, t2st) );
158  CORE_clarfx2ce(PlasmaUpper, V(i), TAU(i), A((i-1),(i-1)), A((i-1), i), A(i,i));
159  }
160  /* APPLY LEFT ON THE REMAINING ELEMENT OF KERNEL 1*/
161  for (i = ed; i >= st+1 ; i--){
162  J1 = i+1;
163  J2 = min(ed,N);
164  t1ed = (J2/NB)*NB;
165  t2st = max(t1ed+1,J1);
166  len1 = t1ed-J1+1;
167  len2 = J2-t2st+1;
168  if(len1>0)CORE_clarfx2(PlasmaLeft, len1 , *V(i), conjf(*TAU(i)), A(i-1, J1 ), ELTLDD(vA, (i-1)), A(i, J1 ), ELTLDD(vA, i) );
169  if(len2>0)CORE_clarfx2(PlasmaLeft, len2 , *V(i), conjf(*TAU(i)), A(i-1, t2st), ELTLDD(vA, (i-1)), A(i, t2st), ELTLDD(vA, i) );
170  }
171  } /* end of else for the upper case*/
172 
173  return PLASMA_SUCCESS;
174 
175 }