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
zlanhe.c
Go to the documentation of this file.
1 
15 #include "common.h"
16 
17 /***************************************************************************/
78  PLASMA_Complex64_t *A, int LDA, double *work)
79 {
80  int NB;
81  int status;
82  double value;
84  PLASMA_sequence *sequence = NULL;
86  PLASMA_desc descA;
87 
88  plasma = plasma_context_self();
89  if (plasma == NULL) {
90  plasma_fatal_error("PLASMA_zlanhe", "PLASMA not initialized");
92  }
93  /* Check input arguments */
94  if ( (norm != PlasmaMaxNorm) && (norm != PlasmaOneNorm)
95  && (norm != PlasmaInfNorm) && (norm != PlasmaFrobeniusNorm) ) {
96  plasma_error("PLASMA_zlanhe", "illegal value of norm");
97  return -1;
98  }
99  if ( (uplo != PlasmaUpper) && (uplo != PlasmaLower) ) {
100  plasma_error("PLASMA_zlanhe", "illegal value of uplo");
101  return -2;
102  }
103  if (N < 0) {
104  plasma_error("PLASMA_zlanhe", "illegal value of N");
105  return -3;
106  }
107  if (LDA < max(1, N)) {
108  plasma_error("PLASMA_zlanhe", "illegal value of LDA");
109  return -5;
110  }
111 
112  /* Quick return */
113  if ( N == 0)
114  return (double)0.0;
115 
116  /* Tune NB depending on M, N & NRHS; Set NBNB */
117  status = plasma_tune(PLASMA_FUNC_ZGEMM, N, N, 0);
118  if (status != PLASMA_SUCCESS) {
119  plasma_error("PLASMA_zlanhe", "plasma_tune() failed");
120  return status;
121  }
122 
123  /* Set NT */
124  NB = PLASMA_NB;
125 
126  plasma_sequence_create(plasma, &sequence);
127 
129  plasma_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N, plasma_desc_mat_free(&(descA)) );
130  } else {
131  plasma_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, N, N);
132  }
133 
134  /* Call the tile interface */
135  PLASMA_zlanhe_Tile_Async(norm, uplo, &descA, work, &value, sequence, &request);
136 
139  plasma_desc_mat_free(&descA);
140  } else {
141  plasma_ziptile2lap( descA, A, NB, NB, LDA, N );
143  }
144 
145  plasma_sequence_destroy(plasma, sequence);
146  return value;
147 }
148 
149 /***************************************************************************/
196 {
198  PLASMA_sequence *sequence = NULL;
200  double value;
201 
202  plasma = plasma_context_self();
203  if (plasma == NULL) {
204  plasma_fatal_error("PLASMA_zlanhe_Tile", "PLASMA not initialized");
206  }
207  plasma_sequence_create(plasma, &sequence);
208  PLASMA_zlanhe_Tile_Async(norm, uplo, A, work, &value, sequence, &request);
210  plasma_sequence_destroy(plasma, sequence);
211  return value;
212 }
213 
214 /***************************************************************************/
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_zlanhe_Tile", "PLASMA not initialized");
250  }
251  if (sequence == NULL) {
252  plasma_fatal_error("PLASMA_zlanhe_Tile", "NULL sequence");
253  return PLASMA_ERR_UNALLOCATED;
254  }
255  if (request == NULL) {
256  plasma_fatal_error("PLASMA_zlanhe_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_zlanhe_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_zlanhe_Tile", "only square tiles supported");
273  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
274  }
275  if ( (norm != PlasmaMaxNorm) && (norm != PlasmaOneNorm)
276  && (norm != PlasmaInfNorm) && (norm != PlasmaFrobeniusNorm) ) {
277  plasma_error("PLASMA_zlanhe_Tile", "illegal value of norm");
278  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
279  }
280  if ( (uplo != PlasmaUpper) && (uplo != PlasmaLower) ) {
281  plasma_error("PLASMA_zlanhe_Tile", "illegal value of uplo");
282  return plasma_request_fail(sequence, request, PLASMA_ERR_ILLEGAL_VALUE);
283  }
284  /* Quick return */
285  if ( descA.m == 0) {
286  *value = 0.0;
287  return PLASMA_SUCCESS;
288  }
289 
291  PLASMA_enum, norm,
292  PLASMA_enum, uplo,
293  PLASMA_desc, descA,
294  double*, work,
295  double*, value,
296  PLASMA_sequence*, sequence,
297  PLASMA_request*, request);
298 
299  return PLASMA_SUCCESS;
300 }