36 USAGE(
"HER2K",
"alpha beta M N LDA LDB LDC",
37 " - alpha : alpha coefficient\n"
38 " - beta : beta coefficient\n"
39 " - N : number of columns and rows of matrix C and number of row of matrix A and B\n"
40 " - K : number of columns of matrix A and B\n"
41 " - LDA : leading dimension of matrix A\n"
42 " - LDB : leading dimension of matrix B\n"
43 " - LDC : leading dimension of matrix C\n");
48 float beta = (float) atol(argv[1]);
49 int N = atoi(argv[2]);
50 int K = atoi(argv[3]);
51 int LDA = atoi(argv[4]);
52 int LDB = atoi(argv[5]);
53 int LDC = atoi(argv[6]);
54 int NKmax =
max(N, K);
59 size_t LDAxK = LDA*NKmax;
60 size_t LDBxK = LDB*NKmax;
70 if ( (!A) || (!
B) || (!Cinit) || (!Cfinal) ){
71 printf(
"Out of Memory \n ");
75 eps = LAPACKE_slamch_work(
'e');
78 printf(
"------ TESTS FOR PLASMA CHER2K ROUTINE ------- \n");
79 printf(
" Size of the Matrix C %d by %d\n", N, K);
81 printf(
" The matrix A is randomly generated for each test.\n");
82 printf(
"============\n");
83 printf(
" The relative machine precision (eps) is to be %e \n",eps);
84 printf(
" Computational tests pass if scaled residuals are less than 10.\n");
91 LAPACKE_clarnv_work(
IONE,
ISEED, LDAxK, A);
92 LAPACKE_clarnv_work(
IONE,
ISEED, LDBxK, B);
105 PLASMA_cher2k(
uplo[u],
trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cfinal, LDC);
109 alpha, A, LDA, B, LDB, beta, Cinit, Cfinal, LDC);
111 if (info_solution == 0) {
112 printf(
"***************************************************\n");
113 printf(
" ---- TESTING CHER2K (%5s, %s) ........... PASSED !\n",
uplostr[u],
transstr[t]);
114 printf(
"***************************************************\n");
117 printf(
"************************************************\n");
118 printf(
" - TESTING CHER2K (%5s, %s) ... FAILED !\n",
uplostr[u],
transstr[t]);
119 printf(
"************************************************\n");
124 free(A); free(B); free(C);
125 free(Cinit); free(Cfinal);
140 float Anorm, Bnorm, Cinitnorm, Cplasmanorm, Clapacknorm, Rnorm, result;
144 float *work = (
float *)malloc(
max(N, K)*
sizeof(float));
157 N, K,
CBLAS_SADDR(alpha), A, LDA, B, LDB, (beta), Cref, LDC);
165 eps = LAPACKE_slamch_work(
'e');
167 printf(
"Rnorm %e, Anorm %e, Cinitnorm %e, Cplasmanorm %e, Clapacknorm %e\n",
168 Rnorm, Anorm, Cinitnorm, Cplasmanorm, Clapacknorm);
170 result = Rnorm / ((Anorm + Bnorm + Cinitnorm) * N * eps);
171 printf(
"============\n");
172 printf(
"Checking the norm of the difference against reference CHER2K \n");
173 printf(
"-- ||Cplasma - Clapack||_oo/((||A||_oo+||C||_oo).N.eps) = %e \n", result);
175 if ( isnan(Rnorm) || isinf(Rnorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
176 printf(
"-- The solution is suspicious ! \n");
180 printf(
"-- The solution is CORRECT ! \n");
186 return info_solution;