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