35 USAGE(
"HERK",
"alpha beta M N LDA LDC",
36 " - alpha : alpha coefficient\n"
37 " - beta : beta coefficient\n"
38 " - N : number of columns and rows of matrix C and number of row of matrix A\n"
39 " - K : number of columns of matrix A\n"
40 " - LDA : leading dimension of matrix A\n"
41 " - LDC : leading dimension of matrix C\n");
45 float alpha = (float) atol(argv[0]);
46 float beta = (float) atol(argv[1]);
47 int N = atoi(argv[2]);
48 int K = atoi(argv[3]);
49 int LDA = atoi(argv[4]);
50 int LDC = atoi(argv[5]);
51 int NKmax =
max(N, K);
56 size_t LDAxK = LDA*NKmax;
65 if ( (!A) || (!Cinit) || (!Cfinal) ){
66 printf(
"Out of Memory \n ");
70 eps = LAPACKE_slamch_work(
'e');
73 printf(
"------ TESTS FOR PLASMA CHERK ROUTINE ------- \n");
74 printf(
" Size of the Matrix A %d by %d\n", N, K);
76 printf(
" The matrix A is randomly generated for each test.\n");
77 printf(
"============\n");
78 printf(
" The relative machine precision (eps) is to be %e \n",eps);
79 printf(
" Computational tests pass if scaled residuals are less than 10.\n");
86 LAPACKE_clarnv_work(
IONE,
ISEED, LDAxK, A);
103 alpha, A, LDA, beta, Cinit, Cfinal, LDC);
105 if (info_solution == 0) {
106 printf(
"***************************************************\n");
107 printf(
" ---- TESTING CHERK (%5s, %s) ........... PASSED !\n",
uplostr[u],
transstr[t]);
108 printf(
"***************************************************\n");
111 printf(
"************************************************\n");
112 printf(
" - TESTING CHERK (%5s, %s) ... FAILED !\n",
uplostr[u],
transstr[t]);
113 printf(
"************************************************\n");
119 free(Cinit); free(Cfinal);
133 float Anorm, Cinitnorm, Cplasmanorm, Clapacknorm, Rnorm;
137 float *work = (
float *)malloc(
max(N, K)*
sizeof(float));
147 N, K, (alpha), A, LDA, (beta), Cref, LDC);
155 eps = LAPACKE_slamch_work(
'e');
157 printf(
"Rnorm %e, Anorm %e, Cinitnorm %e, Cplasmanorm %e, Clapacknorm %e\n",
158 Rnorm, Anorm, Cinitnorm, Cplasmanorm, Clapacknorm);
160 result = Rnorm / ((Anorm + Cinitnorm) * N * eps);
162 printf(
"============\n");
163 printf(
"Checking the norm of the difference against reference CHERK \n");
164 printf(
"-- ||Cplasma - Clapack||_oo/((||A||_oo+||C||_oo).N.eps) = %e \n", result);
166 if ( isinf(Clapacknorm) || isinf(Cplasmanorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
167 printf(
"-- The solution is suspicious ! \n");
171 printf(
"-- The solution is CORRECT ! \n");
177 return info_solution;