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_zgelqt.c
Go to the documentation of this file.
1 
17 #include <lapacke.h>
18 #include "common.h"
19 
20 /***************************************************************************/
81 #if defined(PLASMA_HAVE_WEAK)
82 #pragma weak CORE_zgelqt = PCORE_zgelqt
83 #define CORE_zgelqt PCORE_zgelqt
84 #endif
85 int CORE_zgelqt(int M, int N, int IB,
86  PLASMA_Complex64_t *A, int LDA,
87  PLASMA_Complex64_t *T, int LDT,
89  PLASMA_Complex64_t *WORK)
90 {
91  int i, k, sb;
92 
93  /* Check input arguments */
94  if (M < 0) {
95  coreblas_error(1, "Illegal value of M");
96  return -1;
97  }
98  if (N < 0) {
99  coreblas_error(2, "Illegal value of N");
100  return -2;
101  }
102  if ((IB < 0) || ( (IB == 0) && ((M > 0) && (N > 0)) )) {
103  coreblas_error(3, "Illegal value of IB");
104  return -3;
105  }
106  if ((LDA < max(1,M)) && (M > 0)) {
107  coreblas_error(5, "Illegal value of LDA");
108  return -5;
109  }
110  if ((LDT < max(1,IB)) && (IB > 0)) {
111  coreblas_error(7, "Illegal value of LDT");
112  return -7;
113  }
114 
115  /* Quick return */
116  if ((M == 0) || (N == 0) || (IB == 0))
117  return PLASMA_SUCCESS;
118 
119  k = min(M, N);
120 
121  for(i = 0; i < k; i += IB) {
122  sb = min(IB, k-i);
123 
124  LAPACKE_zgelq2_work(LAPACK_COL_MAJOR, sb, N-i,
125  &A[LDA*i+i], LDA, &TAU[i], WORK);
126 
127  LAPACKE_zlarft_work(LAPACK_COL_MAJOR,
130  N-i, sb,
131  &A[LDA*i+i], LDA, &TAU[i],
132  &T[LDT*i], LDT);
133 
134  if (M > i+sb) {
135  LAPACKE_zlarfb_work(
136  LAPACK_COL_MAJOR,
141  M-i-sb, N-i, sb,
142  &A[LDA*i+i], LDA,
143  &T[LDT*i], LDT,
144  &A[LDA*i+(i+sb)], LDA,
145  WORK, M-i-sb);
146  }
147  }
148  return PLASMA_SUCCESS;
149 }
150 
151 /***************************************************************************/
154 void QUARK_CORE_zgelqt(Quark *quark, Quark_Task_Flags *task_flags,
155  int m, int n, int ib, int nb,
156  PLASMA_Complex64_t *A, int lda,
157  PLASMA_Complex64_t *T, int ldt)
158 {
160  QUARK_Insert_Task(quark, CORE_zgelqt_quark, task_flags,
161  sizeof(int), &m, VALUE,
162  sizeof(int), &n, VALUE,
163  sizeof(int), &ib, VALUE,
164  sizeof(PLASMA_Complex64_t)*nb*nb, A, INOUT,
165  sizeof(int), &lda, VALUE,
166  sizeof(PLASMA_Complex64_t)*ib*nb, T, OUTPUT,
167  sizeof(int), &ldt, VALUE,
168  sizeof(PLASMA_Complex64_t)*nb, NULL, SCRATCH,
169  sizeof(PLASMA_Complex64_t)*ib*nb, NULL, SCRATCH,
170  0);
171 }
172 
173 /***************************************************************************/
176 #if defined(PLASMA_HAVE_WEAK)
177 #pragma weak CORE_zgelqt_quark = PCORE_zgelqt_quark
178 #define CORE_zgelqt_quark PCORE_zgelqt_quark
179 #endif
181 {
182  int m;
183  int n;
184  int ib;
186  int lda;
188  int ldt;
190  PLASMA_Complex64_t *WORK;
191 
192  quark_unpack_args_9(quark, m, n, ib, A, lda, T, ldt, TAU, WORK);
193  CORE_zgelqt(m, n, ib, A, lda, T, ldt, TAU, WORK);
194 }