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
zpotri.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
63  PLASMA_Complex64_t *A, int LDA)
64 {
65  int NB;
66  int status;
68  PLASMA_sequence *sequence = NULL;
70  PLASMA_desc descA;
71 
72  plasma = plasma_context_self();
73  if (plasma == NULL) {
74  plasma_fatal_error("PLASMA_zpotri", "PLASMA not initialized");
76  }
77  /* Check input arguments */
78  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
79  plasma_error("PLASMA_zpotri", "illegal value of uplo");
80  return -1;
81  }
82  if (N < 0) {
83  plasma_error("PLASMA_zpotri", "illegal value of N");
84  return -2;
85  }
86  if (LDA < max(1, N)) {
87  plasma_error("PLASMA_zpotri", "illegal value of LDA");
88  return -4;
89  }
90  /* Quick return */
91  if (max(N, 0) == 0)
92  return PLASMA_SUCCESS;
93 
94  /* Tune NB depending on M, N & NRHS; Set NBNB */
95  status = plasma_tune(PLASMA_FUNC_ZPOSV, N, N, 0);
96  if (status != PLASMA_SUCCESS) {
97  plasma_error("PLASMA_zpotri", "plasma_tune() failed");
98  return status;
99  }
100 
101  /* Set NT */
102  NB = PLASMA_NB;
103 
104  plasma_sequence_create(plasma, &sequence);
105 
107  plasma_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, plasma_desc_mat_free(&(descA)) );
108  } else {
109  plasma_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N);
110  }
111 
112  /* Call the tile interface */
113  PLASMA_zpotri_Tile_Async(uplo, &descA, sequence, &request);
114 
116  plasma_zooptile2lap( descA, A, NB, NB, LDA, N );
118  plasma_desc_mat_free(&descA);
119  } else {
120  plasma_ziptile2lap( descA, A, NB, NB, LDA, N );
122  }
123 
124  status = sequence->status;
125  plasma_sequence_destroy(plasma, sequence);
126  return status;
127 }
128 
129 /***************************************************************************/
173 {
175  PLASMA_sequence *sequence = NULL;
177  int status;
178 
179  plasma = plasma_context_self();
180  if (plasma == NULL) {
181  plasma_fatal_error("PLASMA_zpotri_Tile", "PLASMA not initialized");
183  }
184  plasma_sequence_create(plasma, &sequence);
185  PLASMA_zpotri_Tile_Async(uplo, A, sequence, &request);
187  status = sequence->status;
188  plasma_sequence_destroy(plasma, sequence);
189  return status;
190 }
191 
192 /***************************************************************************/
223  PLASMA_sequence *sequence, PLASMA_request *request)
224 {
225  PLASMA_desc descA = *A;
227 
228  plasma = plasma_context_self();
229  if (plasma == NULL) {
230  plasma_fatal_error("PLASMA_zpotri_Tile_Async", "PLASMA not initialized");
232  }
233  if (sequence == NULL) {
234  plasma_fatal_error("PLASMA_zpotri_Tile_Async", "NULL sequence");
235  return PLASMA_ERR_UNALLOCATED;
236  }
237  if (request == NULL) {
238  plasma_fatal_error("PLASMA_zpotri_Tile_Async", "NULL request");
239  return PLASMA_ERR_UNALLOCATED;
240  }
241  /* Check sequence status */
242  if (sequence->status == PLASMA_SUCCESS)
243  request->status = PLASMA_SUCCESS;
244  else
245  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
246 
247  /* Check descriptors for correctness */
248  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
249  plasma_error("PLASMA_zpotri_Tile_Async", "invalid descriptor");
250  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
251  }
252  /* Check input arguments */
253  if (descA.nb != descA.mb) {
254  plasma_error("PLASMA_zpotri_Tile_Async", "only square tiles supported");
255  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
256  }
257  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
258  plasma_error("PLASMA_zpotri_Tile_Async", "illegal value of uplo");
259  return plasma_request_fail(sequence, request, -1);
260  }
261  /* Quick return */
262 /*
263  if (max(N, 0) == 0)
264  return PLASMA_SUCCESS;
265 */
266  plasma_dynamic_call_5(plasma_pztrtri,
267  PLASMA_enum, uplo,
269  PLASMA_desc, descA,
270  PLASMA_sequence*, sequence,
271  PLASMA_request*, request);
272 
273  plasma_dynamic_call_4(plasma_pzlauum,
274  PLASMA_enum, uplo,
275  PLASMA_desc, descA,
276  PLASMA_sequence*, sequence,
277  PLASMA_request*, request);
278 
279  return PLASMA_SUCCESS;
280 }