38 USAGE(
"TRMM",
"alpha M N LDA LDB",
39 " - alpha : alpha coefficient\n"
40 " - M : number of rows of matrices B\n"
41 " - N : number of columns of matrices B\n"
42 " - LDA : leading dimension of matrix A\n"
43 " - LDB : leading dimension of matrix B\n");
48 int M = atoi(argv[1]);
49 int N = atoi(argv[2]);
50 int LDA = atoi(argv[3]);
51 int LDB = atoi(argv[4]);
56 int LDAxM = LDA*
max(M,N);
57 int LDBxN = LDB*
max(M,N);
65 if ( (!A) || (!
B) || (!Binit) || (!Bfinal)){
66 printf(
"Out of Memory \n ");
70 eps = LAPACKE_slamch_work(
'e');
73 printf(
"------ TESTS FOR PLASMA CTRMM ROUTINE ------- \n");
74 printf(
" Size of the Matrix B : %d by %d\n", M, N);
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, LDAxM, A);
87 LAPACKE_clarnv_work(
IONE,
ISEED, LDBxN, B);
88 for(i=0;i<
max(M,N);i++)
89 A[LDA*i+i] = A[LDA*i+i] + 2.0;
105 M, N, alpha, A, LDA, Bfinal, LDB);
109 M, N, alpha, A, LDA, Binit, Bfinal, LDB);
111 printf(
"***************************************************\n");
112 if (info_solution == 0) {
113 printf(
" ---- TESTING CTRMM (%s, %s, %s, %s) ...... PASSED !\n",
117 printf(
" ---- TESTING CTRMM (%s, %s, %s, %s) ... FAILED !\n",
120 printf(
"***************************************************\n");
127 free(Binit); free(Bfinal);
141 float Anorm, Binitnorm, Bplasmanorm, Blapacknorm, Rnorm, result;
145 float *work = (
float *)malloc(
max(M, N)*
sizeof(float));
155 Am, An, A, LDA, work);
168 eps = LAPACKE_slamch_work(
'e');
170 printf(
"Rnorm %e, Anorm %e, Binitnorm %e, Bplasmanorm %e, Blapacknorm %e\n",
171 Rnorm, Anorm, Binitnorm, Bplasmanorm, Blapacknorm);
173 result = Rnorm / ((Anorm + Blapacknorm) *
max(M,N) * eps);
175 printf(
"============\n");
176 printf(
"Checking the norm of the difference against reference CTRMM \n");
177 printf(
"-- ||Cplasma - Clapack||_oo/((||A||_oo+||B||_oo).N.eps) = %e \n", result);
179 if ( isinf(Blapacknorm) || isinf(Bplasmanorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
180 printf(
"-- The solution is suspicious ! \n");
184 printf(
"-- The solution is CORRECT ! \n");
189 return info_solution;