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
chegst.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
86  PLASMA_Complex32_t *A, int LDA,
87  PLASMA_Complex32_t *B, int LDB)
88 {
89  int NB;
90  int status;
92  PLASMA_sequence *sequence = NULL;
94  PLASMA_desc descA, descB;
95 
96  plasma = plasma_context_self();
97  if (plasma == NULL) {
98  plasma_fatal_error("PLASMA_chegst", "PLASMA not initialized");
100  }
101  /* Check input arguments */
102  if (itype != 1 && itype != 2 && itype != 3) {
103  plasma_error("PLASMA_chegst", "Illegal value of itype");
104  return -1;
105  }
106  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
107  plasma_error("PLASMA_chegst", "Illegal value of uplo");
108  return -2;
109  }
110  if (N < 0) {
111  plasma_error("PLASMA_chegst", "illegal value of N");
112  return -3;
113  }
114  if (LDA < max(1, N)) {
115  plasma_error("PLASMA_chegst", "illegal value of LDA");
116  return -5;
117  }
118  if (LDB < max(1, N)) {
119  plasma_error("PLASMA_chegst", "illegal value of LDB");
120  return -7;
121  }
122  /* Quick return */
123  if (N == 0)
124  return PLASMA_SUCCESS;
125 
126  /* Tune NB & IB depending on M, N & NRHS; Set NBNBSIZE */
127  status = plasma_tune(PLASMA_FUNC_CHEGST, N, N, 0);
128  if (status != PLASMA_SUCCESS) {
129  plasma_error("PLASMA_chegst", "plasma_tune() failed");
130  return status;
131  }
132 
133  /* Set NT */
134  NB = PLASMA_NB;
135 
136  plasma_sequence_create(plasma, &sequence);
137 
139  plasma_cooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, plasma_desc_mat_free(&(descA)) );
140  plasma_cooplap2tile( descB, B, NB, NB, LDB, N, 0, 0, N, N, plasma_desc_mat_free(&(descB)) );
141  } else {
142  plasma_ciplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N);
143  plasma_ciplap2tile( descB, B, NB, NB, LDB, N, 0, 0, N, N);
144  }
145 
146  /* Call the tile interface */
147  PLASMA_chegst_Tile_Async(itype, uplo, &descA, &descB, sequence, &request);
148 
150  plasma_cooptile2lap( descA, A, NB, NB, LDA, N );
151  plasma_cooptile2lap( descB, B, NB, NB, LDB, N );
153  plasma_desc_mat_free(&descA);
154  plasma_desc_mat_free(&descB);
155  } else {
156  plasma_ciptile2lap( descA, A, NB, NB, LDA, N );
157  plasma_ciptile2lap( descB, B, NB, NB, LDB, N );
159  }
160 
161  status = sequence->status;
162  plasma_sequence_destroy(plasma, sequence);
163  return status;
164 }
165 
166 /***************************************************************************/
234  PLASMA_desc *A,
235  PLASMA_desc *B)
236 {
238  PLASMA_sequence *sequence = NULL;
240  int status;
241 
242  plasma = plasma_context_self();
243  if (plasma == NULL) {
244  plasma_fatal_error("PLASMA_chegst_Tile", "PLASMA not initialized");
246  }
247  plasma_sequence_create(plasma, &sequence);
248  PLASMA_chegst_Tile_Async(itype, uplo, A, B, sequence, &request);
250  status = sequence->status;
251  plasma_sequence_destroy(plasma, sequence);
252  return status;
253 }
254 
255 /***************************************************************************/
292  PLASMA_desc *A,
293  PLASMA_desc *B,
294  PLASMA_sequence *sequence, PLASMA_request *request)
295 {
296  PLASMA_desc descA = *A;
297  PLASMA_desc descB = *B;
299 
300  plasma = plasma_context_self();
301  if (plasma == NULL) {
302  plasma_fatal_error("PLASMA_chegst_Tile", "PLASMA not initialized");
304  }
305  if (sequence == NULL) {
306  plasma_fatal_error("PLASMA_chegst_Tile", "NULL sequence");
307  return PLASMA_ERR_UNALLOCATED;
308  }
309  if (request == NULL) {
310  plasma_fatal_error("PLASMA_chegst_Tile", "NULL request");
311  return PLASMA_ERR_UNALLOCATED;
312  }
313  /* Check sequence status */
314  if (sequence->status == PLASMA_SUCCESS)
315  request->status = PLASMA_SUCCESS;
316  else
317  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
318 
319  /* Check descriptors for correctness */
320  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
321  plasma_error("PLASMA_chegst_Tile", "invalid first descriptor");
322  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
323  }
324  if (plasma_desc_check(&descB) != PLASMA_SUCCESS) {
325  plasma_error("PLASMA_chegst_Tile", "invalid second descriptor");
326  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
327  }
328  /* Check input arguments */
329  if (descA.nb != descA.mb) {
330  plasma_error("PLASMA_chegst_Tile", "only square tiles supported");
331  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
332  }
333 
334 
335  /*
336  * Transform Hermitian-definite generalized eigenproblem
337  * to standard form
338  */
339  plasma_dynamic_call_6(plasma_pchegst,
340  PLASMA_enum, itype,
341  PLASMA_enum, uplo,
342  PLASMA_desc, descA,
343  PLASMA_desc, descB,
344  PLASMA_sequence*, sequence,
345  PLASMA_request*, request);
346 
347  return PLASMA_SUCCESS;
348 }