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_zgetrf_incpiv.c
Go to the documentation of this file.
1 
17 #include <lapacke.h>
18 #include "common.h"
19 
20 /***************************************************************************/
74 #if defined(PLASMA_HAVE_WEAK)
75 #pragma weak CORE_zgetrf_incpiv = PCORE_zgetrf_incpiv
76 #define CORE_zgetrf_incpiv PCORE_zgetrf_incpiv
77 #define CORE_zgessm PCORE_zgessm
78 int CORE_zgessm(int M, int N, int K, int IB,
79  int *IPIV,
80  PLASMA_Complex64_t *L, int LDL,
81  PLASMA_Complex64_t *A, int LDA);
82 #endif
83 int CORE_zgetrf_incpiv(int M, int N, int IB,
84  PLASMA_Complex64_t *A, int LDA,
85  int *IPIV, int *INFO)
86 {
87  int i, j, k, sb;
88  int iinfo;
89 
90  /* Check input arguments */
91  *INFO = 0;
92  if (M < 0) {
93  coreblas_error(1, "Illegal value of M");
94  return -1;
95  }
96  if (N < 0) {
97  coreblas_error(2, "Illegal value of N");
98  return -2;
99  }
100  if (IB < 0) {
101  coreblas_error(3, "Illegal value of IB");
102  return -3;
103  }
104  if ((LDA < max(1,M)) && (M > 0)) {
105  coreblas_error(5, "Illegal value of LDA");
106  return -5;
107  }
108 
109  /* Quick return */
110  if ((M == 0) || (N == 0) || (IB == 0))
111  return PLASMA_SUCCESS;
112 
113  k = min(M, N);
114 
115  for(i =0 ; i < k; i += IB) {
116  sb = min(IB, k-i);
117  /*
118  * Factor diagonal and subdiagonal blocks and test for exact singularity.
119  */
120  iinfo = LAPACKE_zgetf2_work(LAPACK_COL_MAJOR, M-i, sb, &A[LDA*i+i], LDA, &IPIV[i]);
121  /*
122  * Adjust INFO and the pivot indices.
123  */
124  if((*INFO == 0) && (iinfo > 0))
125  *INFO = iinfo + i;
126 
127  if (i+sb < N) {
128  CORE_zgessm(
129  M-i, N-(i+sb), sb, sb,
130  &IPIV[i],
131  &A[LDA*i+i], LDA,
132  &A[LDA*(i+sb)+i], LDA);
133  }
134 
135  for(j = i; j < i+sb; j++) {
136  IPIV[j] = i + IPIV[j];
137  }
138  }
139  return PLASMA_SUCCESS;
140 }
141 
142 /***************************************************************************/
146  int m, int n, int ib, int nb,
147  PLASMA_Complex64_t *A, int lda,
148  int *IPIV,
149  PLASMA_sequence *sequence, PLASMA_request *request,
150  PLASMA_bool check_info, int iinfo)
151 {
153  QUARK_Insert_Task(quark, CORE_zgetrf_incpiv_quark, task_flags,
154  sizeof(int), &m, VALUE,
155  sizeof(int), &n, VALUE,
156  sizeof(int), &ib, VALUE,
157  sizeof(PLASMA_Complex64_t)*nb*nb, A, INOUT,
158  sizeof(int), &lda, VALUE,
159  sizeof(int)*nb, IPIV, OUTPUT,
160  sizeof(PLASMA_sequence*), &sequence, VALUE,
161  sizeof(PLASMA_request*), &request, VALUE,
162  sizeof(PLASMA_bool), &check_info, VALUE,
163  sizeof(int), &iinfo, VALUE,
164  0);
165 }
166 
167 /***************************************************************************/
170 #if defined(PLASMA_HAVE_WEAK)
171 #pragma weak CORE_zgetrf_incpiv_quark = PCORE_zgetrf_incpiv_quark
172 #define CORE_zgetrf_incpiv_quark PCORE_zgetrf_incpiv_quark
173 #endif
175 {
176  int m;
177  int n;
178  int ib;
180  int lda;
181  int *IPIV;
182  PLASMA_sequence *sequence;
183  PLASMA_request *request;
184  PLASMA_bool check_info;
185  int iinfo;
186 
187  int info;
188 
189  quark_unpack_args_10(quark, m, n, ib, A, lda, IPIV, sequence, request, check_info, iinfo);
190  CORE_zgetrf_incpiv(m, n, ib, A, lda, IPIV, &info);
191  if (info != PLASMA_SUCCESS && check_info)
192  plasma_sequence_flush(quark, sequence, request, iinfo+info);
193 }