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_chblrx.c
Go to the documentation of this file.
1 
15 #include <lapacke.h>
16 #include "common.h"
17 
18 /***************************************************************************/
68 /***************************************************************************/
72 #define A(_m, _n) (PLASMA_Complex32_t *)plasma_geteltaddr(A, ((_m)-1), ((_n)-1), eltsize)
73 #define V(_m) &(V[(_m)-1])
74 #define TAU(_m) &(TAU[(_m)-1])
75 int
76 CORE_chblrx(int uplo, int N,
77  PLASMA_desc *A,
80  int st,
81  int ed,
82  int eltsize)
83 {
84  int NB, J1, J2;
85  int len1, len2, t1ed, t2st;
86  int i;
87  PLASMA_desc vA=*A;
88 
89  /* Check input arguments */
90  if (N < 0) {
91  coreblas_error(2, "Illegal value of N");
92  return -2;
93  }
94  if (ed <= st) {
95  coreblas_error(6, "Illegal value of st and ed (internal)");
96  return -6;
97  }
98 
99  /* Quick return */
100  if (N == 0)
101  return PLASMA_SUCCESS;
102 
103  NB = A->mb;
104  if( uplo == PlasmaLower ){
105  /* ========================
106  * LOWER CASE
107  * ========================*/
108  for (i = ed; i >= st+1 ; i--){
109  /* apply reflector from the left (horizontal row) and from the right for only the diagonal 2x2.*/
110  J1 = st;
111  J2 = i-2;
112  t1ed = (J2/NB)*NB;
113  t2st = max(t1ed+1,J1);
114  len1 = t1ed-J1+1;
115  len2 = J2-t2st+1;
116  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) );
117  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) );
118  CORE_clarfx2c(PlasmaLower, *V(i), *TAU(i), A(i-1,i-1), A(i,i-1), A(i,i));
119  }
120  /* APPLY RIGHT ON THE REMAINING ELEMENT OF KERNEL 1 */
121  for (i = ed; i >= st+1 ; i--){
122  J1 = i+1;
123  J2 = min(ed,N);
124  t1ed = (J2/NB)*NB;
125  t2st = max(t1ed+1,J1);
126  len1 = t1ed-J1+1;
127  len2 = J2-t2st+1;
128  if(len1>0)CORE_clarfx2(PlasmaRight, len1, *V(i), *TAU(i), A(J1, i-1), ELTLDD(vA, J1) , A(J1 , i), ELTLDD(vA, J1) );
129  if(len2>0)CORE_clarfx2(PlasmaRight, len2, *V(i), *TAU(i), A(t2st,i-1), ELTLDD(vA, t2st), A(t2st, i), ELTLDD(vA, t2st) );
130  }
131  } else {
132  /* ========================
133  * UPPER CASE
134  * ========================*/
135  for (i = ed; i >= st+1 ; i--){
136  /* apply reflector from the left (horizontal row) and from the right for only the diagonal 2x2.*/
137  J1 = st;
138  J2 = i-2;
139  t1ed = (J2/NB)*NB;
140  t2st = max(t1ed+1,J1);
141  len1 = t1ed-J1+1;
142  len2 = J2-t2st+1;
143  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) );
144  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) );
145  CORE_clarfx2c(PlasmaUpper, *V(i), *TAU(i), A(i-1,i-1), A(i-1, i), A(i,i));
146  }
147  /* APPLY LEFT ON THE REMAINING ELEMENT OF KERNEL 1 */
148  for (i = ed; i >= st+1 ; i--){
149  J1 = i+1;
150  J2 = min(ed,N);
151  t1ed = (J2/NB)*NB;
152  t2st = max(t1ed+1,J1);
153  len1 = t1ed-J1+1;
154  len2 = J2-t2st+1;
155  if(len1>0)CORE_clarfx2(PlasmaLeft, len1 , conjf(*V(i)), *TAU(i), A(i-1, J1 ), ELTLDD(vA, i-1), A(i, J1 ), ELTLDD(vA, i) );
156  if(len2>0)CORE_clarfx2(PlasmaLeft, len2 , conjf(*V(i)), *TAU(i), A(i-1, t2st), ELTLDD(vA, i-1), A(i, t2st), ELTLDD(vA, i) );
157  }
158  } /* end of else for the upper case */
159 
160  return PLASMA_SUCCESS;
161 }