35 USAGE(
"HEMM",
"alpha beta M N K LDA LDB LDC",
36 " - alpha : alpha coefficient \n"
37 " - beta : beta coefficient \n"
38 " - M : number of rows of matrices A and C \n"
39 " - N : number of columns of matrices B and C \n"
40 " - LDA : leading dimension of matrix A \n"
41 " - LDB : leading dimension of matrix B \n"
42 " - LDC : leading dimension of matrix C\n");
48 int M = atoi(argv[2]);
49 int N = atoi(argv[3]);
50 int LDA = atoi(argv[4]);
51 int LDB = atoi(argv[5]);
52 int LDC = atoi(argv[6]);
53 int MNmax =
max(M, N);
58 int LDAxM = LDA*MNmax;
69 if ((!A)||(!
B)||(!Cinit)||(!Cfinal)){
70 printf(
"Out of Memory \n ");
74 eps = LAPACKE_slamch_work(
'e');
77 printf(
"------ TESTS FOR PLASMA CHEMM ROUTINE ------- \n");
78 printf(
" Size of the Matrix %d by %d\n", M, N);
80 printf(
" The matrix A is randomly generated for each test.\n");
81 printf(
"============\n");
82 printf(
" The relative machine precision (eps) is to be %e \n",eps);
83 printf(
" Computational tests pass if scaled residuals are less than 10.\n");
93 LAPACKE_clarnv_work(
IONE,
ISEED, LDBxN, B);
96 LAPACKE_clarnv_work(
IONE,
ISEED, LDCxN, C);
102 for ( i = 0; i < M; i++)
103 for ( j = 0; j < N; j++)
104 Cinit[LDC*j+i] = C[LDC*j+i];
105 for ( i = 0; i < M; i++)
106 for ( j = 0; j < N; j++)
107 Cfinal[LDC*j+i] = C[LDC*j+i];
110 PLASMA_chemm(
side[s],
uplo[u], M, N, alpha, A, LDA, B, LDB, beta, Cfinal, LDC);
113 info_solution =
check_solution(
side[s],
uplo[u], M, N, alpha, A, LDA, B, LDB, beta, Cinit, Cfinal, LDC);
115 if (info_solution == 0) {
116 printf(
"***************************************************\n");
117 printf(
" ---- TESTING CHEMM (%5s, %5s) ....... PASSED !\n",
sidestr[s],
uplostr[u]);
118 printf(
"***************************************************\n");
121 printf(
"************************************************\n");
122 printf(
" - TESTING CHEMM (%s, %s) ... FAILED !\n",
sidestr[s],
uplostr[u]);
123 printf(
"************************************************\n");
128 free(A); free(B); free(C);
129 free(Cinit); free(Cfinal);
143 int info_solution, NrowA;
144 float Anorm, Bnorm, Cinitnorm, Cplasmanorm, Clapacknorm, Rnorm;
148 float *work = (
float *)malloc(
max(M, N)*
sizeof(float));
158 cblas_chemm(
CblasColMajor, (
CBLAS_SIDE)side, (
CBLAS_UPLO)uplo, M, N,
CBLAS_SADDR(alpha), A, LDA, B, LDB,
CBLAS_SADDR(beta), Cref, LDC);
166 eps = LAPACKE_slamch_work(
'e');
168 printf(
"Rnorm %e, Anorm %e, Bnorm %e, Cinitnorm %e, Cplasmanorm %e, Clapacknorm %e\n",Rnorm,Anorm,Bnorm,Cinitnorm,Cplasmanorm,Clapacknorm);
170 result = Rnorm / ((Anorm + Bnorm + Cinitnorm) * N * eps);
172 printf(
"============\n");
173 printf(
"Checking the norm of the difference against reference CHEMM \n");
174 printf(
"-- ||Cplasma - Clapack||_oo/((||A||_oo+||B||_oo+||C||_oo).N.eps) = %e \n", result );
176 if ( isinf(Clapacknorm) || isinf(Cplasmanorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
177 printf(
"-- The solution is suspicious ! \n");
181 printf(
"-- The solution is CORRECT ! \n");
185 return info_solution;