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
ztrtri.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
71  PLASMA_Complex64_t *A, int LDA)
72 {
73  int NB;
74  int status;
76  PLASMA_sequence *sequence = NULL;
78  PLASMA_desc descA;
79 
80  plasma = plasma_context_self();
81  if (plasma == NULL) {
82  plasma_fatal_error("PLASMA_ztrtri", "PLASMA not initialized");
84  }
85  /* Check input arguments */
86  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
87  plasma_error("PLASMA_ztrtri", "illegal value of uplo");
88  return -1;
89  }
90  if (diag != PlasmaUnit && diag != PlasmaNonUnit) {
91  plasma_error("PLASMA_ztrtri", "illegal value of diag");
92  return -2;
93  }
94  if (N < 0) {
95  plasma_error("PLASMA_ztrtri", "illegal value of N");
96  return -3;
97  }
98  if (LDA < max(1, N)) {
99  plasma_error("PLASMA_ztrtri", "illegal value of LDA");
100  return -5;
101  }
102  /* Quick return */
103  if (max(N, 0) == 0)
104  return PLASMA_SUCCESS;
105 
106  /* Tune NB depending on M, N & NRHS; Set NBNB */
107  status = plasma_tune(PLASMA_FUNC_ZPOSV, N, N, 0);
108  if (status != PLASMA_SUCCESS) {
109  plasma_error("PLASMA_ztrtri", "plasma_tune() failed");
110  return status;
111  }
112 
113  /* Set NT */
114  NB = PLASMA_NB;
115 
116  plasma_sequence_create(plasma, &sequence);
117 
119  plasma_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, plasma_desc_mat_free(&(descA)) );
120  } else {
121  plasma_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N);
122  }
123 
124  /* Call the tile interface */
125  PLASMA_ztrtri_Tile_Async(uplo, diag, &descA, sequence, &request);
126 
128  plasma_zooptile2lap( descA, A, NB, NB, LDA, N );
130  plasma_desc_mat_free(&descA);
131  } else {
132  plasma_ziptile2lap( descA, A, NB, NB, LDA, N );
134  }
135 
136  status = sequence->status;
137  plasma_sequence_destroy(plasma, sequence);
138  return status;
139 }
140 
141 /***************************************************************************/
192 {
194  PLASMA_sequence *sequence = NULL;
196  int status;
197 
198  plasma = plasma_context_self();
199  if (plasma == NULL) {
200  plasma_fatal_error("PLASMA_ztrtri_Tile", "PLASMA not initialized");
202  }
203  plasma_sequence_create(plasma, &sequence);
204  PLASMA_ztrtri_Tile_Async(uplo, diag, A, sequence, &request);
206  status = sequence->status;
207  plasma_sequence_destroy(plasma, sequence);
208  return status;
209 }
210 
211 /***************************************************************************/
241  PLASMA_sequence *sequence, PLASMA_request *request)
242 {
243  PLASMA_desc descA = *A;
245 
246  plasma = plasma_context_self();
247  if (plasma == NULL) {
248  plasma_fatal_error("PLASMA_ztrtri_Tile", "PLASMA not initialized");
250  }
251  if (sequence == NULL) {
252  plasma_fatal_error("PLASMA_ztrtri_Tile", "NULL sequence");
253  return PLASMA_ERR_UNALLOCATED;
254  }
255  if (request == NULL) {
256  plasma_fatal_error("PLASMA_ztrtri_Tile", "NULL request");
257  return PLASMA_ERR_UNALLOCATED;
258  }
259  /* Check sequence status */
260  if (sequence->status == PLASMA_SUCCESS)
261  request->status = PLASMA_SUCCESS;
262  else
263  return plasma_request_fail(sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
264 
265  /* Check descriptors for correctness */
266  if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
267  plasma_error("PLASMA_ztrtri_Tile", "invalid descriptor");
268  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
269  }
270  /* Check input arguments */
271  if (descA.nb != descA.mb) {
272  plasma_error("PLASMA_ztrtri_Tile", "only square tiles supported");
273  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
274  }
275  if (uplo != PlasmaUpper && uplo != PlasmaLower) {
276  plasma_error("PLASMA_ztrtri_Tile", "illegal value of uplo");
277  return plasma_request_fail(sequence, request, -1);
278  }
279  if (diag != PlasmaUnit && diag != PlasmaNonUnit) {
280  plasma_error("PLASMA_ztrtri_Tile", "illegal value of diag");
281  return plasma_request_fail(sequence, request, -2);
282  }
283  /* Quick return */
284 /*
285  if (max(N, 0) == 0)
286  return PLASMA_SUCCESS;
287 */
288  plasma_dynamic_call_5(plasma_pztrtri,
289  PLASMA_enum, uplo,
290  PLASMA_enum, diag,
291  PLASMA_desc, descA,
292  PLASMA_sequence*, sequence,
293  PLASMA_request*, request);
294 
295  return PLASMA_SUCCESS;
296 }